diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/markdown/markdown.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/markdown/markdown.lua | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/luatex/markdown/markdown.lua b/Master/texmf-dist/tex/luatex/markdown/markdown.lua index 36d2b611a78..e6127c8bf6d 100644 --- a/Master/texmf-dist/tex/luatex/markdown/markdown.lua +++ b/Master/texmf-dist/tex/luatex/markdown/markdown.lua @@ -58,7 +58,7 @@ -- those in the standard .ins files. -- local metadata = { - version = "2.8.2", + version = "2.9.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", @@ -74,6 +74,7 @@ local md5 = require("md5") local M = {metadata = metadata} local defaultOptions = {} defaultOptions.cacheDir = "." +defaultOptions.frozenCacheFileName = "frozenCache.tex" defaultOptions.blankBeforeBlockquote = false defaultOptions.blankBeforeCodeFence = false defaultOptions.blankBeforeHeading = false @@ -85,7 +86,9 @@ defaultOptions.contentBlocks = false defaultOptions.contentBlocksLanguageMap = "markdown-languages.json" defaultOptions.definitionLists = false defaultOptions.fencedCode = false +defaultOptions.finalizeCache = false defaultOptions.footnotes = false +defaultOptions.frozenCacheCounter = 0 defaultOptions.hashEnumerators = false defaultOptions.headerAttributes = false defaultOptions.html = false @@ -4033,7 +4036,21 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline local name = util.cache(options.cacheDir, input, salt, function(input) return util.rope_to_string(parse_blocks_toplevel(input)) .. writer.eof end, ".md" .. writer.suffix) - return writer.pack(name) + local output = writer.pack(name) + if options.finalizeCache then + local file, mode + if options.frozenCacheCounter > 0 then + mode = "a" + else + mode = "w" + end + file = assert(io.open(options.frozenCacheFileName, mode)) + assert(file:write([[\expandafter\def\csname markdownFrozenCache]] .. + options.frozenCacheCounter .. [[\endcsname{]] .. output .. [[}]] .. + "\n")) + assert(file:close()) + end + return output end return self end |