commit b4038f0c19234081e354b05111194c6da9c2e754
parent 1737a929550fd88267dfbc586891d84738863f00
Author: FIGBERT <figbert@figbert.com>
Date: Tue, 20 Apr 2021 11:04:59 -0700
Ensure line type comments are consistent
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/Sources/SwiftGemtext/SwiftGemtext.swift b/Sources/SwiftGemtext/SwiftGemtext.swift
@@ -33,7 +33,7 @@ struct Gemtext {
}
func parsePlainLine(_ line: String) -> LineType {
- if line.starts(with: "#") { // Heading
+ if line.starts(with: "#") { // Heading Line
var level: Int = 1
if line.starts(with: "###") {
level = 3
@@ -41,7 +41,7 @@ struct Gemtext {
level = 2
}
return LineType.Heading(level, line.dropFirst(level).trimmingCharacters(in: .whitespacesAndNewlines))
- } else if line.starts(with: "=>") { // Link
+ } else if line.starts(with: "=>") { // Link Line
let urlAndCaption = line.dropFirst(2).trimmingCharacters(in: .whitespacesAndNewlines)
let delim = urlAndCaption.firstIndex(of: " ")
if delim != nil {
@@ -51,13 +51,13 @@ struct Gemtext {
} else {
return LineType.Link(URL(string: urlAndCaption)!, nil)
}
- } else if line.starts(with: "* ") { // Unordered List
+ } else if line.starts(with: "* ") { // Unordered List Line
return LineType.UnorderedList(line.dropFirst(2).trimmingCharacters(in: .whitespacesAndNewlines))
- } else if line.starts(with: ">") { // Quote
+ } else if line.starts(with: ">") { // Quote Line
return LineType.Quote(String(line.dropFirst(2)))
} else if line.trimmingCharacters(in: .whitespacesAndNewlines) == "" { // Empty Line
return LineType.EmptyLine
- } else {
+ } else { // Text Line
return LineType.Text(line)
}
}