From f78056943ffe36621ca1cf595657f324cda9b13f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 5 Jan 2017 22:56:40 +0000 Subject: markdown (5jan17) git-svn-id: svn://tug.org/texlive/trunk@42868 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/generic/markdown/markdown.tex | 137 ++++++++------------- 1 file changed, 54 insertions(+), 83 deletions(-) (limited to 'Master/texmf-dist/tex/generic') diff --git a/Master/texmf-dist/tex/generic/markdown/markdown.tex b/Master/texmf-dist/tex/generic/markdown/markdown.tex index c98168c110a..8de36017864 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{2016/12/09}% -\def\markdownVersion{2.2.2}% +\def\markdownLastModified{2017/01/05}% +\def\markdownVersion{2.3.0}% \let\markdownBegin\relax \let\markdownEnd\relax \let\markdownInput\relax @@ -57,12 +57,14 @@ \let\markdownOptionBlankBeforeBlockquote\undefined \let\markdownOptionBlankBeforeCodeFence\undefined \let\markdownOptionBlankBeforeHeading\undefined +\let\markdownOptionBreakableBlockquotes\undefined \let\markdownOptionCitations\undefined \let\markdownOptionCitationNbsps\undefined \let\markdownOptionDefinitionLists\undefined \let\markdownOptionFootnotes\undefined \let\markdownOptionFencedCode\undefined \let\markdownOptionHashEnumerators\undefined +\let\markdownOptionHtml\undefined \let\markdownOptionHybrid\undefined \let\markdownOptionInlineFootnotes\undefined \let\markdownOptionPreserveTabs\undefined @@ -237,11 +239,6 @@ \def\markdownInfo#1{}% \def\markdownWarning#1{}% \def\markdownError#1{}% -\def\markdownLuaRegisterIBCallback#1{% - local old_callback = callback.find("process_input_buffer") - callback.register("process_input_buffer", #1)}% -\def\markdownLuaUnregisterIBCallback{% - callback.register("process_input_buffer", old_callback)}% \let\markdownMakeOther\relax \let\markdownReadAndConvert\relax \begingroup @@ -257,6 +254,8 @@ \def\markdownMode{2}% \fi \fi +\def\markdownLuaRegisterIBCallback#1{\relax}% +\def\markdownLuaUnregisterIBCallback#1{\relax}% \def\markdownInfo#1{% \message{(l.\the\inputlineno) markdown.tex info: #1.}}% \def\markdownWarning#1{% @@ -304,7 +303,7 @@ \def\markdownRendererDlEndPrototype{}% \def\markdownRendererDlEndTightPrototype{}% \def\markdownRendererEmphasisPrototype#1{{\it#1}}% -\def\markdownRendererStrongEmphasisPrototype#1{{\it#1}}% +\def\markdownRendererStrongEmphasisPrototype#1{{\bf#1}}% \def\markdownRendererBlockQuoteBeginPrototype{\par\begingroup\it}% \def\markdownRendererBlockQuoteEndPrototype{\endgroup\par}% \def\markdownRendererInputVerbatimPrototype#1{% @@ -331,6 +330,9 @@ \ifx\markdownOptionBlankBeforeHeading\undefined\else blankBeforeHeading = \markdownOptionBlankBeforeHeading, \fi +\ifx\markdownOptionBreakableBlockquotes\undefined\else + breakableBlockquotes = \markdownOptionBreakableBlockquotes, +\fi \ifx\markdownOptionCacheDir\undefined\else cacheDir = "\markdownOptionCacheDir", \fi @@ -352,6 +354,9 @@ \ifx\markdownOptionHashEnumerators\undefined\else hashEnumerators = \markdownOptionHashEnumerators, \fi +\ifx\markdownOptionHtml\undefined\else + html = \markdownOptionHtml, +\fi \ifx\markdownOptionHybrid\undefined\else hybrid = \markdownOptionHybrid, \fi @@ -380,14 +385,53 @@ end local md = require("markdown") local convert = md.new(\markdownLuaOptions) }% - +\csname newwrite\endcsname\markdownLuaExecuteFileStream +\begingroup + \catcode`\^^I=12% + \gdef\markdownReadAndConvertTab{^^I}% +\endgroup +\begingroup + \catcode`\^^M=13% + \catcode`\^^I=13% + \catcode`|=0% + \catcode`\\=12% + |gdef|markdownReadAndConvert#1#2{% + |begingroup% + |immediate|openout|markdownLuaExecuteFileStream% + |markdownOptionInputTempFileName% + |markdownInfo{Buffering markdown input into the temporary % + input file "|markdownOptionInputTempFileName" and scanning % + for the closing token sequence "#1"}% + |def|do##1{|catcode`##1=12}|dospecials% + |catcode`| =12% + |markdownMakeOther% + |def|markdownReadAndConvertProcessLine##1#1##2#1##3|relax{% + |ifx|relax##3|relax% + |immediate|write|markdownLuaExecuteFileStream{##1}% + |else% + |def^^M{% + |markdownInfo{The ending token sequence was found}% + |immediate|closeout|markdownLuaExecuteFileStream% + |endgroup% + |markdownInput|markdownOptionInputTempFileName% + #2}% + |fi% + ^^M}% + |catcode`|^^I=13% + |def^^I{|markdownReadAndConvertTab}% + |catcode`|^^M=13% + |def^^M##1^^M{% + |def^^M####1^^M{% + |markdownReadAndConvertProcessLine####1#1#1|relax}% + ^^M}% + ^^M}% +|endgroup \ifnum\markdownMode<2\relax \ifnum\markdownMode=0\relax \markdownInfo{Using mode 0: Shell escape via write18}% \else \markdownInfo{Using mode 1: Shell escape via os.execute}% \fi -\csname newwrite\endcsname\markdownLuaExecuteFileStream \ifx\pdfshellescape\undefined \ifx\shellescape\undefined \ifnum\markdownMode=0\relax @@ -431,82 +475,9 @@ local convert = md.new(\markdownLuaOptions) \markdownExecute{texlua "\markdownOptionHelperScriptFileName" > "\markdownOptionOutputTempFileName"}% \input\markdownOptionOutputTempFileName\relax}% -\begingroup - \catcode`\^^I=12% - \gdef\markdownReadAndConvertTab{^^I}% -\endgroup -\begingroup - \catcode`\^^M=13% - \catcode`\^^I=13% - \catcode`|=0% - \catcode`\\=12% - |gdef|markdownReadAndConvert#1#2{% - |begingroup% - |immediate|openout|markdownLuaExecuteFileStream% - |markdownOptionInputTempFileName% - |markdownInfo{Buffering markdown input into the temporary % - input file "|markdownOptionInputTempFileName" and scanning % - for the closing token sequence "#1"}% - |def|do##1{|catcode`##1=12}|dospecials% - |catcode`| =12% - |markdownMakeOther% - |def|markdownReadAndConvertProcessLine##1#1##2#1##3|relax{% - |ifx|relax##3|relax% - |immediate|write|markdownLuaExecuteFileStream{##1}% - |else% - |def^^M{% - |markdownInfo{The ending token sequence was found}% - |immediate|closeout|markdownLuaExecuteFileStream% - |endgroup% - |markdownInput|markdownOptionInputTempFileName% - #2}% - |fi% - ^^M}% - |catcode`|^^I=13% - |def^^I{|markdownReadAndConvertTab}% - |catcode`|^^M=13% - |def^^M##1^^M{% - |def^^M####1^^M{% - |markdownReadAndConvertProcessLine####1#1#1|relax}% - ^^M}% - ^^M}% -|endgroup \else \markdownInfo{Using mode 2: Direct Lua access}% \def\markdownLuaExecute#1{\directlua{local print = tex.print #1}}% -\begingroup - \catcode`\_=12% - \catcode`\$=12% - \catcode`\^=12% - \catcode`\/=6% - \catcode`\#=12% - \catcode`\@=14% - \catcode`\%=12% - \catcode`|=0@ - \catcode`\\=12@ - |gdef|markdownReadAndConvert/1/2{@ - |def|markdownReadAndConvertAfter{/2}@ - |markdownInfo{Buffering markdown input and scanning for the - closing token sequence "/1"}@ - |directlua{@ - |markdownPrepare - local buffer = {} - local ending_sequence = "^.-" .. ([[/1]]):gsub( - "([%(%)%.%%%+%-%*%?%[%]%^%$])", "%%%1") - |markdownLuaRegisterIBCallback{function(line) - if line:match(ending_sequence) then - |markdownLuaUnregisterIBCallback; - local input = table.concat(buffer, "\n") .. "\n" - local output = convert(input) - return [[\markdownInfo{The ending token sequence was found}]] .. - output .. [[\markdownReadAndConvertAfter]] - else - buffer[#buffer+1] = line - return [[\]] .. (#buffer == 1 and "fi" or "relax") - end - end}}@ - |iffalse}@ - |endgroup \fi \begingroup \catcode`|=0% -- cgit v1.2.3