.lua-files/2pdf.lua

21 lines
834 B
Lua
Raw Normal View History

2024-02-20 08:23:26 +00:00
#!/usr/bin/env luajit
-- The first time this is run (on Windows), a dialog will appear.
-- Uncheck the "always show this" thing and click Install.
2024-11-06 04:54:00 +00:00
local success, utility = pcall(function()
return dofile((arg[0]:match("@?(.*/)") or arg[0]:match("@?(.*\\)")) .. "utility-functions.lua")
end)
if not success then
print("\n\n" .. tostring(utility))
error("\n\nThis script may be installed improperly. Follow instructions at:\n\thttps://github.com/TangentFoxy/.lua-files#installation\n")
end
2024-02-20 08:23:26 +00:00
local for_files = utility.ls()
os.execute("mkdir 2pdf-output")
for_files(function(file_name)
local name_sans_extension = file_name:sub(1, -5) -- temporarily hardcoding expectation that the input file has a 3-digit file extension
os.execute("pandoc \"" .. file_name .. "\" -o \"2pdf-output/" .. name_sans_extension .. ".pdf\"")
end)