diff options
-rw-r--r-- | Master/texmf-dist/doc/generic/markdown/markdown.pdf | bin | 346182 -> 346795 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/generic/markdown/markdown.dtx | 53 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/markdown/markdown.tex | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/markdown/markdown.lua | 47 |
4 files changed, 79 insertions, 25 deletions
diff --git a/Master/texmf-dist/doc/generic/markdown/markdown.pdf b/Master/texmf-dist/doc/generic/markdown/markdown.pdf Binary files differindex 761ee61b522..d7d0e73eeb5 100644 --- a/Master/texmf-dist/doc/generic/markdown/markdown.pdf +++ b/Master/texmf-dist/doc/generic/markdown/markdown.pdf diff --git a/Master/texmf-dist/source/generic/markdown/markdown.dtx b/Master/texmf-dist/source/generic/markdown/markdown.dtx index b8518cd69d5..876a9e27dfe 100644 --- a/Master/texmf-dist/source/generic/markdown/markdown.dtx +++ b/Master/texmf-dist/source/generic/markdown/markdown.dtx @@ -111,7 +111,7 @@ edition = {3}, isbn = {0-201-13447-0}, pagetotal = {ix, 479}, - publisher = {Addison-Westley}} + publisher = {Addison-Wesley}} \end{filecontents} \usepackage[ backend=biber, @@ -156,7 +156,7 @@ % \fi % \begin{macrocode} 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; " .. @@ -719,8 +719,8 @@ defaultOptions.underscores = true % \ref{sec:luaoptions}) used during the conversion from markdown to plain % \TeX{}, and for changing the way markdown the tokens are rendered. % \begin{macrocode} -\def\markdownLastModified{2017/04/10}% -\def\markdownVersion{2.5.0}% +\def\markdownLastModified{2017/04/27}% +\def\markdownVersion{2.5.1}% % \end{macrocode} % % The plain \TeX{} interface is implemented by the \t`markdown.tex` file that @@ -2651,14 +2651,24 @@ 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 ", + } % \end{macrocode} % Use the \luam{escaped_chars} table to create an escaper function % \luamdef{escape} and the \luam{escaped_minimal_chars} and @@ -2666,8 +2676,9 @@ function M.writer.new(options) % \luamdef{escape_minimal}. % \begin{macrocode} 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) % \end{macrocode} % % Define \luamdef{writer->string} as a function that will transform an input @@ -2678,10 +2689,12 @@ function M.writer.new(options) % \begin{macrocode} 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 % \end{macrocode} % @@ -3026,7 +3039,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("__") @@ -3143,7 +3156,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 % \end{macrocode} @@ -3706,7 +3733,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 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 |