commit 90b09918d02636b404d3e24cf8ee474033331bfa parent 4c10c3829fd96c9654ae06f40d0311fe2b549b16 Author: FIGBERT <figbert@figbert.com> Date: Tue, 20 Apr 2021 11:31:04 -0700 Remove excess variable in Gemtext.parse Diffstat:
M | Sources/SwiftGemtext/SwiftGemtext.swift | | | 11 | +++++------ |
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/Sources/SwiftGemtext/SwiftGemtext.swift b/Sources/SwiftGemtext/SwiftGemtext.swift @@ -11,21 +11,20 @@ struct Gemtext { var lines = [LineType]() var pre = false for line in source.lines() { - let ln = String(line) if pre { - if ln.starts(with: "```") { + if line.starts(with: "```") { lines.append(LineType.PreformattingToggle(nil)) pre.toggle() } else { - lines.append(LineType.PreformattedText(ln)) + lines.append(LineType.PreformattedText(line)) } } else { - if ln.starts(with: "```") { - let alt = ln.dropFirst(3).trimmingCharacters(in: .whitespacesAndNewlines) + if line.starts(with: "```") { + let alt = line.dropFirst(3).trimmingCharacters(in: .whitespacesAndNewlines) lines.append(LineType.PreformattingToggle(alt.count > 0 ? alt : nil)) pre.toggle() } else { - lines.append(parsePlainLine(ln)) + lines.append(parsePlainLine(line)) } } }