diff options
author | Karl Berry <karl@freefriends.org> | 2021-08-07 20:19:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-08-07 20:19:27 +0000 |
commit | d0d20a6ba7cff5159a2f78b414326262f45b0542 (patch) | |
tree | b14872bbfe4e416eed32b7707844a2078189d27f /Master/texmf-dist/tex/latex/markdown | |
parent | 84dbd3f0f8c0982f6944cc314d7ac0cbefec0769 (diff) |
markdown (7aug21)
git-svn-id: svn://tug.org/texlive/trunk@60182 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/markdown')
4 files changed, 319 insertions, 57 deletions
diff --git a/Master/texmf-dist/tex/latex/markdown/markdown.sty b/Master/texmf-dist/tex/latex/markdown/markdown.sty index 816c56a2a0d..fa84c468857 100644 --- a/Master/texmf-dist/tex/latex/markdown/markdown.sty +++ b/Master/texmf-dist/tex/latex/markdown/markdown.sty @@ -6,7 +6,7 @@ %% %% markdown.dtx (with options: `latex') %% -%% Copyright (C) 2016-2020 Vít Novotný +%% Copyright (C) 2016-2021 Vít Novotný %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -45,18 +45,63 @@ %% %% The names of the source files used are shown above. %% -\NeedsTeXFormat{LaTeX2e}% \RequirePackage{keyval} -\RequirePackage{url} -\RequirePackage{graphicx} -\RequirePackage{ifthen} -\RequirePackage{fancyvrb} -\RequirePackage{csvsimple} -\RequirePackage{gobble} +\RequirePackage{xstring} \newenvironment{markdown}\relax\relax \newenvironment{markdown*}[1]\relax\relax \newcommand\markdownSetup[1]{% \setkeys{markdownOptions}{#1}}% +\newcommand\markdownSetupSnippet[2]{% + \@ifundefined + {markdownLaTeXSetupSnippet\markdownLaTeXThemeName#1}{% + \newtoks\next + \next={#2}% + \expandafter\let\csname markdownLaTeXSetupSnippet% + \markdownLaTeXThemeName#1\endcsname=\next + }{% + \markdownWarning + {Redefined setup snippet \markdownLaTeXThemeName#1}% + \csname markdownLaTeXSetupSnippet% + \markdownLaTeXThemeName#1\endcsname={#2}% + }}% +\newif\ifmarkdownLaTeXPlain + \markdownLaTeXPlainfalse +\define@key{markdownOptions}{plain}[true]{% + \ifmarkdownLaTeXLoaded + \markdownWarning + {The plain option must be specified when loading the package}% + \else + \markdownLaTeXPlaintrue + \fi} +\newif\ifmarkdownLaTeXLoaded + \markdownLaTeXLoadedfalse +\AtEndOfPackage{\markdownLaTeXLoadedtrue}% +\define@key{markdownOptions}{theme}{% + \IfSubStr{#1}{/}{}{% + \markdownError + {Won't load theme with unqualified name #1}% + {Theme names must contain at least one forward slash}}% + \StrSubstitute{#1}{/}{_}[\markdownLaTeXThemePackageName]% + \edef\markdownLaTeXThemePackageName{% + markdowntheme\markdownLaTeXThemePackageName}% + \expandafter\markdownLaTeXThemeLoad\expandafter{% + \markdownLaTeXThemePackageName}{#1/}}% +\newcommand\markdownLaTeXThemeName{}% +\newcommand\markdownLaTeXThemeLoad[2]{% + \ifmarkdownLaTeXLoaded + \def\markdownLaTeXThemeName{#2}% + \RequirePackage{#1}% + \def\markdownLaTeXThemeName{}% + \else + \AtEndOfPackage{% + \def\markdownLaTeXThemeName{#2}% + \RequirePackage{#1}% + \def\markdownLaTeXThemeName{}}% + \fi}% +\@onlypreamble\KV@markdownOptions@theme +\define@key{markdownOptions}{snippet}{% + \expandafter\markdownSetup\expandafter{% + \the\csname markdownLaTeXSetupSnippet#1\endcsname}}% \define@key{markdownOptions}{helperScriptFileName}{% \def\markdownOptionHelperScriptFileName{#1}}% \define@key{markdownOptions}{inputTempFileName}{% @@ -115,8 +160,12 @@ \def\markdownOptionSlice{#1}}% \define@key{markdownOptions}{startNumber}[true]{% \def\markdownOptionStartNumber{#1}}% +\define@key{markdownOptions}{stripIndent}[true]{% + \def\markdownOptionStripIndent{#1}}% \define@key{markdownOptions}{tableCaptions}[true]{% \def\markdownOptionTableCaptions{#1}}% +\define@key{markdownOptions}{texComments}[true]{% + \def\markdownOptionTeXComments{#1}}% \define@key{markdownOptions}{tightLists}[true]{% \def\markdownOptionTightLists{#1}}% \define@key{markdownOptions}{underscores}[true]{% @@ -249,6 +298,8 @@ \renewcommand\markdownRendererTextCite[1]{#1}}% \define@key{markdownRenderers}{table}{% \renewcommand\markdownRendererTable[3]{#1}}% +\define@key{markdownRenderers}{inlineHtmlComment}{% + \renewcommand\markdownRendererInlineHtmlComment[1]{#1}}% \define@key{markdownRendererPrototypes}{interblockSeparator}{% \renewcommand\markdownRendererInterblockSeparatorPrototype{#1}}% \define@key{markdownRendererPrototypes}{lineBreak}{% @@ -367,13 +418,15 @@ \renewcommand\markdownRendererTextCitePrototype[1]{#1}}% \define@key{markdownRendererPrototypes}{table}{% \renewcommand\markdownRendererTablePrototype[3]{#1}}% -\input markdown +\define@key{markdownRendererPrototypes}{inlineHtmlComment}{% + \renewcommand\markdownRendererInlineHtmlCommentPrototype[1]{#1}}% +\newcommand\markdownInfo[1]{\PackageInfo{markdown}{#1}}% +\newcommand\markdownWarning[1]{\PackageWarning{markdown}{#1}}% +\newcommand\markdownError[2]{\PackageError{markdown}{#1}{#2.}}% +\input markdown/markdown \def\markdownVersionSpace{ }% \ProvidesPackage{markdown}[\markdownLastModified\markdownVersionSpace v% \markdownVersion\markdownVersionSpace markdown renderer]% -\renewcommand\markdownInfo[1]{\PackageInfo{markdown}{#1}}% -\renewcommand\markdownWarning[1]{\PackageWarning{markdown}{#1}}% -\renewcommand\markdownError[2]{\PackageError{markdown}{#1}{#2.}}% \let\markdownInputPlainTeX\markdownInput \renewcommand\markdownInput[2][]{% \begingroup @@ -403,13 +456,15 @@ \define@key{markdownOptions}{rendererPrototypes}{% \setkeys{markdownRendererPrototypes}{#1}% \def\KV@prefix{KV@markdownOptions@}}% -\ifx\markdownOptionTightLists\undefined - \@ifclassloaded{beamer}{}{ - \RequirePackage{paralist}} -\else - \ifthenelse{\equal{\markdownOptionTightLists}{false}}{}{ - \RequirePackage{paralist}} -\fi +\ifmarkdownLaTeXPlain\else +\RequirePackage{ifthen} +\@ifundefined{markdownOptionTightLists}{% + \@ifclassloaded{beamer}{}{% + \RequirePackage{paralist}}% +}{% + \ifthenelse{\equal{\markdownOptionTightLists}{false}}{}{% + \RequirePackage{paralist}}% +}% \@ifpackageloaded{paralist}{ \markdownSetup{rendererPrototypes={ ulBeginTight = {\begin{compactitem}}, @@ -426,6 +481,9 @@ olEndTight = {\markdownRendererOlEnd}, dlBeginTight = {\markdownRendererDlBegin}, dlEndTight = {\markdownRendererDlEnd}}}} +\RequirePackage{csvsimple} +\RequirePackage{fancyvrb} +\RequirePackage{graphicx} \markdownSetup{rendererPrototypes={ lineBreak = {\\}, leftBrace = {\textbraceleft}, @@ -459,10 +517,10 @@ \label{fig:#1}% \end{figure}}, ulBegin = {\begin{itemize}}, - ulItem = {\item}, + ulItem = {\item{}}, ulEnd = {\end{itemize}}, olBegin = {\begin{enumerate}}, - olItem = {\item}, + olItem = {\item{}}, olItemWithNumber = {\item[#1.]}, olEnd = {\end{enumerate}}, dlBegin = {\begin{description}}, @@ -476,39 +534,30 @@ \ifx\relax#2\relax \VerbatimInput{#1}% \else - \ifx\minted@code\undefined - \ifx\lst@version\undefined + \@ifundefined{minted@code}{% + \@ifundefined{lst@version}{% \markdownRendererInputFencedCode{#1}{}% - \else + }{% \lstinputlisting[language=#2]{#1}% - \fi - \else + }% + }{% \inputminted{#2}{#1}% - \fi + }% \fi}, horizontalRule = {\noindent\rule[0.5ex]{\linewidth}{1pt}}, footnote = {\footnote{#1}}}} -\newif\ifmarkdownLATEXStrongEmphasisNested -\markdownLATEXStrongEmphasisNestedfalse -\markdownSetup{rendererPrototypes={ - strongEmphasis = {% - \ifmarkdownLATEXStrongEmphasisNested - \markdownLATEXStrongEmphasisNestedfalse - \textmd{#1}% - \markdownLATEXStrongEmphasisNestedtrue - \else - \markdownLATEXStrongEmphasisNestedtrue - \textbf{#1}% - \markdownLATEXStrongEmphasisNestedfalse - \fi}}} -\ifx\chapter\undefined +\def\markdownLATEXStrongEmphasis#1{% + \IfSubStr\f@series{b}{\textnormal{#1}}{\textbf{#1}}} +\markdownSetup{rendererPrototypes={strongEmphasis={% + \protect\markdownLATEXStrongEmphasis{#1}}}} +\@ifundefined{chapter}{% \markdownSetup{rendererPrototypes = { headingOne = {\section{#1}}, headingTwo = {\subsection{#1}}, headingThree = {\subsubsection{#1}}, headingFour = {\paragraph{#1}\leavevmode}, headingFive = {\subparagraph{#1}\leavevmode}}} -\else +}{% \markdownSetup{rendererPrototypes = { headingOne = {\chapter{#1}}, headingTwo = {\section{#1}}, @@ -516,9 +565,10 @@ headingFour = {\subsubsection{#1}}, headingFive = {\paragraph{#1}\leavevmode}, headingSix = {\subparagraph{#1}\leavevmode}}} -\fi +}% \newcount\markdownLaTeXCitationsCounter +\RequirePackage{gobble} \def\markdownLaTeXBasicCitations#1#2#3#4#5#6{% \advance\markdownLaTeXCitationsCounter by 1\relax \ifx\relax#4\relax @@ -691,47 +741,48 @@ cite = {% \markdownLaTeXCitationsCounter=1% \def\markdownLaTeXCitationsTotal{#1}% - \ifx\autocites\undefined - \ifx\citep\undefined + \@ifundefined{autocites}{% + \@ifundefined{citep}{% \expandafter\expandafter\expandafter \markdownLaTeXBasicCitations \expandafter\expandafter\expandafter{% \expandafter\expandafter\expandafter}% \expandafter\expandafter\expandafter{% \expandafter\expandafter\expandafter}% - \else + }{% \expandafter\expandafter\expandafter \markdownLaTeXNatbibCitations \expandafter\expandafter\expandafter{% \expandafter\expandafter\expandafter}% - \fi - \else + }% + }{% \expandafter\expandafter\expandafter \markdownLaTeXBibLaTeXCitations \expandafter{\expandafter}% - \fi}, + }}, textCite = {% \markdownLaTeXCitationsCounter=1% \def\markdownLaTeXCitationsTotal{#1}% - \ifx\autocites\undefined - \ifx\citep\undefined + \@ifundefined{autocites}{% + \@ifundefined{citep}{% \expandafter\expandafter\expandafter \markdownLaTeXBasicTextCitations \expandafter\expandafter\expandafter{% \expandafter\expandafter\expandafter}% \expandafter\expandafter\expandafter{% \expandafter\expandafter\expandafter}% - \else + }{% \expandafter\expandafter\expandafter \markdownLaTeXNatbibTextCitations \expandafter\expandafter\expandafter{% \expandafter\expandafter\expandafter}% - \fi - \else + }% + }{% \expandafter\expandafter\expandafter \markdownLaTeXBibLaTeXTextCitations \expandafter{\expandafter}% - \fi}}} + }}}} +\RequirePackage{url} \def\markdownRendererLinkPrototype{% \begingroup \catcode`\#=12 @@ -794,8 +845,6 @@ \fi \advance\markdownLaTeXRowCounter by 1\relax \ifnum\markdownLaTeXRowCounter>\markdownLaTeXRowTotal\relax - \markdownInfo{\the\markdownLaTeXTable} - \markdownInfo{\the\markdownLaTeXTableEnd} \the\markdownLaTeXTable \the\markdownLaTeXTableEnd \expandafter\@gobble @@ -818,6 +867,7 @@ \addto@hook\markdownLaTeXTable{#1\\}% \expandafter\@gobble \fi\markdownLaTeXRenderTableCell} +\fi \newcommand\markdownMakeOther{% \count0=128\relax \loop diff --git a/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_dot.sty b/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_dot.sty new file mode 100644 index 00000000000..3a569f72775 --- /dev/null +++ b/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_dot.sty @@ -0,0 +1,71 @@ +%% +%% This is file `markdownthemewitiko_dot.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% markdown.dtx (with options: `latex-themes-witiko-dot') +%% +%% Copyright (C) 2016-2021 Vít Novotný +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% The Current Maintainer of this work is Vít Novotný. +%% +%% Send bug reports, requests for additions and questions +%% either to the GitHub issue tracker at +%% +%% https://github.com/Witiko/markdown/issues +%% +%% or to the e-mail address <witiko@mail.muni.cz>. +%% +%% MODIFICATION ADVICE: +%% +%% If you want to customize this file, it is best to make a copy of +%% the source file(s) from which it was produced. Use a different +%% name for your copy(ies) and modify the copy(ies); this will ensure +%% that your modifications do not get overwritten when you install a +%% new release of the standard system. You should also ensure that +%% your modified source file does not generate any modified file with +%% the same name as a standard file. +%% +%% You will also need to produce your own, suitably named, .ins file to +%% control the generation of files from your source file; this file +%% should contain your own preambles for the files it generates, not +%% those in the standard .ins files. +%% +%% The names of the source files used are shown above. +%% +\ProvidesPackage{markdownthemewitiko_dot}[2021/03/09]% +\markdownSetup{fencedCode}% +\let\markdown@witiko@dot@oldRendererInputFencedCodePrototype + \markdownRendererInputFencedCodePrototype +\RequirePackage{ifthen} +\renewcommand\markdownRendererInputFencedCode[2]{% + \def\next##1 ##2\relax{% + \ifthenelse{\equal{##1}{dot}}{% + \markdownIfOption{FrozenCache}{}{% + \immediate\write18{% + if ! test -e #1.pdf.source || ! diff #1 #1.pdf.source; + then + dot -Tpdf -o #1.pdf #1; + cp #1 #1.pdf.source; + fi}}% + \markdownRendererImage{Graphviz image}{#1.pdf}{#1.pdf}{##2}% + }{% + \markdown@witiko@dot@oldRendererInputFencedCodePrototype{#1}{#2}% + }% + }% + \next#2 \relax}% +\endinput +%% +%% End of file `markdownthemewitiko_dot.sty'. diff --git a/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_graphicx_http.sty b/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_graphicx_http.sty new file mode 100644 index 00000000000..56a0bcb960e --- /dev/null +++ b/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_graphicx_http.sty @@ -0,0 +1,89 @@ +%% +%% This is file `markdownthemewitiko_graphicx_http.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% markdown.dtx (with options: `latex-themes-witiko-graphicx-http') +%% +%% Copyright (C) 2016-2021 Vít Novotný +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% The Current Maintainer of this work is Vít Novotný. +%% +%% Send bug reports, requests for additions and questions +%% either to the GitHub issue tracker at +%% +%% https://github.com/Witiko/markdown/issues +%% +%% or to the e-mail address <witiko@mail.muni.cz>. +%% +%% MODIFICATION ADVICE: +%% +%% If you want to customize this file, it is best to make a copy of +%% the source file(s) from which it was produced. Use a different +%% name for your copy(ies) and modify the copy(ies); this will ensure +%% that your modifications do not get overwritten when you install a +%% new release of the standard system. You should also ensure that +%% your modified source file does not generate any modified file with +%% the same name as a standard file. +%% +%% You will also need to produce your own, suitably named, .ins file to +%% control the generation of files from your source file; this file +%% should contain your own preambles for the files it generates, not +%% those in the standard .ins files. +%% +%% The names of the source files used are shown above. +%% +\ProvidesPackage{markdownthemewitiko_graphicx_http}[2021/03/22]% +\RequirePackage{catchfile} +\let\markdown@witiko@graphicx@http@oldRendererImagePrototype + \markdownRendererImagePrototype +\newcount\markdown@witiko@graphicx@http@counter +\markdown@witiko@graphicx@http@counter=0 +\newcommand\markdown@witiko@graphicx@http@filename{% + \markdownOptionCacheDir/witiko_graphicx_http% + .\the\markdown@witiko@graphicx@http@counter}% +\newcommand\markdown@witiko@graphicx@http@download[2]{% + wget -O #2 #1 || curl --location -o #2 #1 || rm -f #2} +\begingroup +\catcode`\%=12 +\catcode`\^^A=14 +\global\def\markdownRendererImagePrototype#1#2#3#4{^^A + \begingroup + \edef\filename{\markdown@witiko@graphicx@http@filename}^^A + \markdownIfOption{FrozenCache}{}{^^A + \immediate\write18{^^A + if printf '%s' "#3" | grep -q -E '^https?:'; + then + OUTPUT_PREFIX="\markdownOptionCacheDir"; + OUTPUT_BODY="$(printf '%s' '#3' | md5sum | cut -d' ' -f1)"; + OUTPUT_SUFFIX="$(printf '%s' '#3' | sed 's/.*[.]//')"; + OUTPUT="$OUTPUT_PREFIX/$OUTPUT_BODY.$OUTPUT_SUFFIX"; + if ! [ -e "$OUTPUT" ]; + then + \markdown@witiko@graphicx@http@download{'#3'}{"$OUTPUT"}; + printf '%s' "$OUTPUT" > "\filename"; + fi; + else + printf '%s' '#3' > "\filename"; + fi}}^^A + \CatchFileDef{\filename}{\filename}{}^^A + \markdown@witiko@graphicx@http@oldRendererImagePrototype^^A + {#1}{#2}{\filename}{#4}^^A + \endgroup + \global\advance\markdown@witiko@graphicx@http@counter by 1\relax}^^A +\endgroup +\endinput +%% +%% End of file `markdownthemewitiko_graphicx_http.sty'. diff --git a/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_tilde.sty b/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_tilde.sty new file mode 100644 index 00000000000..104b93088d3 --- /dev/null +++ b/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_tilde.sty @@ -0,0 +1,52 @@ +%% +%% This is file `markdownthemewitiko_tilde.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% markdown.dtx (with options: `latex-themes-witiko-tilde') +%% +%% Copyright (C) 2016-2021 Vít Novotný +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% The Current Maintainer of this work is Vít Novotný. +%% +%% Send bug reports, requests for additions and questions +%% either to the GitHub issue tracker at +%% +%% https://github.com/Witiko/markdown/issues +%% +%% or to the e-mail address <witiko@mail.muni.cz>. +%% +%% MODIFICATION ADVICE: +%% +%% If you want to customize this file, it is best to make a copy of +%% the source file(s) from which it was produced. Use a different +%% name for your copy(ies) and modify the copy(ies); this will ensure +%% that your modifications do not get overwritten when you install a +%% new release of the standard system. You should also ensure that +%% your modified source file does not generate any modified file with +%% the same name as a standard file. +%% +%% You will also need to produce your own, suitably named, .ins file to +%% control the generation of files from your source file; this file +%% should contain your own preambles for the files it generates, not +%% those in the standard .ins files. +%% +%% The names of the source files used are shown above. +%% +\ProvidesPackage{markdownthemewitiko_tilde}[2021/03/22]% +\renewcommand\markdownRendererTildePrototype{~}% +\endinput +%% +%% End of file `markdownthemewitiko_tilde.sty'. |