diff options
author | Karl Berry <karl@freefriends.org> | 2022-10-31 19:44:45 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-10-31 19:44:45 +0000 |
commit | b85211b0d457e8ea4625ba00efe5133ba6f42350 (patch) | |
tree | 5fe5a427c680f122e0292cfd107fbdea47125f90 /Master/texmf-dist/tex/latex/markdown | |
parent | 32a5e5c9e3c474a4be7e4ea8ab3101d0d6f208fe (diff) |
markdown (31oct22)
git-svn-id: svn://tug.org/texlive/trunk@64879 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/markdown')
-rw-r--r-- | Master/texmf-dist/tex/latex/markdown/markdown.sty | 198 |
1 files changed, 134 insertions, 64 deletions
diff --git a/Master/texmf-dist/tex/latex/markdown/markdown.sty b/Master/texmf-dist/tex/latex/markdown/markdown.sty index 1a2a989fe82..47bdd40a0df 100644 --- a/Master/texmf-dist/tex/latex/markdown/markdown.sty +++ b/Master/texmf-dist/tex/latex/markdown/markdown.sty @@ -81,7 +81,7 @@ \prop_new:N \g__markdown_latex_option_types_prop \prop_new:N \g__markdown_default_latex_options_prop \tl_const:Nn \c__markdown_option_layer_latex_tl { latex } -\seq_put_right:NV \g__markdown_option_layers_seq \c__markdown_option_layer_latex_tl +\seq_gput_right:NV \g__markdown_option_layers_seq \c__markdown_option_layer_latex_tl \cs_new:Nn \__markdown_add_latex_option:nnn { @@ -173,13 +173,18 @@ \seq_map_inline:cn { g__markdown_ ##1 _options_seq } { - \__markdown_latex_define_option_keyval:nn - { ##1 } + \__markdown_with_various_cases:nn { ####1 } + { + \__markdown_latex_define_option_keyval:nnn + { ##1 } + { ####1 } + { ########1 } + } } } } -\cs_new:Nn \__markdown_latex_define_option_keyval:nn +\cs_new:Nn \__markdown_latex_define_option_keyval:nnn { \prop_get:cnN { g__markdown_ #1 _option_types_prop } @@ -188,7 +193,7 @@ \keys_define:nn { markdown/latex-options } { - #2 .code:n = { + #3 .code:n = { \__markdown_set_option_value:nn { #2 } { ##1 } @@ -201,7 +206,7 @@ \keys_define:nn { markdown/latex-options } { - #2 .default:n = { true }, + #3 .default:n = { true }, } } \str_if_eq:VVT @@ -210,7 +215,7 @@ { \tl_set:Nn \l_tmpa_tl - { #2 } + { #3 } \tl_reverse:N \l_tmpa_tl \str_if_eq:enF @@ -223,7 +228,7 @@ \msg_error:nnn { __markdown } { malformed-name-for-clist-option } - { #2 } + { #3 } } \tl_set:Nx \l_tmpa_tl @@ -312,16 +317,20 @@ } \cs_new:Nn \__markdown_latex_define_renderer:nNn { - \keys_define:nn - { markdown/latex-options/renderers } + \__markdown_with_various_cases:nn + { #1 } { - #1 .code:n = { - \cs_generate_from_arg_count:NNnn - #2 - \cs_set:Npn - { #3 } - { ##1 } - }, + \keys_define:nn + { markdown/latex-options/renderers } + { + ##1 .code:n = { + \cs_generate_from_arg_count:NNnn + #2 + \cs_set:Npn + { #3 } + { ####1 } + }, + } } } \cs_generate_variant:Nn @@ -351,16 +360,20 @@ } \cs_new:Nn \__markdown_latex_define_renderer_prototype:nNn { - \keys_define:nn - { markdown/latex-options/renderer-prototypes } + \__markdown_with_various_cases:nn + { #1 } { - #1 .code:n = { - \cs_generate_from_arg_count:NNnn - #2 - \cs_set:Npn - { #3 } - { ##1 } - }, + \keys_define:nn + { markdown/latex-options/renderer-prototypes } + { + ##1 .code:n = { + \cs_generate_from_arg_count:NNnn + #2 + \cs_set:Npn + { #3 } + { ####1 } + }, + } } } \cs_generate_variant:Nn @@ -397,13 +410,13 @@ \ExplSyntaxOn \newcommand\markdownLaTeXThemeName{} \seq_new:N \g__markdown_latex_themes_seq -\seq_put_right:NV +\seq_gput_right:NV \g__markdown_latex_themes_seq \markdownLaTeXThemeName \newcommand\markdownLaTeXThemeLoad[2]{ \def\@tempa{% \def\markdownLaTeXThemeName{#2} - \seq_put_right:NV + \seq_gput_right:NV \g__markdown_latex_themes_seq \markdownLaTeXThemeName \RequirePackage{#1} @@ -437,17 +450,44 @@ { markdown/latex-options/renderers } { #1 } }, - rendererPrototypes .code:n = { - \keys_set:nn - { markdown/latex-options/renderer-prototypes } - { #1 } - }, + } +\__markdown_with_various_cases:nn + { rendererPrototypes } + { + \keys_define:nn + { markdown/latex-options } + { + #1 .code:n = { + \keys_set:nn + { markdown/latex-options/renderer-prototypes } + { ##1 } + }, + } + } +\keys_define:nn + { markdown/latex-options } + { code .code:n = { #1 }, - jekyllDataRenderers .code:n = { - \keys_set:nn - { markdown/latex-options/jekyll-data-renderers } - { #1 } - }, + } +\__markdown_with_various_cases:nn + { jekyllDataRenderers } + { + \keys_define:nn + { markdown/latex-options } + { + #1 .code:n = { + \tl_set:Nn + \l_tmpa_tl + { ##1 } + \tl_replace_all:NnV + \l_tmpa_tl + { / } + \c_backslash_str + \keys_set:nV + { markdown/latex-options/jekyll-data-renderers } + \l_tmpa_tl + }, + } } \keys_define:nn { markdown/latex-options/jekyll-data-renderers } @@ -456,6 +496,10 @@ \tl_set_eq:NN \l_tmpa_tl \l_keys_key_str + \tl_replace_all:NVn + \l_tmpa_tl + \c_backslash_str + { / } \tl_put_right:Nn \l_tmpa_tl { @@ -469,6 +513,12 @@ \cs_generate_variant:Nn \keys_define:nn { nV } +\cs_generate_variant:Nn + \tl_replace_all:Nnn + { NVn } +\cs_generate_variant:Nn + \tl_replace_all:Nnn + { NnV } \ExplSyntaxOff \markdownIfOption{plain}{\iffalse}{\iftrue} \markdownIfOption{tightLists}{ @@ -607,7 +657,7 @@ dlEndTight = {\markdownRendererDlEnd}}} } \ExplSyntaxOff -\RequirePackage{amsmath,ifthen} +\RequirePackage{amsmath} \@ifpackageloaded{unicode-math}{ \markdownSetup{rendererPrototypes={ untickedBox = {$\mdlgwhtsquare$}, @@ -637,29 +687,33 @@ \else \texttt{#1}% \fi + }}} +\ExplSyntaxOn +\markdownSetup{ + rendererPrototypes = { + contentBlock = { + \str_case:nnF + { #1 } + { + { csv } + { + \begin{table} + \begin{center} + \csvautotabular{#3} + \end{center} + \tl_if_empty:nF + { #4 } + { \caption{#4} } + \end{table} + } + { tex } { \markdownEscape{#3} } + } + { \markdownInput{#3} } + }, }, - contentBlock = {% - \ifthenelse{\equal{#1}{csv}}{% - \begin{table}% - \begin{center}% - \csvautotabular{#3}% - \end{center} - \ifx\empty#4\empty\else - \caption{#4}% - \fi - \end{table}% - }{% - \ifthenelse{\equal{#1}{tex}}{% - \catcode`\%=14\relax - \catcode`\#=6\relax - \input #3\relax - \catcode`\%=12\relax - \catcode`\#=12\relax - }{% - \markdownInput{#3}% - }% - }% - }, +} +\ExplSyntaxOff +\markdownSetup{rendererPrototypes={ image = {% \begin{figure}% \begin{center}% @@ -724,8 +778,8 @@ \catcode`\#=12\relax }% \fi}, - horizontalRule = {\noindent\rule[0.5ex]{\linewidth}{1pt}}, - footnote = {\footnote{#1}}}} + thematicBreak = {\noindent\rule[0.5ex]{\linewidth}{1pt}}, + note = {\footnote{#1}}}} \ExplSyntaxOn \def\markdownLATEXStrongEmphasis#1{% \str_if_in:NnTF @@ -1161,7 +1215,6 @@ \addto@hook\markdownLaTeXTable{#1\\}% \expandafter\@gobble \fi\markdownLaTeXRenderTableCell} -\fi \ExplSyntaxOn \keys_define:nn { markdown/jekyllData } @@ -1201,6 +1254,23 @@ } } }{} +\ExplSyntaxOn +\cs_gset:Npn + \markdownRendererInputRawInlinePrototype#1#2 + { + \str_case:nn + { #2 } + { + { tex } { \markdownEscape{#1} } + { latex } { \markdownEscape{#1} } + { md } { \markdownInput{#1} } + } + } +\cs_gset_eq:NN + \markdownRendererInputRawBlockPrototype + \markdownRendererInputRawInlinePrototype +\ExplSyntaxOff +\fi % Closes `\markdownIfOption{Plain}{\iffalse}{iftrue}` \newcommand\markdownMakeOther{% \count0=128\relax \loop |