From c8cd8edf4451d006d810c0a699f9c6f746d06b66 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 10 Apr 2017 21:55:22 +0000 Subject: markdown (10apr17) git-svn-id: svn://tug.org/texlive/trunk@43737 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/doc/generic/markdown/markdown.pdf | Bin 344434 -> 346182 bytes .../source/generic/markdown/markdown.dtx | 220 +++++++++++++-------- .../texmf-dist/tex/generic/markdown/markdown.tex | 10 +- Master/texmf-dist/tex/latex/markdown/markdown.sty | 8 +- Master/texmf-dist/tex/luatex/markdown/markdown.lua | 70 ++++--- 5 files changed, 197 insertions(+), 111 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/generic/markdown/markdown.pdf b/Master/texmf-dist/doc/generic/markdown/markdown.pdf index f367cb65a8b..761ee61b522 100644 Binary files a/Master/texmf-dist/doc/generic/markdown/markdown.pdf and b/Master/texmf-dist/doc/generic/markdown/markdown.pdf differ diff --git a/Master/texmf-dist/source/generic/markdown/markdown.dtx b/Master/texmf-dist/source/generic/markdown/markdown.dtx index 320bc0bf8b3..b8518cd69d5 100644 --- a/Master/texmf-dist/source/generic/markdown/markdown.dtx +++ b/Master/texmf-dist/source/generic/markdown/markdown.dtx @@ -156,7 +156,7 @@ % \fi % \begin{macrocode} local metadata = { - version = "2.4.0", + version = "2.5.0", 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; " .. @@ -459,6 +459,24 @@ defaultOptions.citationNbsps = true defaultOptions.citations = false % \end{macrocode} % +% \Optitem[true]{codeSpans}{\opt{true}, \opt{false}} +% \begin{valuelist} +% \item[true] Enable the code span syntax: +% \begin{Verbatim} +% Use the `printf()` function. +% ``There is a literal backtick (`) here.`` +% \end{Verbatim} +% \item[false] Disable the code span syntax. This allows you to easily +% use the quotation mark ligatures in texts that do not contain code +% spans: +% \begin{Verbatim} +% ``This is a quote.'' +% \end{Verbatim} +% \end{valuelist} +% \begin{macrocode} +defaultOptions.codeSpans = true +% \end{macrocode} +% % \Optitem[false]{contentBlocks}{\opt{true}, \opt{false}} % \begin{valuelist} % \item[true] Enable the iA\,Writer content blocks syntax @@ -506,57 +524,6 @@ defaultOptions.contentBlocksLanguageMap = "markdown-languages.json" % \begin{macrocode} defaultOptions.definitionLists = false % \end{macrocode} -% -% \Optitem[false]{hashEnumerators}{\opt{true}, \opt{false}} -% \begin{valuelist} -% \item[true] Enable the use of hash symbols (\t`\#`) as ordered item -% list markers: -% \begin{Verbatim} -% #. Bird -% #. McHale -% #. Parish -% \end{Verbatim} -% \item[false] Disable the use of hash symbols (\t`\#`) as ordered item -% list markers. -% \end{valuelist} -% \begin{macrocode} -defaultOptions.hashEnumerators = false -% \end{macrocode} -% -% \Optitem[false]{html}{\opt{true}, \opt{false}} -% \begin{valuelist} -% \item[true] Enable the recognition of \textsc{html} tags, block -% elements, comments, \textsc{html} instructions, and -% entities in the input. Tags, block elements (along with -% contents), \textsc{html} instructions, and comments will -% be ignored and \textsc{html} entities will be replaced -% with the corresponding Unicode codepoints. -% -% \item[false] Disable the recognition of \textsc{html} markup. Any -% \textsc{html} markup in the input will be rendered as -% plain text. -% \end{valuelist} -% \begin{macrocode} -defaultOptions.html = false -% \end{macrocode} -% -% \Optitem[false]{hybrid}{\opt{true}, \opt{false}} -% \begin{valuelist} -% \item[true] Disable the escaping of special plain \TeX{} characters, -% which makes it possible to intersperse your markdown markup with -% \TeX{} code. The intended usage is in documents prepared manually by -% a human author. In such documents, it can often be desirable to mix -% \TeX{} and markdown markup freely. -% -% \item[false] Enable the escaping of special plain \TeX{} characters -% outside verbatim environments, so that they are not interpretted by -% \TeX{}. This is encouraged when typesetting automatically generated -% content or markdown documents that were not prepared with this -% package in mind. -% \end{valuelist} -% \begin{macrocode} -defaultOptions.hybrid = false -% \end{macrocode} % % \Optitem[false]{fencedCode}{\opt{true}, \opt{false}} % \begin{valuelist} @@ -612,6 +579,57 @@ defaultOptions.fencedCode = false % \begin{macrocode} defaultOptions.footnotes = false % \end{macrocode} +% +% \Optitem[false]{hashEnumerators}{\opt{true}, \opt{false}} +% \begin{valuelist} +% \item[true] Enable the use of hash symbols (\t`\#`) as ordered item +% list markers: +% \begin{Verbatim} +% #. Bird +% #. McHale +% #. Parish +% \end{Verbatim} +% \item[false] Disable the use of hash symbols (\t`\#`) as ordered item +% list markers. +% \end{valuelist} +% \begin{macrocode} +defaultOptions.hashEnumerators = false +% \end{macrocode} +% +% \Optitem[false]{html}{\opt{true}, \opt{false}} +% \begin{valuelist} +% \item[true] Enable the recognition of \textsc{html} tags, block +% elements, comments, \textsc{html} instructions, and +% entities in the input. Tags, block elements (along with +% contents), \textsc{html} instructions, and comments will +% be ignored and \textsc{html} entities will be replaced +% with the corresponding Unicode codepoints. +% +% \item[false] Disable the recognition of \textsc{html} markup. Any +% \textsc{html} markup in the input will be rendered as +% plain text. +% \end{valuelist} +% \begin{macrocode} +defaultOptions.html = false +% \end{macrocode} +% +% \Optitem[false]{hybrid}{\opt{true}, \opt{false}} +% \begin{valuelist} +% \item[true] Disable the escaping of special plain \TeX{} characters, +% which makes it possible to intersperse your markdown markup with +% \TeX{} code. The intended usage is in documents prepared manually by +% a human author. In such documents, it can often be desirable to mix +% \TeX{} and markdown markup freely. +% +% \item[false] Enable the escaping of special plain \TeX{} characters +% outside verbatim environments, so that they are not interpretted by +% \TeX{}. This is encouraged when typesetting automatically generated +% content or markdown documents that were not prepared with this +% package in mind. +% \end{valuelist} +% \begin{macrocode} +defaultOptions.hybrid = false +% \end{macrocode} % % \Optitem[false]{inlineFootnotes}{\opt{true}, \opt{false}} % \begin{valuelist} @@ -672,6 +690,24 @@ defaultOptions.startNumber = true % \begin{macrocode} defaultOptions.tightLists = true % \end{macrocode} +% +% \Optitem[true]{underscores}{\opt{true}, \opt{false}} +% \begin{valuelist} +% \item[true] Both underscores and asterisks can be used to denote +% emphasis and strong emphasis: +% \begin{Verbatim} +% *single asterisks* +% _single underscores_ +% **double asterisks** +% __double underscores__ +% \end{Verbatim} +% \item[false] Only asterisks can be used to denote emphasis and strong +% emphasis. This makes it easy to write math with the \t`hybrid` option +% without the need to constantly escape subscripts. +% \end{valuelist} +% \begin{macrocode} +defaultOptions.underscores = true +% \end{macrocode} % \end{optionlist} % % \iffalse @@ -683,8 +719,8 @@ defaultOptions.tightLists = 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/03/27}% -\def\markdownVersion{2.4.0}% +\def\markdownLastModified{2017/04/10}% +\def\markdownVersion{2.5.0}% % \end{macrocode} % % The plain \TeX{} interface is implemented by the \t`markdown.tex` file that @@ -1573,14 +1609,16 @@ defaultOptions.tightLists = true \def\markdownOptionBlankBeforeHeading{#1}}% \define@key{markdownOptions}{breakableBlockquotes}[true]{% \def\markdownOptionBreakableBlockquotes{#1}}% +\define@key{markdownOptions}{cacheDir}{% + \def\markdownOptionCacheDir{#1}}% \define@key{markdownOptions}{citations}[true]{% \def\markdownOptionCitations{#1}}% \define@key{markdownOptions}{citationNbsps}[true]{% \def\markdownOptionCitationNbsps{#1}}% -\define@key{markdownOptions}{cacheDir}{% - \def\markdownOptionCacheDir{#1}}% \define@key{markdownOptions}{contentBlocks}[true]{% \def\markdownOptionContentBlocks{#1}}% +\define@key{markdownOptions}{codeSpans}[true]{% + \def\markdownOptionCodeSpans{#1}}% \define@key{markdownOptions}{contentBlocksLanguageMap}{% \def\markdownOptionContentBlocksLanguageMap{#1}}% \define@key{markdownOptions}{definitionLists}[true]{% @@ -1605,6 +1643,8 @@ defaultOptions.tightLists = true \def\markdownOptionStartNumber{#1}}% \define@key{markdownOptions}{tightLists}[true]{% \def\markdownOptionTightLists{#1}}% +\define@key{markdownOptions}{underscores}[true]{% + \def\markdownOptionUnderscores{#1}}% % \end{macrocode} % % The following example \LaTeX{} code showcases a possible configuration of @@ -3830,17 +3870,27 @@ function M.reader.new(writer, options) + parsers.spacechar^1 * larsers.Endline^-1 * parsers.optionalspace / writer.nbsp - larsers.Strong = ( parsers.between(parsers.Inline, parsers.doubleasterisks, - parsers.doubleasterisks) - + parsers.between(parsers.Inline, parsers.doubleunderscores, - parsers.doubleunderscores) - ) / writer.strong + if options.underscores then + larsers.Strong = ( parsers.between(parsers.Inline, parsers.doubleasterisks, + parsers.doubleasterisks) + + parsers.between(parsers.Inline, parsers.doubleunderscores, + parsers.doubleunderscores) + ) / writer.strong + + larsers.Emph = ( parsers.between(parsers.Inline, parsers.asterisk, + parsers.asterisk) + + parsers.between(parsers.Inline, parsers.underscore, + parsers.underscore) + ) / writer.emphasis + else + larsers.Strong = ( parsers.between(parsers.Inline, parsers.doubleasterisks, + parsers.doubleasterisks) + ) / writer.strong - larsers.Emph = ( parsers.between(parsers.Inline, parsers.asterisk, - parsers.asterisk) - + parsers.between(parsers.Inline, parsers.underscore, - parsers.underscore) - ) / writer.emphasis + larsers.Emph = ( parsers.between(parsers.Inline, parsers.asterisk, + parsers.asterisk) + ) / writer.emphasis + end larsers.AutoLinkUrl = parsers.less * C(parsers.alphanumeric^1 * P("://") * parsers.urlchar^1) @@ -4156,14 +4206,6 @@ function M.reader.new(writer, options) Symbol = larsers.Symbol, } - if not options.definitionLists then - syntax.DefinitionList = parsers.fail - end - - if not options.fencedCode then - syntax.FencedCode = parsers.fail - end - if not options.citations then syntax.Citations = parsers.fail end @@ -4172,16 +4214,20 @@ function M.reader.new(writer, options) syntax.ContentBlock = parsers.fail end - if not options.footnotes then - syntax.NoteRef = parsers.fail + if not options.codeSpans then + syntax.Code = parsers.fail end - if not options.inlineFootnotes then - syntax.InlineNote = parsers.fail + if not options.definitionLists then + syntax.DefinitionList = parsers.fail end - if not options.smartEllipses then - syntax.Smart = parsers.fail + if not options.fencedCode then + syntax.FencedCode = parsers.fail + end + + if not options.footnotes then + syntax.NoteRef = parsers.fail end if not options.html then @@ -4190,6 +4236,14 @@ function M.reader.new(writer, options) syntax.HtmlEntity = parsers.fail end + if not options.inlineFootnotes then + syntax.InlineNote = parsers.fail + end + + if not options.smartEllipses then + syntax.Smart = parsers.fail + end + local blocks_toplevel_t = util.table_copy(syntax) blocks_toplevel_t.Paragraph = larsers.ToplevelParagraph larsers.blocks_toplevel = Ct(blocks_toplevel_t) @@ -4379,6 +4433,9 @@ return M \ifx\markdownOptionCitationNbsps\undefined\else citationNbsps = \markdownOptionCitationNbsps, \fi +\ifx\markdownOptionCodeSpans\undefined\else + codeSpans = \markdownOptionCodeSpans, +\fi \ifx\markdownOptionContentBlocks\undefined\else contentBlocks = \markdownOptionContentBlocks, \fi @@ -4418,6 +4475,9 @@ return M \fi \ifx\markdownOptionTightLists\undefined\else tightLists = \markdownOptionTightLists, +\fi +\ifx\markdownOptionUnderscores\undefined\else + underscores = \markdownOptionUnderscores, \fi} }% % \end{macrocode} diff --git a/Master/texmf-dist/tex/generic/markdown/markdown.tex b/Master/texmf-dist/tex/generic/markdown/markdown.tex index 6bc0a916571..9f765083498 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/03/27}% -\def\markdownVersion{2.4.0}% +\def\markdownLastModified{2017/04/10}% +\def\markdownVersion{2.5.0}% \let\markdownBegin\relax \let\markdownEnd\relax \let\markdownInput\relax @@ -359,6 +359,9 @@ \ifx\markdownOptionCitationNbsps\undefined\else citationNbsps = \markdownOptionCitationNbsps, \fi +\ifx\markdownOptionCodeSpans\undefined\else + codeSpans = \markdownOptionCodeSpans, +\fi \ifx\markdownOptionContentBlocks\undefined\else contentBlocks = \markdownOptionContentBlocks, \fi @@ -398,6 +401,9 @@ \fi \ifx\markdownOptionTightLists\undefined\else tightLists = \markdownOptionTightLists, +\fi +\ifx\markdownOptionUnderscores\undefined\else + underscores = \markdownOptionUnderscores, \fi} }% \def\markdownPrepare{% diff --git a/Master/texmf-dist/tex/latex/markdown/markdown.sty b/Master/texmf-dist/tex/latex/markdown/markdown.sty index 229d810b920..80ba474bdbf 100644 --- a/Master/texmf-dist/tex/latex/markdown/markdown.sty +++ b/Master/texmf-dist/tex/latex/markdown/markdown.sty @@ -65,14 +65,16 @@ \def\markdownOptionBlankBeforeHeading{#1}}% \define@key{markdownOptions}{breakableBlockquotes}[true]{% \def\markdownOptionBreakableBlockquotes{#1}}% +\define@key{markdownOptions}{cacheDir}{% + \def\markdownOptionCacheDir{#1}}% \define@key{markdownOptions}{citations}[true]{% \def\markdownOptionCitations{#1}}% \define@key{markdownOptions}{citationNbsps}[true]{% \def\markdownOptionCitationNbsps{#1}}% -\define@key{markdownOptions}{cacheDir}{% - \def\markdownOptionCacheDir{#1}}% \define@key{markdownOptions}{contentBlocks}[true]{% \def\markdownOptionContentBlocks{#1}}% +\define@key{markdownOptions}{codeSpans}[true]{% + \def\markdownOptionCodeSpans{#1}}% \define@key{markdownOptions}{contentBlocksLanguageMap}{% \def\markdownOptionContentBlocksLanguageMap{#1}}% \define@key{markdownOptions}{definitionLists}[true]{% @@ -97,6 +99,8 @@ \def\markdownOptionStartNumber{#1}}% \define@key{markdownOptions}{tightLists}[true]{% \def\markdownOptionTightLists{#1}}% +\define@key{markdownOptions}{underscores}[true]{% + \def\markdownOptionUnderscores{#1}}% \define@key{markdownRenderers}{interblockSeparator}{% \renewcommand\markdownRendererInterblockSeparator{#1}}% \define@key{markdownRenderers}{lineBreak}{% diff --git a/Master/texmf-dist/tex/luatex/markdown/markdown.lua b/Master/texmf-dist/tex/luatex/markdown/markdown.lua index de9895c8c27..39668713584 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.4.0", + version = "2.5.0", 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; " .. @@ -79,19 +79,21 @@ defaultOptions.breakableBlockquotes = false defaultOptions.cacheDir = "." defaultOptions.citationNbsps = true defaultOptions.citations = false +defaultOptions.codeSpans = true defaultOptions.contentBlocks = false defaultOptions.contentBlocksLanguageMap = "markdown-languages.json" defaultOptions.definitionLists = false +defaultOptions.fencedCode = false +defaultOptions.footnotes = false defaultOptions.hashEnumerators = false defaultOptions.html = false defaultOptions.hybrid = false -defaultOptions.fencedCode = false -defaultOptions.footnotes = false defaultOptions.inlineFootnotes = false defaultOptions.preserveTabs = false defaultOptions.smartEllipses = false defaultOptions.startNumber = true defaultOptions.tightLists = true +defaultOptions.underscores = true local upper, gsub, format, length = string.upper, string.gsub, string.format, string.len local concat = table.concat @@ -1495,17 +1497,27 @@ function M.reader.new(writer, options) + parsers.spacechar^1 * larsers.Endline^-1 * parsers.optionalspace / writer.nbsp - larsers.Strong = ( parsers.between(parsers.Inline, parsers.doubleasterisks, - parsers.doubleasterisks) - + parsers.between(parsers.Inline, parsers.doubleunderscores, - parsers.doubleunderscores) - ) / writer.strong + if options.underscores then + larsers.Strong = ( parsers.between(parsers.Inline, parsers.doubleasterisks, + parsers.doubleasterisks) + + parsers.between(parsers.Inline, parsers.doubleunderscores, + parsers.doubleunderscores) + ) / writer.strong + + larsers.Emph = ( parsers.between(parsers.Inline, parsers.asterisk, + parsers.asterisk) + + parsers.between(parsers.Inline, parsers.underscore, + parsers.underscore) + ) / writer.emphasis + else + larsers.Strong = ( parsers.between(parsers.Inline, parsers.doubleasterisks, + parsers.doubleasterisks) + ) / writer.strong - larsers.Emph = ( parsers.between(parsers.Inline, parsers.asterisk, - parsers.asterisk) - + parsers.between(parsers.Inline, parsers.underscore, - parsers.underscore) - ) / writer.emphasis + larsers.Emph = ( parsers.between(parsers.Inline, parsers.asterisk, + parsers.asterisk) + ) / writer.emphasis + end larsers.AutoLinkUrl = parsers.less * C(parsers.alphanumeric^1 * P("://") * parsers.urlchar^1) @@ -1806,14 +1818,6 @@ function M.reader.new(writer, options) Symbol = larsers.Symbol, } - if not options.definitionLists then - syntax.DefinitionList = parsers.fail - end - - if not options.fencedCode then - syntax.FencedCode = parsers.fail - end - if not options.citations then syntax.Citations = parsers.fail end @@ -1822,16 +1826,20 @@ function M.reader.new(writer, options) syntax.ContentBlock = parsers.fail end - if not options.footnotes then - syntax.NoteRef = parsers.fail + if not options.codeSpans then + syntax.Code = parsers.fail end - if not options.inlineFootnotes then - syntax.InlineNote = parsers.fail + if not options.definitionLists then + syntax.DefinitionList = parsers.fail end - if not options.smartEllipses then - syntax.Smart = parsers.fail + if not options.fencedCode then + syntax.FencedCode = parsers.fail + end + + if not options.footnotes then + syntax.NoteRef = parsers.fail end if not options.html then @@ -1840,6 +1848,14 @@ function M.reader.new(writer, options) syntax.HtmlEntity = parsers.fail end + if not options.inlineFootnotes then + syntax.InlineNote = parsers.fail + end + + if not options.smartEllipses then + syntax.Smart = parsers.fail + end + local blocks_toplevel_t = util.table_copy(syntax) blocks_toplevel_t.Paragraph = larsers.ToplevelParagraph larsers.blocks_toplevel = Ct(blocks_toplevel_t) -- cgit v1.2.3