make link actually optional
This commit is contained in:
@@ -14,16 +14,20 @@ local output_file_name = title .. ".md"
|
|||||||
local output_file = io.open(output_file_name, "w")
|
local output_file = io.open(output_file_name, "w")
|
||||||
assert(output_file, "Could not open \"" .. output_file_name .. "\"")
|
assert(output_file, "Could not open \"" .. output_file_name .. "\"")
|
||||||
|
|
||||||
for _, line in ipairs{
|
local frontmatter = {
|
||||||
"---",
|
"---",
|
||||||
"title: \"" .. title .. "\"",
|
"title: \"" .. title .. "\"",
|
||||||
"author: \"" .. author .. "\"",
|
"author: \"" .. author .. "\"",
|
||||||
"publisher: \"yt-transcript-tools v0.1\"",
|
"publisher: \"yt-transcript-tools v0.1\"",
|
||||||
"---",
|
"---",
|
||||||
"",
|
"",
|
||||||
"From [" .. link .. "](" .. link .. ")",
|
}
|
||||||
"",
|
|
||||||
} do
|
if link and #link > 0 then
|
||||||
|
frontmatter[#frontmatter + 1] = "From [" .. link .. "](" .. link .. ")\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, line in ipairs(frontmatter) do
|
||||||
output_file:write(line)
|
output_file:write(line)
|
||||||
output_file:write("\n")
|
output_file:write("\n")
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user