summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/generic/markdown/markdown.dtx53
1 files changed, 40 insertions, 13 deletions
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