From bfc44da3d3fd66034ab868c1f0fefaf7eac54b37 Mon Sep 17 00:00:00 2001 From: Tangent Date: Tue, 20 Feb 2024 01:23:26 -0700 Subject: [PATCH] shitty pdf converter added --- 2pdf.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 2pdf.lua diff --git a/2pdf.lua b/2pdf.lua new file mode 100644 index 0000000..b8f09b9 --- /dev/null +++ b/2pdf.lua @@ -0,0 +1,14 @@ +#!/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. + +local error_occurred, utility = pcall(function() return dofile(arg[0]:match("@?(.*/)") or arg[0]:match("@?(.*\\)") .. "utility-functions.lua") end) if not error_occurred then error("\n\nThis script is installed improperly. Follow instructions at:\n\thttps://github.com/TangentFoxy/.lua-files#installation\n") end + +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)