#!/usr/bin/env texlua -- Copyright 2016-2024 Brian Dunn printversion = "v0.916" requiredconfversion = "2" -- also at *lwarpmk.conf function printhelp () print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ; end function printusage () -- -- Print the usage of the lwarpmk command: -- print ( [[ lwarpmk print [-p project]: Compile the print version if necessary. lwarpmk print1 [-p project]: Forced single compile of the print version. lwarpmk printindex [-p project]: Process print indexes. lwarpmk printglossary [-p project]: Process the glossary for the print version. lwarpmk html [-p project]: Compile the HTML version if necessary. lwarpmk html1 [-p project]: Forced single compile of the HTML version. lwarpmk htmlindex [-p project]: Process HTML indexes. lwarpmk htmlglossary [-p project]: Process the glossary for the html version. lwarpmk again [-p project]: Touch the source code to trigger recompiles. lwarpmk limages [-p project]: Process the "lateximages" created by lwarp.sty. lwarpmk pdftohtml [-p project]: For use with latexmk or a Makefile: Converts project_html.pdf to project_html.html and individual HTML files. Finishes the HTML conversion even if there was a compile error. lwarpmk pdftosvg : Converts each PDF file to SVG. lwarpmk epstopdf : Converts each EPS file to PDF. lwarpmk clean [-p project]: Remove *.aux, *.toc, *.lof/t, *.idx, *.ind, *.bbl, *.log, *_html_inc.*, .gl*, *_html.pdf, *_html.html, *_html.sidetoc lwarpmk cleanall [-p project]: Remove auxiliary files, project.pdf, *.html lwarpmk cleanlimages: Removes all images from the "lateximages" directory. lwarpmk -v: Print the version number. lwarpmk -h: Print this help message. lwarpmk --help: Print this help message. ]] ) -- printconf () end function splitfilename ( pathandfilename ) -- -- Separates out the path and extension from a filename. -- Returns path, filename with extension, and extension. -- Ex: thispath, thisfilename, thisextension = splitfilename ("path/to/filename.ext") -- -- https://www.fhug.org.uk/wiki/wiki/doku.php?id=plugins:code_snippets: -- split_filename_in_to_path_filename_and_extension -- if lfs.attributes(pathandfilename,"mode") == "directory" then local strPath = pathandfilename:gsub("[\\/]$","") -- $ (syntax highlighting) return strPath.."\\","","" end pathandfilename = pathandfilename.."." return pathandfilename:match("^(.-)([^\\/]-)%.([^\\/%.]-)%.?$") end function splitfile (destfile,sourcefile) -- -- Split one large sourcefile into a number of files, -- starting with destfile. -- The file is split at each occurance of