better output
This commit is contained in:
@@ -20,5 +20,7 @@ I went through many tests and iterations before coming to even
|
|||||||
this minimal start and it was extremely frustrating.
|
this minimal start and it was extremely frustrating.
|
||||||
|
|
||||||
## Tasks
|
## Tasks
|
||||||
- [ ] I need an option / 2nd script to output a version with no
|
- [x] I need an option / 2nd script to output a version with no
|
||||||
timecode formatting for easier text extraction.
|
timecode formatting for easier text extraction.
|
||||||
|
- I made it actually just combine both in the same document,
|
||||||
|
easier to manage that way.
|
||||||
|
|||||||
+10
-2
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env luajit
|
#!/usr/bin/env luajit
|
||||||
local version = "0.3.0"
|
local version = "0.4.0"
|
||||||
|
|
||||||
local input_file_name = arg[1]
|
local input_file_name = arg[1]
|
||||||
assert(input_file_name,
|
assert(input_file_name,
|
||||||
@@ -32,6 +32,7 @@ for line in io.lines(input_file_name) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
local output_lines = {}
|
local output_lines = {}
|
||||||
|
local timecode_free_lines = {}
|
||||||
for index, line in ipairs(input_lines) do
|
for index, line in ipairs(input_lines) do
|
||||||
if not (line:sub(3, 3) == ":") then
|
if not (line:sub(3, 3) == ":") then
|
||||||
local previous_line = input_lines[index - 1]
|
local previous_line = input_lines[index - 1]
|
||||||
@@ -41,8 +42,10 @@ for index, line in ipairs(input_lines) do
|
|||||||
else
|
else
|
||||||
output_lines[#output_lines + 1] = "`" .. string.rep(" ", 6) .. line .. "`" -- pandoc will ignore this margin
|
output_lines[#output_lines + 1] = "`" .. string.rep(" ", 6) .. line .. "`" -- pandoc will ignore this margin
|
||||||
end
|
end
|
||||||
|
timecode_free_lines[#timecode_free_lines + 1] = line
|
||||||
else
|
else
|
||||||
output_lines[#output_lines + 1] = "`" .. line .. "`"
|
output_lines[#output_lines + 1] = "`" .. line .. "`"
|
||||||
|
timecode_free_lines[#timecode_free_lines + 1] = line:sub(7)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -52,9 +55,14 @@ assert(output_file, "Could not open \"" .. output_file_name .. "\"")
|
|||||||
output_file:write(table.concat(frontmatter, "\n"))
|
output_file:write(table.concat(frontmatter, "\n"))
|
||||||
output_file:write("\n")
|
output_file:write("\n")
|
||||||
|
|
||||||
|
output_file:write("# Raw Transcript\n\n")
|
||||||
|
output_file:write(table.concat(timecode_free_lines, "\n"))
|
||||||
|
output_file:write("\n\n")
|
||||||
|
|
||||||
|
output_file:write("# Timecoded Transcript\n\n")
|
||||||
output_file:write(table.concat(output_lines, "\n"))
|
output_file:write(table.concat(output_lines, "\n"))
|
||||||
output_file:write("\n")
|
output_file:write("\n")
|
||||||
output_file:close()
|
output_file:close()
|
||||||
|
|
||||||
os.execute("pandoc --from markdown+hard_line_breaks \""
|
os.execute("pandoc --from markdown+hard_line_breaks \""
|
||||||
.. output_file_name .. "\" -o \"" .. title .. ".epub\"")
|
.. output_file_name .. "\" --toc=true -o \"" .. title .. ".epub\"")
|
||||||
|
|||||||
Reference in New Issue
Block a user