瀏覽代碼

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