diff options
author | Karl Berry <karl@freefriends.org> | 2019-04-30 22:33:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-04-30 22:33:13 +0000 |
commit | b6d364c734eb81b15eae8ff489cf3291cb6ecc9b (patch) | |
tree | b40de735c59f5c01af64f9c5f14ab16fa7965105 /Master/texmf-dist/tex/latex/markdown | |
parent | f654f58447a9158157316c77873b4c2b85ae1456 (diff) |
markdown (30apr19)
git-svn-id: svn://tug.org/texlive/trunk@50906 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 | 90 |
1 files changed, 89 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/latex/markdown/markdown.sty b/Master/texmf-dist/tex/latex/markdown/markdown.sty index f21cb15b81d..301434928a5 100644 --- a/Master/texmf-dist/tex/latex/markdown/markdown.sty +++ b/Master/texmf-dist/tex/latex/markdown/markdown.sty @@ -103,14 +103,20 @@ \def\markdownOptionHybrid{#1}}% \define@key{markdownOptions}{inlineFootnotes}[true]{% \def\markdownOptionInlineFootnotes{#1}}% +\define@key{markdownOptions}{pipeTables}[true]{% + \def\markdownOptionPipeTables{#1}}% \define@key{markdownOptions}{preserveTabs}[true]{% \def\markdownOptionPreserveTabs{#1}}% \define@key{markdownOptions}{smartEllipses}[true]{% \def\markdownOptionSmartEllipses{#1}}% -\define@key{markdownOptions}{slice}[true]{% +\define@key{markdownOptions}{shiftHeadings}{% + \def\markdownOptionShiftHeadings{#1}}% +\define@key{markdownOptions}{slice}{% \def\markdownOptionSlice{#1}}% \define@key{markdownOptions}{startNumber}[true]{% \def\markdownOptionStartNumber{#1}}% +\define@key{markdownOptions}{tableCaptions}[true]{% + \def\markdownOptionTableCaptions{#1}}% \define@key{markdownOptions}{tightLists}[true]{% \def\markdownOptionTightLists{#1}}% \define@key{markdownOptions}{underscores}[true]{% @@ -233,6 +239,8 @@ \renewcommand\markdownRendererCite[1]{#1}}% \define@key{markdownRenderers}{textCite}{% \renewcommand\markdownRendererTextCite[1]{#1}}% +\define@key{markdownRenderers}{table}{% + \renewcommand\markdownRendererTable[3]{#1}}% \define@key{markdownRendererPrototypes}{interblockSeparator}{% \renewcommand\markdownRendererInterblockSeparatorPrototype{#1}}% \define@key{markdownRendererPrototypes}{lineBreak}{% @@ -349,6 +357,8 @@ \renewcommand\markdownRendererCitePrototype[1]{#1}}% \define@key{markdownRendererPrototypes}{textCite}{% \renewcommand\markdownRendererTextCitePrototype[1]{#1}}% +\define@key{markdownRendererPrototypes}{table}{% + \renewcommand\markdownRendererTablePrototype[3]{#1}}% \input markdown \def\markdownVersionSpace{ }% \ProvidesPackage{markdown}[\markdownLastModified\markdownVersionSpace v% @@ -721,6 +731,84 @@ \ifx\empty##4\empty\else##4: \fi\texttt<\url{##3}\texttt>}% \endgroup}% \next} +\newcount\markdownLaTeXRowCounter +\newcount\markdownLaTeXRowTotal +\newcount\markdownLaTeXColumnCounter +\newcount\markdownLaTeXColumnTotal +\newtoks\markdownLaTeXTable +\newtoks\markdownLaTeXTableAlignment +\newtoks\markdownLaTeXTableEnd +\@ifpackageloaded{booktabs}{ + \let\markdownLaTeXTopRule\toprule + \let\markdownLaTeXMidRule\midrule + \let\markdownLaTeXBottomRule\bottomrule +}{ + \let\markdownLaTeXTopRule\hline + \let\markdownLaTeXMidRule\hline + \let\markdownLaTeXBottomRule\hline +} +\markdownSetup{rendererPrototypes={ + table = {% + \markdownLaTeXTable={}% + \markdownLaTeXTableAlignment={}% + \markdownLaTeXTableEnd={% + \markdownLaTeXBottomRule + \end{tabular}}% + \ifx\empty#1\empty\else + \addto@hook\markdownLaTeXTable{% + \begin{table} + \centering}% + \addto@hook\markdownLaTeXTableEnd{% + \caption{#1} + \end{table}}% + \fi + \addto@hook\markdownLaTeXTable{\begin{tabular}}% + \markdownLaTeXRowCounter=0% + \markdownLaTeXRowTotal=#2% + \markdownLaTeXColumnTotal=#3% + \markdownLaTeXRenderTableRow + } +}} +\def\markdownLaTeXRenderTableRow#1{% + \markdownLaTeXColumnCounter=0% + \ifnum\markdownLaTeXRowCounter=0\relax + \markdownLaTeXReadAlignments#1% + \markdownLaTeXTable=\expandafter\expandafter\expandafter{% + \expandafter\the\expandafter\markdownLaTeXTable\expandafter{% + \the\markdownLaTeXTableAlignment}}% + \addto@hook\markdownLaTeXTable{\markdownLaTeXTopRule}% + \else + \markdownLaTeXRenderTableCell#1% + \fi + \ifnum\markdownLaTeXRowCounter=1\relax + \addto@hook\markdownLaTeXTable\markdownLaTeXMidRule + \fi + \advance\markdownLaTeXRowCounter by 1\relax + \ifnum\markdownLaTeXRowCounter>\markdownLaTeXRowTotal\relax + \markdownInfo{\the\markdownLaTeXTable} + \markdownInfo{\the\markdownLaTeXTableEnd} + \the\markdownLaTeXTable + \the\markdownLaTeXTableEnd + \expandafter\@gobble + \fi\markdownLaTeXRenderTableRow} +\def\markdownLaTeXReadAlignments#1{% + \advance\markdownLaTeXColumnCounter by 1\relax + \if#1d% + \addto@hook\markdownLaTeXTableAlignment{l}% + \else + \addto@hook\markdownLaTeXTableAlignment{#1}% + \fi + \ifnum\markdownLaTeXColumnCounter<\markdownLaTeXColumnTotal\relax\else + \expandafter\@gobble + \fi\markdownLaTeXReadAlignments} +\def\markdownLaTeXRenderTableCell#1{% + \advance\markdownLaTeXColumnCounter by 1\relax + \ifnum\markdownLaTeXColumnCounter<\markdownLaTeXColumnTotal\relax + \addto@hook\markdownLaTeXTable{#1&}% + \else + \addto@hook\markdownLaTeXTable{#1\\}% + \expandafter\@gobble + \fi\markdownLaTeXRenderTableCell} \newcommand\markdownMakeOther{% \count0=128\relax \loop |