Skip to content

Commit

Permalink
switch quote type
Browse files Browse the repository at this point in the history
  • Loading branch information
daydemir committed May 6, 2024
1 parent 83f66b6 commit f823c86
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Sources/logseq-compiler/compiler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ extension HugoBlock {
let headerContent = yamlProperties + "\n" + hugo + extras
let readableName = readableName()

return "---\n" + "title: \'\(readableName ?? "Untitled")\'\n" + headerContent + "---\n"
return "---\n" + "title: \((readableName ?? "Untitled").quoted())\n" + headerContent + "---\n"
}

private func updateAssetLinks(forContent content: String) -> String {
Expand Down Expand Up @@ -427,6 +427,14 @@ extension String {
func escapedQuotes() -> String {
return replacingOccurrences(of: #"""#, with: #"\""#)
}

func quoted() -> String {
if contains("'") {
return "\"\(self)\""
} else {
return "'\(self)'"
}
}
}

extension Dictionary where Key == Int, Value == Block {
Expand Down

0 comments on commit f823c86

Please sign in to comment.