From d0d20a6ba7cff5159a2f78b414326262f45b0542 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 7 Aug 2021 20:19:27 +0000 Subject: markdown (7aug21) git-svn-id: svn://tug.org/texlive/trunk@60182 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/scripts/markdown/markdown-cli.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'Master/texmf-dist/scripts') diff --git a/Master/texmf-dist/scripts/markdown/markdown-cli.lua b/Master/texmf-dist/scripts/markdown/markdown-cli.lua index 216cd187a1d..c7da760a389 100644 --- a/Master/texmf-dist/scripts/markdown/markdown-cli.lua +++ b/Master/texmf-dist/scripts/markdown/markdown-cli.lua @@ -20,7 +20,7 @@ -- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- --- Copyright (C) 2016-2020 Vít Novotný +-- Copyright (C) 2016-2021 Vít Novotný -- -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -58,11 +58,11 @@ -- those in the standard .ins files. -- local metadata = { - version = "2.9.0", + version = "2.10.0", comment = "A module for the conversion from markdown to plain TeX", author = "John MacFarlane, Hans Hagen, Vít Novotný", copyright = {"2009-2016 John MacFarlane, Hans Hagen", - "2016-2020 Vít Novotný"}, + "2016-2021 Vít Novotný"}, license = "LPPL 1.3" } @@ -94,7 +94,9 @@ defaultOptions.shiftHeadings = 0 defaultOptions.slice = "^ $" defaultOptions.smartEllipses = false defaultOptions.startNumber = true +defaultOptions.stripIndent = false defaultOptions.tableCaptions = false +defaultOptions.texComments = false defaultOptions.tightLists = true defaultOptions.underscores = true @@ -175,7 +177,8 @@ end local input if input_filename then - local input_file = assert(io.open(input_filename, "r")) + local input_file = assert(io.open(input_filename, "r"), + [[could not open file "]] .. input_filename .. [[" for reading]]) input = assert(input_file:read("*a")) assert(input_file:close()) else @@ -187,8 +190,8 @@ if options.cacheDir and not lfs.isdir(options.cacheDir) then assert(lfs.mkdir(options["cacheDir"])) end -local kpse = require("kpse") -kpse.set_program_name("luatex") +local ran_ok, kpse = pcall(require, "kpse") +if ran_ok then kpse.set_program_name("luatex") end local md = require("markdown") if metadata.version ~= md.metadata.version then warn("markdown-cli.lua " .. metadata.version .. " used with " .. @@ -198,7 +201,8 @@ local convert = md.new(options) local output = convert(input:gsub("\r\n?", "\n") .. "\n") if output_filename then - local output_file = assert(io.open(output_filename, "w")) + local output_file = assert(io.open(output_filename, "w"), + [[could not open file "]] .. output_filename .. [[" for writing]]) assert(output_file:write(output)) assert(output_file:close()) else -- cgit v1.2.3