diff options
author | Karl Berry <karl@freefriends.org> | 2020-03-22 20:48:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-03-22 20:48:39 +0000 |
commit | f64715886f780dbe1414b1b35a55b6177de54022 (patch) | |
tree | 5914ba3bedf74454954636a1c0943f7e4b41fda3 /Master/texmf-dist/source/generic | |
parent | 9947618e08e485b167afd30d95013b105eac7ad3 (diff) |
markdown (22mar20)
git-svn-id: svn://tug.org/texlive/trunk@54482 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/generic')
-rw-r--r-- | Master/texmf-dist/source/generic/markdown/docstrip.cfg | 4 | ||||
-rw-r--r-- | Master/texmf-dist/source/generic/markdown/markdown.dtx | 47 |
2 files changed, 34 insertions, 17 deletions
diff --git a/Master/texmf-dist/source/generic/markdown/docstrip.cfg b/Master/texmf-dist/source/generic/markdown/docstrip.cfg index a03b51c87b3..60f15d39350 100644 --- a/Master/texmf-dist/source/generic/markdown/docstrip.cfg +++ b/Master/texmf-dist/source/generic/markdown/docstrip.cfg @@ -22,7 +22,7 @@ -- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE^^J% -- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.^^J% -- ^^J% --- Copyright (C) 2016-2019 Vít Novotný^^J% +-- Copyright (C) 2016-2020 Vít Novotný^^J% -- ^^J% -- This work may be distributed and/or modified under the^^J% -- conditions of the LaTeX Project Public License, either version 1.3^^J% @@ -62,7 +62,7 @@ \let\luapostamble\empty \declarepreamble\texpreamble -Copyright (C) 2016-2019 Vít Novotný +Copyright (C) 2016-2020 Vít Novotný This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 diff --git a/Master/texmf-dist/source/generic/markdown/markdown.dtx b/Master/texmf-dist/source/generic/markdown/markdown.dtx index 71c06b81544..0cf9f4f9ace 100644 --- a/Master/texmf-dist/source/generic/markdown/markdown.dtx +++ b/Master/texmf-dist/source/generic/markdown/markdown.dtx @@ -535,8 +535,9 @@ The [Markdown package][pkg] converts [markdown][] markup to \TeX{} commands. The functionality is provided both as a Lua module and as plain \TeX{}, \LaTeX{}, and \Hologo{ConTeXt} macro packages that can be used to directly typeset \TeX documents containing markdown markup. Unlike other convertors, the Markdown package -makes it easy to redefine how each and every markdown element is rendered. -Creative abuse of the markdown syntax is encouraged. ;-) +does not require any external programs, and makes it easy to redefine how each +and every markdown element is rendered. Creative abuse of the markdown +syntax is encouraged. ;-) [markdown]: https://daringfireball.net/projects/markdown/basics/ (Daring Fireball: Markdown Basics) @@ -569,11 +570,11 @@ documentation][techdoc]. % \fi % \begin{macrocode} local metadata = { - version = "2.8.1", + version = "2.8.2", 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-2019 Vít Novotný"}, + "2016-2020 Vít Novotný"}, license = "LPPL 1.3" } @@ -5659,8 +5660,8 @@ pdftex --shell-escape document.tex % % \end{markdown} % \begin{macrocode} -\def\markdownLastModified{2019/04/30}% -\def\markdownVersion{2.8.1}% +\def\markdownLastModified{2020/03/20}% +\def\markdownVersion{2.8.2}% % \end{macrocode} % \par % \begin{markdown} @@ -5796,7 +5797,7 @@ interfaces. % of the document being typeset. % % The expansion of this macro must not contain quotation marks (`"`) or -% backslash symbols (`extbackslash`). Mind that \TeX{} engines tend to +% backslash symbols (`\`). Mind that \TeX{} engines tend to % put quotation marks around \m{jobname}, when it contains spaces. % % \end{markdown} @@ -6939,6 +6940,8 @@ following content: \catcode`\^^A=14 \global\def\markdownRendererImage#1#2#3#4{^^A \immediate\write18{^^A +``` +``` sh if printf '%s' "#3" | grep -q ^http; then OUTPUT="$(printf '%s' "#3" | md5sum | cut -d' ' -f1).^^A $(printf '%s' "#3" | sed 's/.*[.]//')"; @@ -6950,6 +6953,8 @@ following content: else printf '%s%%' "#3" > \jobname.fetched; fi^^A +``` +``` tex }^^A {^^A \everyeof={\noexpand}^^A @@ -13701,6 +13706,7 @@ function M.writer.new(options) % \begin{macrocode} function self.verbatim(s) if not self.is_writing then return "" end + s = string.gsub(s, '[\r\n%s]*$', '') local name = util.cache(options.cacheDir, s, nil, nil, ".verbatim") return {"\\markdownRendererInputVerbatim{",name,"}"} end @@ -13716,6 +13722,7 @@ function M.writer.new(options) % \begin{macrocode} function self.fencedCode(i, s) if not self.is_writing then return "" end + s = string.gsub(s, '[\r\n%s]*$', '') local name = util.cache(options.cacheDir, s, nil, nil, ".verbatim") return {"\\markdownRendererInputFencedCode{",name,"}{",i,"}"} end @@ -14978,7 +14985,8 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline % % \end{markdown} % \begin{macrocode} - larsers.Str = parsers.normalchar^1 / writer.string + larsers.Str = (parsers.normalchar * (parsers.normalchar + parsers.at)^0) + / writer.string larsers.Symbol = (parsers.specialchar - parsers.tightblocksep) / writer.string @@ -15650,7 +15658,14 @@ if metadata.version ~= md.metadata.version then "markdown.lua " .. md.metadata.version .. ".") end local convert = md.new(options) -local output = convert(input:gsub("\r\n?", "\n")) +% \end{macrocode} +% \begin{markdown} +% Since the Lua converter expects \acro{unix} line endings, normalize the +% input. Also add a line ending at the end of the file in case the input file +% has none. +% \end{markdown} +% \begin{macrocode} +local output = convert(input:gsub("\r\n?", "\n") .. "\n") if output_filename then local output_file = io.open(output_filename, "w") @@ -16016,7 +16031,10 @@ local convert = md.new(\markdownLuaOptions) |markdownInfo{The ending token sequence was found}@ |immediate|closeout|markdownOutputFileStream@ |endgroup@ - |markdownInput|markdownOptionInputTempFileName@ + |markdownInput{@ + |markdownOptionOutputDir@ + /|markdownOptionInputTempFileName@ + }@ #2}@ |fi@ % \end{macrocode} @@ -16285,16 +16303,15 @@ local convert = md.new(\markdownLuaOptions) |closein|markdownInputFileStream |markdownLuaExecute{% |markdownPrepare - local input = assert(io.open("% - |markdownOptionOutputDir - /#1", "r"):read("*a")) + local input = assert(io.open("#1", "r"):read("*a")) % \end{macrocode} % \begin{markdown} % Since the Lua converter expects \acro{unix} line endings, normalize the -% input. +% input. Also add a line ending at the end of the file in case the input file +% has none. % \end{markdown} % \begin{macrocode} - print(convert(input:gsub("\r\n?", "\n")))}}% + print(convert(input:gsub("\r\n?", "\n") .. "\n"))}}% |endgroup % \end{macrocode} % \iffalse |