summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/third/markdown/t-markdown.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/third/markdown/t-markdown.tex')
-rw-r--r--Master/texmf-dist/tex/context/third/markdown/t-markdown.tex97
1 files changed, 91 insertions, 6 deletions
diff --git a/Master/texmf-dist/tex/context/third/markdown/t-markdown.tex b/Master/texmf-dist/tex/context/third/markdown/t-markdown.tex
index 7c5500e2ff8..2585f0c2f69 100644
--- a/Master/texmf-dist/tex/context/third/markdown/t-markdown.tex
+++ b/Master/texmf-dist/tex/context/third/markdown/t-markdown.tex
@@ -45,13 +45,85 @@
\writestatus{loading}{ConTeXt User Module / markdown}%
\startmodule[markdown]
\unprotect
-\let\startmarkdown\relax
-\let\stopmarkdown\relax
\def\markdownInfo#1{\writestatus{markdown}{#1.}}%
\def\markdownWarning#1{\writestatus{markdown\space warn}{#1.}}%
\def\dospecials{\do\ \do\\\do\{\do\}\do\$\do\&%
\do\#\do\^\do\_\do\%\do\~}%
\input markdown/markdown
+\let\startmarkdown\relax
+\let\stopmarkdown\relax
+\let\inputmarkdown\relax
+\ExplSyntaxOn
+\cs_new:Nn
+ \__markdown_setup:n
+ {
+ \keys_set:nn
+ { markdown/context-options }
+ { #1 }
+ }
+\long\def\setupmarkdown[#1]
+ {
+ \__markdown_setup:n
+ { #1 }
+ }
+\ExplSyntaxOff
+\ExplSyntaxOn
+\cs_new:Nn \__markdown_context_define_option_commands_and_keyvals:
+ {
+ \seq_map_inline:Nn
+ \g__markdown_option_layers_seq
+ {
+ \seq_map_inline:cn
+ { g__markdown_ ##1 _options_seq }
+ {
+ \__markdown_context_define_option_keyval:nn
+ { ##1 }
+ { ####1 }
+ }
+ }
+ }
+\cs_new:Nn \__markdown_context_define_option_keyval:nn
+ {
+ \prop_get:cnN
+ { g__markdown_ #1 _option_types_prop }
+ { #2 }
+ \l_tmpa_tl
+ \keys_define:nn
+ { markdown/context-options }
+ {
+ #2 .code:n = {
+ \tl_set:Nx
+ \l_tmpa_tl
+ {
+ \str_case:nnF
+ { ##1 }
+ {
+ { yes } { true }
+ { no } { false }
+ }
+ { ##1 }
+ }
+ \__markdown_set_option_value:nV
+ { #2 }
+ \l_tmpa_tl
+ },
+ }
+ \str_if_eq:VVT
+ \l_tmpa_tl
+ \c__markdown_option_type_boolean_tl
+ {
+ \keys_define:nn
+ { markdown/context-options }
+ {
+ #2 .default:n = { true },
+ }
+ }
+ }
+\cs_generate_variant:Nn
+ \__markdown_set_option_value:nn
+ { nV }
+\__markdown_context_define_option_commands_and_keyvals:
+\ExplSyntaxOff
\def\markdownMakeOther{%
\count0=128\relax
\loop
@@ -59,6 +131,16 @@
\advance\count0 by 1\relax
\ifnum\count0<256\repeat
\catcode`|=12}%
+\long\def\inputmarkdown{%
+ \dosingleempty
+ \doinputmarkdown}%
+\long\def\doinputmarkdown[#1]#2{%
+ \begingroup
+ \iffirstargument
+ \setupmarkdown{#1}%
+ \fi
+ \markdownInput{#2}%
+ \endgroup}%
\ifx\startluacode\undefined % MkII
\begingroup
\catcode`\|=0%
@@ -179,7 +261,12 @@
\def\markdownRendererHorizontalRulePrototype{%
\blackrule[height=1pt, width=\hsize]}%
\def\markdownRendererFootnotePrototype#1{\footnote{#1}}%
-\stopmodule\protect
+\def\markdownRendererTickedBoxPrototype{$\boxtimes$}
+\def\markdownRendererHalfTickedBoxPrototype{$\boxdot$}
+\def\markdownRendererUntickedBoxPrototype{$\square$}
+\def\markdownRendererStrikeThroughPrototype#1{\overstrikes{#1}}
+\def\markdownRendererSuperscriptPrototype#1{\high{#1}}
+\def\markdownRendererSubscriptPrototype#1{\low{#1}}
\newcount\markdownConTeXtRowCounter
\newcount\markdownConTeXtRowTotal
\newcount\markdownConTeXtColumnCounter
@@ -245,9 +332,7 @@
\ifnum\markdownConTeXtColumnCounter<\markdownConTeXtColumnTotal\relax\else
\expandafter\gobbleoneargument
\fi\markdownConTeXtRenderTableCell}
-\def\markdownRendererTickedBox{$\boxtimes$}
-\def\markdownRendererHalfTickedBox{$\boxdot$}
-\def\markdownRendererUntickedBox{$\square$}
+\stopmodule\protect
\endinput
%%
%% End of file `t-markdown.tex'.