diff options
author | Karl Berry <karl@freefriends.org> | 2023-04-27 20:37:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-04-27 20:37:52 +0000 |
commit | fd9564b21054e27d1e4f4bfcca7683ae3b84e2fb (patch) | |
tree | f98ea8c61cbdc8546aabe2957323aca8776c3bca /Master/texmf-dist/tex/latex | |
parent | eaf38b0e316452820428aaa331b98c6b2c9d8edf (diff) |
markdown (27apr23)
git-svn-id: svn://tug.org/texlive/trunk@66954 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/markdown/markdown.sty | 243 |
1 files changed, 232 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/latex/markdown/markdown.sty b/Master/texmf-dist/tex/latex/markdown/markdown.sty index c887db1c16a..661ea377553 100644 --- a/Master/texmf-dist/tex/latex/markdown/markdown.sty +++ b/Master/texmf-dist/tex/latex/markdown/markdown.sty @@ -318,7 +318,7 @@ { s } { \msg_error:nnn - { __markdown } + { markdown } { malformed-name-for-clist-option } { #3 } } @@ -364,7 +364,7 @@ { en } { F } \msg_new:nnn - { __markdown } + { markdown } { malformed-name-for-clist-option } { Clist~option~name~#1~does~not~end~with~-s. @@ -430,6 +430,103 @@ { ncV } \ExplSyntaxOff \ExplSyntaxOn +\tl_new:N + \l__markdown_renderer_definition_tl +\keys_define:nn + { markdown/latex-options/renderers } + { + unknown .code:n = { + \regex_match:nVTF + { \* } + \l_keys_key_str + { + \tl_set:Nn + \l__markdown_renderer_definition_tl + { #1 } + \tl_set:NV + \l_tmpa_tl + \l_keys_key_str + \regex_replace_all:nnN + { \* } + { .* } + \l_tmpa_tl + \regex_set:NV + \l_tmpa_regex + \l_tmpa_tl + \int_zero:N + \l_tmpa_int + \seq_map_inline:Nn + \g__markdown_renderers_seq + { + \__markdown_with_various_cases:nn + { ##1 } + { + \regex_match:NnT + \l_tmpa_regex + { ####1 } + { + \__markdown_renderer_tl_to_csname:nN + { ##1 } + \l_tmpa_tl + \prop_get:NnN + \g__markdown_renderer_arities_prop + { ##1 } + \l_tmpb_tl + \cs_generate_from_arg_count:cNVV + { \l_tmpa_tl } + \cs_set:Npn + \l_tmpb_tl + \l__markdown_renderer_definition_tl + \int_incr:N + \l_tmpa_int + \__markdown_with_various_cases_break: + } + } + } + \int_compare:nNnT + { \l_tmpa_int } = { 0 } + { + \msg_error:nnV + { markdown } + { nonmatched-renderer-wildcard } + \l_keys_key_str + } + } + { + \msg_error:nnV + { markdown } + { undefined-renderer } + \l_keys_key_str + } + }, + } +\msg_new:nnn + { markdown } + { undefined-renderer } + { + Renderer~#1~is~undefined. + } +\msg_new:nnn + { markdown } + { nonmatched-renderer-wildcard } + { + Wildcard~#1~matches~no~renderers. + } +\cs_generate_variant:Nn + \regex_set:Nn + { NV } +\cs_generate_variant:Nn + \cs_generate_from_arg_count:NNnn + { cNVV } +\cs_generate_variant:Nn + \msg_error:nnn + { nnV } +\prg_generate_conditional_variant:Nnn + \regex_match:nn + { nV } + { TF } +\ExplSyntaxOff +\ExplSyntaxOn \cs_new:Nn \__markdown_latex_define_renderer_prototypes: { \seq_map_function:NN @@ -472,6 +569,103 @@ \__markdown_latex_define_renderer_prototype:nNn { ncV } \ExplSyntaxOff +\ExplSyntaxOn +\tl_new:N + \l__markdown_renderer_prototype_definition_tl +\keys_define:nn + { markdown/latex-options/renderer-prototypes } + { + unknown .code:n = { + \regex_match:nVTF + { \* } + \l_keys_key_str + { + \tl_set:Nn + \l__markdown_renderer_prototype_definition_tl + { #1 } + \tl_set:NV + \l_tmpa_tl + \l_keys_key_str + \regex_replace_all:nnN + { \* } + { .* } + \l_tmpa_tl + \regex_set:NV + \l_tmpa_regex + \l_tmpa_tl + \int_zero:N + \l_tmpa_int + \seq_map_inline:Nn + \g__markdown_renderers_seq + { + \__markdown_with_various_cases:nn + { ##1 } + { + \regex_match:NnT + \l_tmpa_regex + { ####1 } + { + \__markdown_renderer_prototype_tl_to_csname:nN + { ##1 } + \l_tmpa_tl + \prop_get:NnN + \g__markdown_renderer_arities_prop + { ##1 } + \l_tmpb_tl + \cs_generate_from_arg_count:cNVV + { \l_tmpa_tl } + \cs_set:Npn + \l_tmpb_tl + \l__markdown_renderer_prototype_definition_tl + \int_incr:N + \l_tmpa_int + \__markdown_with_various_cases_break: + } + } + } + \int_compare:nNnT + { \l_tmpa_int } = { 0 } + { + \msg_error:nnV + { markdown } + { nonmatched-renderer-prototype-wildcard } + \l_keys_key_str + } + } + { + \msg_error:nnV + { markdown } + { undefined-renderer-prototype } + \l_keys_key_str + } + }, + } +\msg_new:nnn + { markdown } + { undefined-renderer-prototype } + { + Renderer~prototype~#1~is~undefined. + } +\msg_new:nnn + { markdown } + { nonmatched-renderer-prototype-wildcard } + { + Wildcard~#1~matches~no~renderer~prototypes. + } +\cs_generate_variant:Nn + \regex_set:Nn + { NV } +\cs_generate_variant:Nn + \cs_generate_from_arg_count:NNnn + { cNVV } +\cs_generate_variant:Nn + \msg_error:nnn + { nnV } +\prg_generate_conditional_variant:Nnn + \regex_match:nn + { nV } + { TF } +\ExplSyntaxOff \def\markdownVersionSpace{ }% \ProvidesPackage{markdown}[\markdownLastModified\markdownVersionSpace v% \markdownVersion\markdownVersionSpace markdown renderer]% @@ -666,8 +860,16 @@ { #2 } } \markdownSetup{rendererPrototypes={ - ulBeginTight = {\begin{compactitem}}, - ulEndTight = {\end{compactitem}}, + ulBeginTight = {% + \group_begin: + \pltopsep=\topsep + \plpartopsep=\partopsep + \begin{compactitem} + }, + ulEndTight = { + \end{compactitem} + \group_end: + }, fancyOlBegin = { \group_begin: \tl_set:Nn @@ -691,8 +893,16 @@ \end{enumerate} \group_end: }, - olBeginTight = {\begin{compactenum}}, - olEndTight = {\end{compactenum}}, + olBeginTight = {% + \group_begin: + \plpartopsep=\partopsep + \pltopsep=\topsep + \begin{compactenum} + }, + olEndTight = { + \end{compactenum} + \group_end: + }, fancyOlBeginTight = { \group_begin: \tl_set:Nn @@ -703,7 +913,11 @@ { #2 } \tl_set:Nn \l_tmpa_tl - { \begin{compactenum}[ } + { + \plpartopsep=\partopsep + \pltopsep=\topsep + \begin{compactenum}[ + } \tl_put_right:Nx \l_tmpa_tl { \__markdown_latex_paralist_style:nn { #1 } { #2 } } @@ -725,8 +939,16 @@ { #1 } ] }, - dlBeginTight = {\begin{compactdesc}}, - dlEndTight = {\end{compactdesc}}}} + dlBeginTight = { + \group_begin: + \plpartopsep=\partopsep + \pltopsep=\topsep + \begin{compactdesc} + }, + dlEndTight = { + \end{compactdesc} + \group_end: + }}} \cs_generate_variant:Nn \__markdown_latex_fancy_list_item_label:nnn { VVn } @@ -1390,7 +1612,7 @@ } }{} \ExplSyntaxOn -\__markdown_if_option:nTF +\__markdown_if_option:nT { linkAttributes } { \RequirePackage{graphicx} @@ -1414,7 +1636,6 @@ }, } } - { } \ExplSyntaxOff \ExplSyntaxOn \cs_gset:Npn |