Compare commits
2
Commits
b99dc3b5b2
...
dad2acc197
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dad2acc197 | ||
|
|
901990d6f5 |
+11
-5
@@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env luajit
|
||||
local version = "0.1"
|
||||
|
||||
local input_file_name = arg[1]
|
||||
assert(input_file_name,
|
||||
"You must enter an input file (its name will be the title).")
|
||||
@@ -14,16 +16,20 @@ local output_file_name = title .. ".md"
|
||||
local output_file = io.open(output_file_name, "w")
|
||||
assert(output_file, "Could not open \"" .. output_file_name .. "\"")
|
||||
|
||||
for _, line in ipairs{
|
||||
local frontmatter = {
|
||||
"---",
|
||||
"title: \"" .. title .. "\"",
|
||||
"author: \"" .. author .. "\"",
|
||||
"publisher: \"yt-transcript-tools v0.1\"",
|
||||
"publisher: \"yt-transcript-tools v" .. version .. "\"",
|
||||
"---",
|
||||
"",
|
||||
"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("\n")
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user