Преглед изворни кода

fix: newlines after final note line in yaml formatter

Sam Jaffe пре 3 недеља
родитељ
комит
bb92d06162
1 измењених фајлова са 3 додато и 3 уклоњено
  1. 3 3
      Todos/Model/Task.swift

+ 3 - 3
Todos/Model/Task.swift

@@ -44,9 +44,9 @@ final class SubTask {
   func yaml(_ indent: Int = 0) -> String {
     let h1 = String(repeating: "  ", count: indent)
     let h2 = String(repeating: "  ", count: indent + 1)
-    var rval = h1 + "[\(status.rawValue)] \(name)\n"
+    var rval = h1 + "- [\(status.rawValue)] \(name)\n"
     if !notes.isEmpty {
-      rval += h2 + "# " + notes.replacingOccurrences(of: "\n", with: "\n" + h2 + "# ")
+      rval += h2 + "# " + notes.replacingOccurrences(of: "\n", with: "\n" + h2 + "# ") + "\n"
     }
     return rval
   }
@@ -78,7 +78,7 @@ final class Task {
     var rval = h1 + "[\(status.rawValue)] \(name) "
     rval += "(\(tags.map(\.id).joined(separator: " ")))\n"
     if !notes.isEmpty {
-      rval += h2 + "# " + notes.replacingOccurrences(of: "\n", with: "\n" + h2 + "# ")
+      rval += h2 + "# " + notes.replacingOccurrences(of: "\n", with: "\n" + h2 + "# ") + "\n"
     }
     rval += subtasks.map({ $0.yaml(indent + 1) }).joined()
     return rval