diff options
author | Karl Berry <karl@freefriends.org> | 2017-04-28 21:15:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-04-28 21:15:29 +0000 |
commit | 820ef63cc91f5de399f217c713cb612537a18f18 (patch) | |
tree | 21eaa970c015a506178e666e6eb8dcd5e3dd3b1c /Master/texmf-dist/tex | |
parent | 6d13785c9ae3fb3397ba21f0791d38af7961b41a (diff) |
markdown (28apr17)
git-svn-id: svn://tug.org/texlive/trunk@44097 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/markdown/markdown.tex | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/markdown/markdown.lua | 47 |
2 files changed, 39 insertions, 12 deletions
diff --git a/Master/texmf-dist/tex/generic/markdown/markdown.tex b/Master/texmf-dist/tex/generic/markdown/markdown.tex index 9f765083498..15b3a89f688 100644 --- a/Master/texmf-dist/tex/generic/markdown/markdown.tex +++ b/Master/texmf-dist/tex/generic/markdown/markdown.tex @@ -45,8 +45,8 @@ %% %% The names of the source files used are shown above. %% -\def\markdownLastModified{2017/04/10}% -\def\markdownVersion{2.5.0}% +\def\markdownLastModified{2017/04/27}% +\def\markdownVersion{2.5.1}% \let\markdownBegin\relax \let\markdownEnd\relax \let\markdownInput\relax diff --git a/Master/texmf-dist/tex/luatex/markdown/markdown.lua b/Master/texmf-dist/tex/luatex/markdown/markdown.lua index 39668713584..c1a4b631e4f 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.5.0", + version = "2.5.1", comment = "A module for the conversion from markdown to plain TeX", author = "John MacFarlane, Hans Hagen, Vít Novotný", copyright = "2009-2017 John MacFarlane, Hans Hagen; " .. @@ -525,23 +525,36 @@ function M.writer.new(options) ["^"] = "\\markdownRendererCircumflex{}", ["\\"] = "\\markdownRendererBackslash{}", ["~"] = "\\markdownRendererTilde{}", - ["|"] = "\\markdownRendererPipe{}", } - local escaped_minimal_chars = { + ["|"] = "\\markdownRendererPipe{}", + } + local escaped_uri_chars = { ["{"] = "\\markdownRendererLeftBrace{}", ["}"] = "\\markdownRendererRightBrace{}", ["%"] = "\\markdownRendererPercentSign{}", - ["\\"] = "\\markdownRendererBackslash{}", } + ["\\"] = "\\markdownRendererBackslash{}", + } + local escaped_citation_chars = { + ["{"] = "\\markdownRendererLeftBrace{}", + ["}"] = "\\markdownRendererRightBrace{}", + ["%"] = "\\markdownRendererPercentSign{}", + ["#"] = "\\markdownRendererHash{}", + ["\\"] = "\\markdownRendererBackslash{}", + } local escaped_minimal_strings = { - ["^^"] = "\\markdownRendererCircumflex\\markdownRendererCircumflex ", } + ["^^"] = "\\markdownRendererCircumflex\\markdownRendererCircumflex ", + } local escape = util.escaper(escaped_chars) - local escape_minimal = util.escaper(escaped_minimal_chars, + local escape_citation = util.escaper(escaped_citation_chars, escaped_minimal_strings) + local escape_uri = util.escaper(escaped_uri_chars, escaped_minimal_strings) if options.hybrid then self.string = function(s) return s end + self.citation = function(c) return c end self.uri = function(u) return u end else self.string = escape - self.uri = escape_minimal + self.citation = escape_citation + self.uri = escape_uri end function self.code(s) return {"\\markdownRendererCodeSpan{",escape(s),"}"} @@ -764,7 +777,7 @@ parsers.letter = R("AZ","az") parsers.alphanumeric = R("AZ","az","09") parsers.keyword = parsers.letter * parsers.alphanumeric^0 -parsers.internal_punctuation = S(":;,.#$%&-+?<>~/") +parsers.internal_punctuation = S(":;,.#$%&-+?<>~/_") parsers.doubleasterisks = P("**") parsers.doubleunderscores = P("__") @@ -872,7 +885,21 @@ end parsers.fencedline = function(char) return C(parsers.line - parsers.fencetail(char)) / function(s) - return s:gsub("^" .. string.rep(" ?", fenceindent), "") + i = 1 + remaining = fenceindent + while true do + c = s:sub(i, i) + if c == " " and remaining > 0 then + remaining = remaining - 1 + i = i + 1 + elseif c == "\t" and remaining > 3 then + remaining = remaining - 4 + i = i + 1 + else + break + end + end + return s:sub(i) end end parsers.leader = parsers.space^-3 @@ -1343,7 +1370,7 @@ function M.reader.new(writer, options) cites[#cites+1] = { prenote = normalize(raw_cites[i]), suppress_author = raw_cites[i+1] == "-", - name = writer.string(raw_cites[i+2]), + name = writer.citation(raw_cites[i+2]), postnote = normalize(raw_cites[i+3]), } end |