mirror of
https://github.com/morten-olsen/morten-olsen.github.io.git
synced 2026-02-08 01:46:28 +01:00
update
This commit is contained in:
5
latex/a4.tex
Normal file
5
latex/a4.tex
Normal file
@@ -0,0 +1,5 @@
|
||||
\documentclass[10pt, a4paper]{article}
|
||||
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
|
||||
\def \columncount {3}
|
||||
\def \skillcolumncount {2}
|
||||
\include{header}
|
||||
5
latex/a5.tex
Normal file
5
latex/a5.tex
Normal file
@@ -0,0 +1,5 @@
|
||||
\documentclass[10pt, a5paper]{article}
|
||||
\usepackage[top=1.5cm, bottom=1cm, left=1cm, right=1cm]{geometry}
|
||||
\def \columncount {2}
|
||||
\def \skillcolumncount {2}
|
||||
\include{header}
|
||||
5
latex/a6.tex
Normal file
5
latex/a6.tex
Normal file
@@ -0,0 +1,5 @@
|
||||
\documentclass[10pt, a6paper]{article}
|
||||
\usepackage[top=1.5cm, bottom=2cm, left=1cm, right=1cm]{geometry}
|
||||
\def \columncount {1}
|
||||
\def \skillcolumncount {1}
|
||||
\include{header}
|
||||
73
latex/document.lua
Normal file
73
latex/document.lua
Normal file
@@ -0,0 +1,73 @@
|
||||
require("lualibs.lua")
|
||||
local file = io.open('../data.json')
|
||||
local jsonstring = file:read('*a')
|
||||
file:close()
|
||||
jsondata = utilities.json.tolua(jsonstring)
|
||||
|
||||
local function switch(a, case)
|
||||
local value = a
|
||||
local switchcase = {}
|
||||
|
||||
switchcase["info"] = function()
|
||||
tex.print("\\begin{cvtitle}{" .. value["name"] .. "}{../" .. value["image"] .. "}")
|
||||
for key, value in pairs(value["info"]) do
|
||||
tex.print("\\cvinfo{" .. value["name"] .. "}{" .. value["value"] .. "}")
|
||||
end
|
||||
|
||||
tex.print("\\end{cvtitle}")
|
||||
end
|
||||
|
||||
switchcase["text"] = function()
|
||||
tex.print("\\begin{columns}")
|
||||
tex.print("\\section*{" .. value["title"] .. "}")
|
||||
tex.print("\\begin{markdown}")
|
||||
tex.print(value["content"])
|
||||
tex.print("\\end{markdown}")
|
||||
tex.print("\\end{columns}")
|
||||
end
|
||||
|
||||
switchcase["skills"] = function()
|
||||
tex.print("\\section*{" .. value["title"] .. "}")
|
||||
tex.print(value["description"] .. "\\\\\\\\")
|
||||
tex.print("\\begin{cvskills}")
|
||||
for key, value in pairs(value["skills"]) do
|
||||
tex.print('\\cvskill{' .. value["title"] .. '}{' .. value["level"] .. '}')
|
||||
end
|
||||
tex.print("\\end{cvskills}")
|
||||
end
|
||||
|
||||
switchcase["experiences"] = function()
|
||||
tex.print("\\section*{" .. value["title"] .. "}")
|
||||
for key, value in pairs(value["positions"]) do
|
||||
tex.print("\\begin{cvexp}{" .. value["company"]["name"] .. "}{" .. value["startDate"] .. "}{" .. value["endDate"] .. "}{" .. value["title"] .. "}")
|
||||
tex.print("\\begin{markdown}")
|
||||
tex.print(value["description"])
|
||||
tex.print("\\end{markdown}")
|
||||
tex.print("\\end{cvexp}")
|
||||
end
|
||||
end
|
||||
|
||||
switchcase["projects"] = function()
|
||||
tex.print("\\section*{" .. value["title"] .. "}")
|
||||
tex.print(value["description"] .. "\\\\\\hrule")
|
||||
for key, value in pairs(value["projects"]) do
|
||||
tex.print("\\begin{cvproj}{" .. value["name"] .. "}{" .. value["url"] .. "}{" .. value["tagline"] .. "}")
|
||||
tex.print("\\begin{markdown}")
|
||||
tex.print(value["description"])
|
||||
tex.print("\\end{markdown}")
|
||||
tex.print("\\end{cvproj}")
|
||||
end
|
||||
end
|
||||
|
||||
if switchcase[case] == nil then
|
||||
tex.print("type " .. case .. "dont exist \\\\\\\\")
|
||||
else
|
||||
switchcase[case]()
|
||||
end
|
||||
end
|
||||
|
||||
function render()
|
||||
for key, value in pairs(jsondata) do
|
||||
switch(value["data"], value["type"])
|
||||
end
|
||||
end
|
||||
16
latex/header.lua
Normal file
16
latex/header.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
require("lualibs.lua")
|
||||
local file = io.open('../package.json')
|
||||
local jsonstring = file:read('*a')
|
||||
file:close()
|
||||
jsondata = utilities.json.tolua(jsonstring)
|
||||
|
||||
function addHeader()
|
||||
if jsondata["watermark"] ~= nil and jsondata["watermark"] ~= false then
|
||||
tex.print("\\usepackage{draftwatermark}")
|
||||
tex.print("\\SetWatermarkLightness{0.9}")
|
||||
tex.print("\\SetWatermarkScale{6}")
|
||||
if jsondata["watermark"] ~= true then
|
||||
tex.print("\\SetWatermarkText{" .. jsondata["watermark"] .. "}")
|
||||
end
|
||||
end
|
||||
end
|
||||
162
latex/header.tex
Normal file
162
latex/header.tex
Normal file
@@ -0,0 +1,162 @@
|
||||
%\usepackage{showframe}
|
||||
\usepackage{tex4ebook}
|
||||
\usepackage{pagecolor}
|
||||
\usepackage{paracol}
|
||||
\usepackage{kantlipsum}
|
||||
\usepackage{multicol}
|
||||
\usepackage{xifthen}
|
||||
\usepackage{tcolorbox}
|
||||
\usepackage{wrapfig}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{fancyhdr}
|
||||
\usepackage{luacode}
|
||||
%\pagecolor{yellow!5!orange!2!white}
|
||||
\setlength{\columnseprule}{0.1pt}
|
||||
\newcommand{\ifequals}[3]{\ifthenelse{\equal{#1}{#2}}{#3}{}}
|
||||
\newcommand{\case}[2]{#1 #2}
|
||||
\newenvironment{switch}[1]{\renewcommand{\case}{\ifequals{#1}}}{}
|
||||
\usepackage{markdown}
|
||||
\markdownSetup{
|
||||
footnotes = true,
|
||||
renderers = {
|
||||
link = {#1}, % Render a link as the link label.
|
||||
emphasis = {\emph{#1}}, % Render emphasis using `\emph`.
|
||||
}
|
||||
}
|
||||
|
||||
\newenvironment{columns}{
|
||||
\ifnum\columncount>1
|
||||
\begin{multicols}{\columncount}
|
||||
\fi
|
||||
}{
|
||||
\ifnum\columncount>1
|
||||
\end{multicols}
|
||||
\fi
|
||||
\vspace{0.5cm}
|
||||
\hrule
|
||||
}
|
||||
|
||||
\newenvironment{cvskills}{
|
||||
\noindent\begin{minipage}{\textwidth}
|
||||
\ifnum\skillcolumncount>1
|
||||
\begin{multicols}{\skillcolumncount}
|
||||
\fi
|
||||
}{
|
||||
\ifnum\skillcolumncount>1
|
||||
\end{multicols}
|
||||
\fi
|
||||
\vspace{0.5cm}
|
||||
\hrule
|
||||
\end{minipage}
|
||||
}
|
||||
|
||||
\newenvironment{cvtitle}[2]{
|
||||
\noindent\begin{minipage}{\textwidth}
|
||||
%{\Huge Curriculum Vitae\newline\large #1} \hfill{\large \mbox{#1} \includegraphics[height=3cm]{#2}}\\\\
|
||||
|
||||
\noindent\begin{minipage}{\textwidth - 3.2cm}
|
||||
\Huge Curriculum Vitae\newline\large #1
|
||||
\end{minipage}
|
||||
\noindent\begin{minipage}{3cm}
|
||||
\begin{flushright}
|
||||
\includegraphics[height=3cm]{#2}
|
||||
\end{flushright}
|
||||
\end{minipage}
|
||||
\vspace{0.5cm}
|
||||
\hrule
|
||||
\vspace{0.5cm}
|
||||
\ifnum\skillcolumncount>1
|
||||
\begin{multicols}{\skillcolumncount}
|
||||
\fi
|
||||
}{
|
||||
\ifnum\skillcolumncount>1
|
||||
\end{multicols}
|
||||
\fi
|
||||
\end{minipage}
|
||||
\hfill
|
||||
\begin{minipage}{\textwidth/3-2cm}
|
||||
\end{minipage}
|
||||
\vspace{1cm}
|
||||
\hrule
|
||||
}
|
||||
|
||||
\newenvironment{cvbox}[3]
|
||||
{
|
||||
\noindent
|
||||
%\begin{minipage}{\textwidth}
|
||||
|
||||
%\hrule
|
||||
\begin{columns}
|
||||
\noindent{\Large \textbf{#1}} \hfill {\small #2} \\
|
||||
\textit{#3}
|
||||
\ifnum\columncount>2
|
||||
\vfill\null\columnbreak
|
||||
\else
|
||||
\\\\
|
||||
\fi
|
||||
}
|
||||
{
|
||||
\end{columns}
|
||||
%\end{minipage}
|
||||
\vspace{0.5cm}
|
||||
}
|
||||
|
||||
\newcommand{\cvinfo}[2]{
|
||||
\noindent \textbf{#1}\dotfill#2\\
|
||||
}
|
||||
|
||||
\newcommand{\cvskill}[2]{
|
||||
\textbf{#1}\dotfill
|
||||
\textit{\begin{switch}{#2}
|
||||
\case{1}{Needs refresh}
|
||||
\case{2}{Needs refresh}
|
||||
\case{3}{Comfortable}
|
||||
\case{4}{Prefered}
|
||||
\case{5}{Prefered}
|
||||
\end{switch}}\\
|
||||
}
|
||||
|
||||
\newenvironment{cvexp}[4]
|
||||
{ \begin{cvbox}{#1}{#2 - #3}{#4} }
|
||||
{\end{cvbox}}
|
||||
|
||||
%\newenvironment{cvproj}[3]
|
||||
%{\begin{cvbox}{#1}{#2}{#3}}
|
||||
%{\end{cvbox}}
|
||||
|
||||
\newenvironment{cvproj}[3]
|
||||
{
|
||||
\noindent
|
||||
%\begin{minipage}{\textwidth}
|
||||
|
||||
%\hrule
|
||||
\begin{columns}
|
||||
\noindent{\Large \textbf{#1}} \\ {\small #3} \\
|
||||
{\tiny\textit{https://#2}}
|
||||
\ifnum\columncount>2
|
||||
\vfill\null\columnbreak
|
||||
\else
|
||||
\\\\
|
||||
\fi
|
||||
}
|
||||
{
|
||||
\end{columns}
|
||||
%\end{minipage}
|
||||
\vspace{0.5cm}
|
||||
}
|
||||
|
||||
\pagestyle{fancy}
|
||||
\fancyhf{}
|
||||
\rhead{Morten Olsen \today}
|
||||
\lhead{Curriculum Vitae}
|
||||
\rfoot{Page \thepage}
|
||||
|
||||
\directlua{dofile("header.lua")}
|
||||
\newcommand*{\addHeader}{\directlua{addHeader()}}
|
||||
\addHeader
|
||||
|
||||
\begin{document}
|
||||
\directlua{dofile("document.lua")}
|
||||
\newcommand*{\render}{\directlua{render()}}
|
||||
\render
|
||||
\end{document}
|
||||
1942
latex/markdown.lua
Normal file
1942
latex/markdown.lua
Normal file
File diff suppressed because it is too large
Load Diff
550
latex/markdown.sty
Normal file
550
latex/markdown.sty
Normal file
@@ -0,0 +1,550 @@
|
||||
%%
|
||||
%% This is file `markdown.sty',
|
||||
%% generated with the docstrip utility.
|
||||
%%
|
||||
%% The original source files were:
|
||||
%%
|
||||
%% markdown.dtx (with options: `latex')
|
||||
%%
|
||||
%% Copyright (C) 2017 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.
|
||||
%%
|
||||
\NeedsTeXFormat{LaTeX2e}%
|
||||
\RequirePackage{keyval}
|
||||
\RequirePackage{url}
|
||||
\RequirePackage{graphicx}
|
||||
\RequirePackage{ifthen}
|
||||
\RequirePackage{fancyvrb}
|
||||
\RequirePackage{csvsimple}
|
||||
\newenvironment{markdown}\relax\relax
|
||||
\newenvironment{markdown*}[1]\relax\relax
|
||||
\newcommand\markdownSetup[1]{%
|
||||
\setkeys{markdownOptions}{#1}}%
|
||||
\define@key{markdownOptions}{helperScriptFileName}{%
|
||||
\def\markdownOptionHelperScriptFileName{#1}}%
|
||||
\define@key{markdownOptions}{inputTempFileName}{%
|
||||
\def\markdownOptionInputTempFileName{#1}}%
|
||||
\define@key{markdownOptions}{outputTempFileName}{%
|
||||
\def\markdownOptionOutputTempFileName{#1}}%
|
||||
\define@key{markdownOptions}{errorTempFileName}{%
|
||||
\def\markdownOptionErrorTempFileName{#1}}%
|
||||
\define@key{markdownOptions}{cacheDir}{%
|
||||
\def\markdownOptionCacheDir{#1}}%
|
||||
\define@key{markdownOptions}{outputDir}{%
|
||||
\def\markdownOptionOutputDir{#1}}%
|
||||
\define@key{markdownOptions}{blankBeforeBlockquote}[true]{%
|
||||
\def\markdownOptionBlankBeforeBlockquote{#1}}%
|
||||
\define@key{markdownOptions}{blankBeforeCodeFence}[true]{%
|
||||
\def\markdownOptionBlankBeforeCodeFence{#1}}%
|
||||
\define@key{markdownOptions}{blankBeforeHeading}[true]{%
|
||||
\def\markdownOptionBlankBeforeHeading{#1}}%
|
||||
\define@key{markdownOptions}{breakableBlockquotes}[true]{%
|
||||
\def\markdownOptionBreakableBlockquotes{#1}}%
|
||||
\define@key{markdownOptions}{citations}[true]{%
|
||||
\def\markdownOptionCitations{#1}}%
|
||||
\define@key{markdownOptions}{citationNbsps}[true]{%
|
||||
\def\markdownOptionCitationNbsps{#1}}%
|
||||
\define@key{markdownOptions}{contentBlocks}[true]{%
|
||||
\def\markdownOptionContentBlocks{#1}}%
|
||||
\define@key{markdownOptions}{codeSpans}[true]{%
|
||||
\def\markdownOptionCodeSpans{#1}}%
|
||||
\define@key{markdownOptions}{contentBlocksLanguageMap}{%
|
||||
\def\markdownOptionContentBlocksLanguageMap{#1}}%
|
||||
\define@key{markdownOptions}{definitionLists}[true]{%
|
||||
\def\markdownOptionDefinitionLists{#1}}%
|
||||
\define@key{markdownOptions}{footnotes}[true]{%
|
||||
\def\markdownOptionFootnotes{#1}}%
|
||||
\define@key{markdownOptions}{fencedCode}[true]{%
|
||||
\def\markdownOptionFencedCode{#1}}%
|
||||
\define@key{markdownOptions}{hashEnumerators}[true]{%
|
||||
\def\markdownOptionHashEnumerators{#1}}%
|
||||
\define@key{markdownOptions}{html}[true]{%
|
||||
\def\markdownOptionHtml{#1}}%
|
||||
\define@key{markdownOptions}{hybrid}[true]{%
|
||||
\def\markdownOptionHybrid{#1}}%
|
||||
\define@key{markdownOptions}{inlineFootnotes}[true]{%
|
||||
\def\markdownOptionInlineFootnotes{#1}}%
|
||||
\define@key{markdownOptions}{preserveTabs}[true]{%
|
||||
\def\markdownOptionPreserveTabs{#1}}%
|
||||
\define@key{markdownOptions}{smartEllipses}[true]{%
|
||||
\def\markdownOptionSmartEllipses{#1}}%
|
||||
\define@key{markdownOptions}{startNumber}[true]{%
|
||||
\def\markdownOptionStartNumber{#1}}%
|
||||
\define@key{markdownOptions}{tightLists}[true]{%
|
||||
\def\markdownOptionTightLists{#1}}%
|
||||
\define@key{markdownOptions}{underscores}[true]{%
|
||||
\def\markdownOptionUnderscores{#1}}%
|
||||
\define@key{markdownRenderers}{interblockSeparator}{%
|
||||
\renewcommand\markdownRendererInterblockSeparator{#1}}%
|
||||
\define@key{markdownRenderers}{lineBreak}{%
|
||||
\renewcommand\markdownRendererLineBreak{#1}}%
|
||||
\define@key{markdownRenderers}{ellipsis}{%
|
||||
\renewcommand\markdownRendererEllipsis{#1}}%
|
||||
\define@key{markdownRenderers}{nbsp}{%
|
||||
\renewcommand\markdownRendererNbsp{#1}}%
|
||||
\define@key{markdownRenderers}{leftBrace}{%
|
||||
\renewcommand\markdownRendererLeftBrace{#1}}%
|
||||
\define@key{markdownRenderers}{rightBrace}{%
|
||||
\renewcommand\markdownRendererRightBrace{#1}}%
|
||||
\define@key{markdownRenderers}{dollarSign}{%
|
||||
\renewcommand\markdownRendererDollarSign{#1}}%
|
||||
\define@key{markdownRenderers}{percentSign}{%
|
||||
\renewcommand\markdownRendererPercentSign{#1}}%
|
||||
\define@key{markdownRenderers}{ampersand}{%
|
||||
\renewcommand\markdownRendererAmpersand{#1}}%
|
||||
\define@key{markdownRenderers}{underscore}{%
|
||||
\renewcommand\markdownRendererUnderscore{#1}}%
|
||||
\define@key{markdownRenderers}{hash}{%
|
||||
\renewcommand\markdownRendererHash{#1}}%
|
||||
\define@key{markdownRenderers}{circumflex}{%
|
||||
\renewcommand\markdownRendererCircumflex{#1}}%
|
||||
\define@key{markdownRenderers}{backslash}{%
|
||||
\renewcommand\markdownRendererBackslash{#1}}%
|
||||
\define@key{markdownRenderers}{tilde}{%
|
||||
\renewcommand\markdownRendererTilde{#1}}%
|
||||
\define@key{markdownRenderers}{pipe}{%
|
||||
\renewcommand\markdownRendererPipe{#1}}%
|
||||
\define@key{markdownRenderers}{codeSpan}{%
|
||||
\renewcommand\markdownRendererCodeSpan[1]{#1}}%
|
||||
\define@key{markdownRenderers}{link}{%
|
||||
\renewcommand\markdownRendererLink[4]{#1}}%
|
||||
\define@key{markdownRenderers}{contentBlock}{%
|
||||
\renewcommand\markdownRendererContentBlock[4]{#1}}%
|
||||
\define@key{markdownRenderers}{contentBlockOnlineImage}{%
|
||||
\renewcommand\markdownRendererContentBlockOnlineImage[4]{#1}}%
|
||||
\define@key{markdownRenderers}{contentBlockCode}{%
|
||||
\renewcommand\markdownRendererContentBlockCode[5]{#1}}%
|
||||
\define@key{markdownRenderers}{image}{%
|
||||
\renewcommand\markdownRendererImage[4]{#1}}%
|
||||
\define@key{markdownRenderers}{ulBegin}{%
|
||||
\renewcommand\markdownRendererUlBegin{#1}}%
|
||||
\define@key{markdownRenderers}{ulBeginTight}{%
|
||||
\renewcommand\markdownRendererUlBeginTight{#1}}%
|
||||
\define@key{markdownRenderers}{ulItem}{%
|
||||
\renewcommand\markdownRendererUlItem{#1}}%
|
||||
\define@key{markdownRenderers}{ulItemEnd}{%
|
||||
\renewcommand\markdownRendererUlItemEnd{#1}}%
|
||||
\define@key{markdownRenderers}{ulEnd}{%
|
||||
\renewcommand\markdownRendererUlEnd{#1}}%
|
||||
\define@key{markdownRenderers}{ulEndTight}{%
|
||||
\renewcommand\markdownRendererUlEndTight{#1}}%
|
||||
\define@key{markdownRenderers}{olBegin}{%
|
||||
\renewcommand\markdownRendererOlBegin{#1}}%
|
||||
\define@key{markdownRenderers}{olBeginTight}{%
|
||||
\renewcommand\markdownRendererOlBeginTight{#1}}%
|
||||
\define@key{markdownRenderers}{olItem}{%
|
||||
\renewcommand\markdownRendererOlItem{#1}}%
|
||||
\define@key{markdownRenderers}{olItemWithNumber}{%
|
||||
\renewcommand\markdownRendererOlItemWithNumber[1]{#1}}%
|
||||
\define@key{markdownRenderers}{olItemEnd}{%
|
||||
\renewcommand\markdownRendererOlItemEnd{#1}}%
|
||||
\define@key{markdownRenderers}{olEnd}{%
|
||||
\renewcommand\markdownRendererOlEnd{#1}}%
|
||||
\define@key{markdownRenderers}{olEndTight}{%
|
||||
\renewcommand\markdownRendererOlEndTight{#1}}%
|
||||
\define@key{markdownRenderers}{dlBegin}{%
|
||||
\renewcommand\markdownRendererDlBegin{#1}}%
|
||||
\define@key{markdownRenderers}{dlBeginTight}{%
|
||||
\renewcommand\markdownRendererDlBeginTight{#1}}%
|
||||
\define@key{markdownRenderers}{dlItem}{%
|
||||
\renewcommand\markdownRendererDlItem[1]{#1}}%
|
||||
\define@key{markdownRenderers}{dlItemEnd}{%
|
||||
\renewcommand\markdownRendererDlItemEnd{#1}}%
|
||||
\define@key{markdownRenderers}{dlDefinitionBegin}{%
|
||||
\renewcommand\markdownRendererDlDefinitionBegin{#1}}%
|
||||
\define@key{markdownRenderers}{dlDefinitionEnd}{%
|
||||
\renewcommand\markdownRendererDlDefinitionEnd{#1}}%
|
||||
\define@key{markdownRenderers}{dlEnd}{%
|
||||
\renewcommand\markdownRendererDlEnd{#1}}%
|
||||
\define@key{markdownRenderers}{dlEndTight}{%
|
||||
\renewcommand\markdownRendererDlEndTight{#1}}%
|
||||
\define@key{markdownRenderers}{emphasis}{%
|
||||
\renewcommand\markdownRendererEmphasis[1]{#1}}%
|
||||
\define@key{markdownRenderers}{strongEmphasis}{%
|
||||
\renewcommand\markdownRendererStrongEmphasis[1]{#1}}%
|
||||
\define@key{markdownRenderers}{blockQuoteBegin}{%
|
||||
\renewcommand\markdownRendererBlockQuoteBegin{#1}}%
|
||||
\define@key{markdownRenderers}{blockQuoteEnd}{%
|
||||
\renewcommand\markdownRendererBlockQuoteEnd{#1}}%
|
||||
\define@key{markdownRenderers}{inputVerbatim}{%
|
||||
\renewcommand\markdownRendererInputVerbatim[1]{#1}}%
|
||||
\define@key{markdownRenderers}{inputFencedCode}{%
|
||||
\renewcommand\markdownRendererInputFencedCode[2]{#1}}%
|
||||
\define@key{markdownRenderers}{headingOne}{%
|
||||
\renewcommand\markdownRendererHeadingOne[1]{#1}}%
|
||||
\define@key{markdownRenderers}{headingTwo}{%
|
||||
\renewcommand\markdownRendererHeadingTwo[1]{#1}}%
|
||||
\define@key{markdownRenderers}{headingThree}{%
|
||||
\renewcommand\markdownRendererHeadingThree[1]{#1}}%
|
||||
\define@key{markdownRenderers}{headingFour}{%
|
||||
\renewcommand\markdownRendererHeadingFour[1]{#1}}%
|
||||
\define@key{markdownRenderers}{headingFive}{%
|
||||
\renewcommand\markdownRendererHeadingFive[1]{#1}}%
|
||||
\define@key{markdownRenderers}{headingSix}{%
|
||||
\renewcommand\markdownRendererHeadingSix[1]{#1}}%
|
||||
\define@key{markdownRenderers}{horizontalRule}{%
|
||||
\renewcommand\markdownRendererHorizontalRule{#1}}%
|
||||
\define@key{markdownRenderers}{footnote}{%
|
||||
\renewcommand\markdownRendererFootnote[1]{#1}}%
|
||||
\define@key{markdownRenderers}{cite}{%
|
||||
\renewcommand\markdownRendererCite[1]{#1}}%
|
||||
\define@key{markdownRenderers}{textCite}{%
|
||||
\renewcommand\markdownRendererTextCite[1]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{interblockSeparator}{%
|
||||
\renewcommand\markdownRendererInterblockSeparatorPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{lineBreak}{%
|
||||
\renewcommand\markdownRendererLineBreakPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{ellipsis}{%
|
||||
\renewcommand\markdownRendererEllipsisPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{nbsp}{%
|
||||
\renewcommand\markdownRendererNbspPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{leftBrace}{%
|
||||
\renewcommand\markdownRendererLeftBracePrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{rightBrace}{%
|
||||
\renewcommand\markdownRendererRightBracePrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{dollarSign}{%
|
||||
\renewcommand\markdownRendererDollarSignPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{percentSign}{%
|
||||
\renewcommand\markdownRendererPercentSignPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{ampersand}{%
|
||||
\renewcommand\markdownRendererAmpersandPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{underscore}{%
|
||||
\renewcommand\markdownRendererUnderscorePrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{hash}{%
|
||||
\renewcommand\markdownRendererHashPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{circumflex}{%
|
||||
\renewcommand\markdownRendererCircumflexPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{backslash}{%
|
||||
\renewcommand\markdownRendererBackslashPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{tilde}{%
|
||||
\renewcommand\markdownRendererTildePrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{pipe}{%
|
||||
\renewcommand\markdownRendererPipePrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{codeSpan}{%
|
||||
\renewcommand\markdownRendererCodeSpanPrototype[1]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{link}{%
|
||||
\renewcommand\markdownRendererLinkPrototype[4]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{contentBlock}{%
|
||||
\renewcommand\markdownRendererContentBlockPrototype[4]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{contentBlockOnlineImage}{%
|
||||
\renewcommand\markdownRendererContentBlockOnlineImagePrototype[4]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{contentBlockCode}{%
|
||||
\renewcommand\markdownRendererContentBlockCodePrototype[5]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{image}{%
|
||||
\renewcommand\markdownRendererImagePrototype[4]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{ulBegin}{%
|
||||
\renewcommand\markdownRendererUlBeginPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{ulBeginTight}{%
|
||||
\renewcommand\markdownRendererUlBeginTightPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{ulItem}{%
|
||||
\renewcommand\markdownRendererUlItemPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{ulItemEnd}{%
|
||||
\renewcommand\markdownRendererUlItemEndPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{ulEnd}{%
|
||||
\renewcommand\markdownRendererUlEndPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{ulEndTight}{%
|
||||
\renewcommand\markdownRendererUlEndTightPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{olBegin}{%
|
||||
\renewcommand\markdownRendererOlBeginPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{olBeginTight}{%
|
||||
\renewcommand\markdownRendererOlBeginTightPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{olItem}{%
|
||||
\renewcommand\markdownRendererOlItemPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{olItemWithNumber}{%
|
||||
\renewcommand\markdownRendererOlItemWithNumberPrototype[1]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{olItemEnd}{%
|
||||
\renewcommand\markdownRendererOlItemEndPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{olEnd}{%
|
||||
\renewcommand\markdownRendererOlEndPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{olEndTight}{%
|
||||
\renewcommand\markdownRendererOlEndTightPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{dlBegin}{%
|
||||
\renewcommand\markdownRendererDlBeginPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{dlBeginTight}{%
|
||||
\renewcommand\markdownRendererDlBeginTightPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{dlItem}{%
|
||||
\renewcommand\markdownRendererDlItemPrototype[1]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{dlItemEnd}{%
|
||||
\renewcommand\markdownRendererDlItemEndPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{dlDefinitionBegin}{%
|
||||
\renewcommand\markdownRendererDlDefinitionBeginPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{dlDefinitionEnd}{%
|
||||
\renewcommand\markdownRendererDlDefinitionEndPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{dlEnd}{%
|
||||
\renewcommand\markdownRendererDlEndPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{dlEndTight}{%
|
||||
\renewcommand\markdownRendererDlEndTightPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{emphasis}{%
|
||||
\renewcommand\markdownRendererEmphasisPrototype[1]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{strongEmphasis}{%
|
||||
\renewcommand\markdownRendererStrongEmphasisPrototype[1]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{blockQuoteBegin}{%
|
||||
\renewcommand\markdownRendererBlockQuoteBeginPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{blockQuoteEnd}{%
|
||||
\renewcommand\markdownRendererBlockQuoteEndPrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{inputVerbatim}{%
|
||||
\renewcommand\markdownRendererInputVerbatimPrototype[1]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{inputFencedCode}{%
|
||||
\renewcommand\markdownRendererInputFencedCodePrototype[2]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{headingOne}{%
|
||||
\renewcommand\markdownRendererHeadingOnePrototype[1]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{headingTwo}{%
|
||||
\renewcommand\markdownRendererHeadingTwoPrototype[1]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{headingThree}{%
|
||||
\renewcommand\markdownRendererHeadingThreePrototype[1]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{headingFour}{%
|
||||
\renewcommand\markdownRendererHeadingFourPrototype[1]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{headingFive}{%
|
||||
\renewcommand\markdownRendererHeadingFivePrototype[1]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{headingSix}{%
|
||||
\renewcommand\markdownRendererHeadingSixPrototype[1]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{horizontalRule}{%
|
||||
\renewcommand\markdownRendererHorizontalRulePrototype{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{footnote}{%
|
||||
\renewcommand\markdownRendererFootnotePrototype[1]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{cite}{%
|
||||
\renewcommand\markdownRendererCitePrototype[1]{#1}}%
|
||||
\define@key{markdownRendererPrototypes}{textCite}{%
|
||||
\renewcommand\markdownRendererTextCitePrototype[1]{#1}}%
|
||||
\input 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
|
||||
\markdownSetup{#1}%
|
||||
\markdownInputPlainTeX{#2}%
|
||||
\endgroup}%
|
||||
\renewenvironment{markdown}{%
|
||||
\markdownReadAndConvert@markdown{}}\relax
|
||||
\renewenvironment{markdown*}[1]{%
|
||||
\markdownSetup{#1}%
|
||||
\markdownReadAndConvert@markdown*}\relax
|
||||
\begingroup
|
||||
\catcode`\|=0\catcode`\<=1\catcode`\>=2%
|
||||
\catcode`\\=12|catcode`|{=12|catcode`|}=12%
|
||||
|gdef|markdownReadAndConvert@markdown#1<%
|
||||
|markdownReadAndConvert<\end{markdown#1}>%
|
||||
<|end<markdown#1>>>%
|
||||
|endgroup
|
||||
\DeclareOption*{%
|
||||
\expandafter\markdownSetup\expandafter{\CurrentOption}}%
|
||||
\ProcessOptions\relax
|
||||
\define@key{markdownOptions}{renderers}{%
|
||||
\setkeys{markdownRenderers}{#1}%
|
||||
\def\KV@prefix{KV@markdownOptions@}}%
|
||||
\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
|
||||
\@ifpackageloaded{paralist}{
|
||||
\markdownSetup{rendererPrototypes={
|
||||
ulBeginTight = {\begin{compactitem}},
|
||||
ulEndTight = {\end{compactitem}},
|
||||
olBeginTight = {\begin{compactenum}},
|
||||
olEndTight = {\end{compactenum}},
|
||||
dlBeginTight = {\begin{compactdesc}},
|
||||
dlEndTight = {\end{compactdesc}}}}
|
||||
}{
|
||||
\markdownSetup{rendererPrototypes={
|
||||
ulBeginTight = {\markdownRendererUlBegin},
|
||||
ulEndTight = {\markdownRendererUlEnd},
|
||||
olBeginTight = {\markdownRendererOlBegin},
|
||||
olEndTight = {\markdownRendererOlEnd},
|
||||
dlBeginTight = {\markdownRendererDlBegin},
|
||||
dlEndTight = {\markdownRendererDlEnd}}}}
|
||||
\markdownSetup{rendererPrototypes={
|
||||
lineBreak = {\\},
|
||||
leftBrace = {\textbraceleft},
|
||||
rightBrace = {\textbraceright},
|
||||
dollarSign = {\textdollar},
|
||||
underscore = {\textunderscore},
|
||||
circumflex = {\textasciicircum},
|
||||
backslash = {\textbackslash},
|
||||
tilde = {\textasciitilde},
|
||||
pipe = {\textbar},
|
||||
codeSpan = {\texttt{#1}},
|
||||
link = {#1\footnote{\ifx\empty#4\empty\else#4:
|
||||
\fi\texttt<\url{#3}\texttt>}},
|
||||
contentBlock = {%
|
||||
\ifthenelse{\equal{#1}{csv}}{%
|
||||
\begin{table}%
|
||||
\begin{center}%
|
||||
\csvautotabular{#3}%
|
||||
\end{center}
|
||||
\ifx\empty#4\empty\else
|
||||
\caption{#4}%
|
||||
\fi
|
||||
\label{tab:#1}%
|
||||
\end{table}}{%
|
||||
\markdownInput{#3}}},
|
||||
image = {%
|
||||
\begin{figure}%
|
||||
\begin{center}%
|
||||
\includegraphics{#3}%
|
||||
\end{center}%
|
||||
\ifx\empty#4\empty\else
|
||||
\caption{#4}%
|
||||
\fi
|
||||
\label{fig:#1}%
|
||||
\end{figure}},
|
||||
ulBegin = {\begin{itemize}},
|
||||
ulItem = {\item},
|
||||
ulEnd = {\end{itemize}},
|
||||
olBegin = {\begin{enumerate}},
|
||||
olItem = {\item},
|
||||
olItemWithNumber = {\item[#1.]},
|
||||
olEnd = {\end{enumerate}},
|
||||
dlBegin = {\begin{description}},
|
||||
dlItem = {\item[#1]},
|
||||
dlEnd = {\end{description}},
|
||||
emphasis = {\emph{#1}},
|
||||
blockQuoteBegin = {\begin{quotation}},
|
||||
blockQuoteEnd = {\end{quotation}},
|
||||
inputVerbatim = {\VerbatimInput{#1}},
|
||||
inputFencedCode = {%
|
||||
\ifx\relax#2\relax
|
||||
\VerbatimInput{#1}%
|
||||
\else
|
||||
\ifx\minted@jobname\undefined
|
||||
\ifx\lst@version\undefined
|
||||
\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
|
||||
\markdownSetup{rendererPrototypes = {
|
||||
headingOne = {\section{#1}},
|
||||
headingTwo = {\subsection{#1}},
|
||||
headingThree = {\subsubsection{#1}},
|
||||
headingFour = {\paragraph{#1}},
|
||||
headingFive = {\subparagraph{#1}}}}
|
||||
\else
|
||||
\markdownSetup{rendererPrototypes = {
|
||||
headingOne = {\chapter{#1}},
|
||||
headingTwo = {\section{#1}},
|
||||
headingThree = {\subsection{#1}},
|
||||
headingFour = {\subsubsection{#1}},
|
||||
headingFive = {\paragraph{#1}},
|
||||
headingSix = {\subparagraph{#1}}}}
|
||||
\fi
|
||||
\newcount\markdownLaTeXCitationsCounter
|
||||
|
||||
\def\markdownLaTeXBasicCitations#1#2#3#4{%
|
||||
\advance\markdownLaTeXCitationsCounter by 1\relax
|
||||
\ifx\relax#2\relax\else#2~\fi\cite[#3]{#4}%
|
||||
\ifnum\markdownLaTeXCitationsCounter>\markdownLaTeXCitationsTotal\relax
|
||||
\expandafter\@gobble
|
||||
\fi\markdownLaTeXBasicCitations}
|
||||
\let\markdownLaTeXBasicTextCitations\markdownLaTeXBasicCitations
|
||||
|
||||
\def\markdownLaTeXBibLaTeXCitations#1#2#3#4#5{%
|
||||
\advance\markdownLaTeXCitationsCounter by 1\relax
|
||||
\ifnum\markdownLaTeXCitationsCounter>\markdownLaTeXCitationsTotal\relax
|
||||
\autocites#1[#3][#4]{#5}%
|
||||
\expandafter\@gobbletwo
|
||||
\fi\markdownLaTeXBibLaTeXCitations{#1[#3][#4]{#5}}}
|
||||
\def\markdownLaTeXBibLaTeXTextCitations#1#2#3#4#5{%
|
||||
\advance\markdownLaTeXCitationsCounter by 1\relax
|
||||
\ifnum\markdownLaTeXCitationsCounter>\markdownLaTeXCitationsTotal\relax
|
||||
\textcites#1[#3][#4]{#5}%
|
||||
\expandafter\@gobbletwo
|
||||
\fi\markdownLaTeXBibLaTeXTextCitations{#1[#3][#4]{#5}}}
|
||||
|
||||
\markdownSetup{rendererPrototypes = {
|
||||
cite = {%
|
||||
\markdownLaTeXCitationsCounter=1%
|
||||
\def\markdownLaTeXCitationsTotal{#1}%
|
||||
\ifx\autocites\undefined
|
||||
\expandafter
|
||||
\markdownLaTeXBasicCitations
|
||||
\else
|
||||
\expandafter\expandafter\expandafter
|
||||
\markdownLaTeXBibLaTeXCitations
|
||||
\expandafter{\expandafter}%
|
||||
\fi},
|
||||
textCite = {%
|
||||
\markdownLaTeXCitationsCounter=1%
|
||||
\def\markdownLaTeXCitationsTotal{#1}%
|
||||
\ifx\textcites\undefined
|
||||
\expandafter
|
||||
\markdownLaTeXBasicTextCitations
|
||||
\else
|
||||
\expandafter\expandafter\expandafter
|
||||
\markdownLaTeXBibLaTeXTextCitations
|
||||
\expandafter{\expandafter}%
|
||||
\fi}}}
|
||||
\newcommand\markdownMakeOther{%
|
||||
\count0=128\relax
|
||||
\loop
|
||||
\catcode\count0=11\relax
|
||||
\advance\count0 by 1\relax
|
||||
\ifnum\count0<256\repeat}%
|
||||
\endinput
|
||||
%%
|
||||
%% End of file `markdown.sty'.
|
||||
550
latex/markdown.tex
Normal file
550
latex/markdown.tex
Normal file
@@ -0,0 +1,550 @@
|
||||
%%
|
||||
%% This is file `markdown.tex',
|
||||
%% generated with the docstrip utility.
|
||||
%%
|
||||
%% The original source files were:
|
||||
%%
|
||||
%% markdown.dtx (with options: `tex')
|
||||
%%
|
||||
%% Copyright (C) 2017 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.
|
||||
%%
|
||||
\def\markdownLastModified{2017/09/12}%
|
||||
\def\markdownVersion{2.5.4}%
|
||||
\let\markdownBegin\relax
|
||||
\let\markdownEnd\relax
|
||||
\let\markdownInput\relax
|
||||
\def\markdownOptionHelperScriptFileName{\jobname.markdown.lua}%
|
||||
\def\markdownOptionInputTempFileName{\jobname.markdown.in}%
|
||||
\def\markdownOptionOutputTempFileName{\jobname.markdown.out}%
|
||||
\def\markdownOptionErrorTempFileName{\jobname.markdown.err}%
|
||||
\def\markdownOptionCacheDir{\markdownOptionOutputDir/_markdown_\jobname}%
|
||||
\def\markdownOptionOutputDir{.}%
|
||||
\let\markdownOptionBlankBeforeBlockquote\undefined
|
||||
\let\markdownOptionBlankBeforeCodeFence\undefined
|
||||
\let\markdownOptionBlankBeforeHeading\undefined
|
||||
\let\markdownOptionBreakableBlockquotes\undefined
|
||||
\let\markdownOptionCitations\undefined
|
||||
\let\markdownOptionCitationNbsps\undefined
|
||||
\let\markdownOptionContentBlocks\undefined
|
||||
\let\markdownOptionContentBlocksLanguageMap\undefined
|
||||
\let\markdownOptionDefinitionLists\undefined
|
||||
\let\markdownOptionFootnotes\undefined
|
||||
\let\markdownOptionFencedCode\undefined
|
||||
\let\markdownOptionHashEnumerators\undefined
|
||||
\let\markdownOptionHtml\undefined
|
||||
\let\markdownOptionHybrid\undefined
|
||||
\let\markdownOptionInlineFootnotes\undefined
|
||||
\let\markdownOptionPreserveTabs\undefined
|
||||
\let\markdownOptionSmartEllipses\undefined
|
||||
\let\markdownOptionStartNumber\undefined
|
||||
\let\markdownOptionTightLists\undefined
|
||||
\def\markdownRendererInterblockSeparator{%
|
||||
\markdownRendererInterblockSeparatorPrototype}%
|
||||
\def\markdownRendererLineBreak{%
|
||||
\markdownRendererLineBreakPrototype}%
|
||||
\def\markdownRendererEllipsis{%
|
||||
\markdownRendererEllipsisPrototype}%
|
||||
\def\markdownRendererNbsp{%
|
||||
\markdownRendererNbspPrototype}%
|
||||
\def\markdownRendererLeftBrace{%
|
||||
\markdownRendererLeftBracePrototype}%
|
||||
\def\markdownRendererRightBrace{%
|
||||
\markdownRendererRightBracePrototype}%
|
||||
\def\markdownRendererDollarSign{%
|
||||
\markdownRendererDollarSignPrototype}%
|
||||
\def\markdownRendererPercentSign{%
|
||||
\markdownRendererPercentSignPrototype}%
|
||||
\def\markdownRendererAmpersand{%
|
||||
\markdownRendererAmpersandPrototype}%
|
||||
\def\markdownRendererUnderscore{%
|
||||
\markdownRendererUnderscorePrototype}%
|
||||
\def\markdownRendererHash{%
|
||||
\markdownRendererHashPrototype}%
|
||||
\def\markdownRendererCircumflex{%
|
||||
\markdownRendererCircumflexPrototype}%
|
||||
\def\markdownRendererBackslash{%
|
||||
\markdownRendererBackslashPrototype}%
|
||||
\def\markdownRendererTilde{%
|
||||
\markdownRendererTildePrototype}%
|
||||
\def\markdownRendererPipe{%
|
||||
\markdownRendererPipePrototype}%
|
||||
\def\markdownRendererCodeSpan{%
|
||||
\markdownRendererCodeSpanPrototype}%
|
||||
\def\markdownRendererLink{%
|
||||
\markdownRendererLinkPrototype}%
|
||||
\def\markdownRendererImage{%
|
||||
\markdownRendererImagePrototype}%
|
||||
\def\markdownRendererContentBlock{%
|
||||
\markdownRendererContentBlockPrototype}%
|
||||
\def\markdownRendererContentBlockOnlineImage{%
|
||||
\markdownRendererContentBlockOnlineImagePrototype}%
|
||||
\def\markdownRendererContentBlockCode{%
|
||||
\markdownRendererContentBlockCodePrototype}%
|
||||
\def\markdownRendererUlBegin{%
|
||||
\markdownRendererUlBeginPrototype}%
|
||||
\def\markdownRendererUlBeginTight{%
|
||||
\markdownRendererUlBeginTightPrototype}%
|
||||
\def\markdownRendererUlItem{%
|
||||
\markdownRendererUlItemPrototype}%
|
||||
\def\markdownRendererUlItemEnd{%
|
||||
\markdownRendererUlItemEndPrototype}%
|
||||
\def\markdownRendererUlEnd{%
|
||||
\markdownRendererUlEndPrototype}%
|
||||
\def\markdownRendererUlEndTight{%
|
||||
\markdownRendererUlEndTightPrototype}%
|
||||
\def\markdownRendererOlBegin{%
|
||||
\markdownRendererOlBeginPrototype}%
|
||||
\def\markdownRendererOlBeginTight{%
|
||||
\markdownRendererOlBeginTightPrototype}%
|
||||
\def\markdownRendererOlItem{%
|
||||
\markdownRendererOlItemPrototype}%
|
||||
\def\markdownRendererOlItemEnd{%
|
||||
\markdownRendererOlItemEndPrototype}%
|
||||
\def\markdownRendererOlItemWithNumber{%
|
||||
\markdownRendererOlItemWithNumberPrototype}%
|
||||
\def\markdownRendererOlEnd{%
|
||||
\markdownRendererOlEndPrototype}%
|
||||
\def\markdownRendererOlEndTight{%
|
||||
\markdownRendererOlEndTightPrototype}%
|
||||
\def\markdownRendererDlBegin{%
|
||||
\markdownRendererDlBeginPrototype}%
|
||||
\def\markdownRendererDlBeginTight{%
|
||||
\markdownRendererDlBeginTightPrototype}%
|
||||
\def\markdownRendererDlItem{%
|
||||
\markdownRendererDlItemPrototype}%
|
||||
\def\markdownRendererDlItemEnd{%
|
||||
\markdownRendererDlItemEndPrototype}%
|
||||
\def\markdownRendererDlDefinitionBegin{%
|
||||
\markdownRendererDlDefinitionBeginPrototype}%
|
||||
\def\markdownRendererDlDefinitionEnd{%
|
||||
\markdownRendererDlDefinitionEndPrototype}%
|
||||
\def\markdownRendererDlEnd{%
|
||||
\markdownRendererDlEndPrototype}%
|
||||
\def\markdownRendererDlEndTight{%
|
||||
\markdownRendererDlEndTightPrototype}%
|
||||
\def\markdownRendererEmphasis{%
|
||||
\markdownRendererEmphasisPrototype}%
|
||||
\def\markdownRendererStrongEmphasis{%
|
||||
\markdownRendererStrongEmphasisPrototype}%
|
||||
\def\markdownRendererBlockQuoteBegin{%
|
||||
\markdownRendererBlockQuoteBeginPrototype}%
|
||||
\def\markdownRendererBlockQuoteEnd{%
|
||||
\markdownRendererBlockQuoteEndPrototype}%
|
||||
\def\markdownRendererInputVerbatim{%
|
||||
\markdownRendererInputVerbatimPrototype}%
|
||||
\def\markdownRendererInputFencedCode{%
|
||||
\markdownRendererInputFencedCodePrototype}%
|
||||
\def\markdownRendererHeadingOne{%
|
||||
\markdownRendererHeadingOnePrototype}%
|
||||
\def\markdownRendererHeadingTwo{%
|
||||
\markdownRendererHeadingTwoPrototype}%
|
||||
\def\markdownRendererHeadingThree{%
|
||||
\markdownRendererHeadingThreePrototype}%
|
||||
\def\markdownRendererHeadingFour{%
|
||||
\markdownRendererHeadingFourPrototype}%
|
||||
\def\markdownRendererHeadingFive{%
|
||||
\markdownRendererHeadingFivePrototype}%
|
||||
\def\markdownRendererHeadingSix{%
|
||||
\markdownRendererHeadingSixPrototype}%
|
||||
\def\markdownRendererHorizontalRule{%
|
||||
\markdownRendererHorizontalRulePrototype}%
|
||||
\def\markdownRendererFootnote{%
|
||||
\markdownRendererFootnotePrototype}%
|
||||
\def\markdownRendererCite{%
|
||||
\markdownRendererCitePrototype}%
|
||||
\def\markdownRendererTextCite{%
|
||||
\markdownRendererTextCitePrototype}%
|
||||
\def\markdownRendererInterblockSeparatorPrototype{}%
|
||||
\def\markdownRendererLineBreakPrototype{}%
|
||||
\def\markdownRendererEllipsisPrototype{}%
|
||||
\def\markdownRendererNbspPrototype{}%
|
||||
\def\markdownRendererLeftBracePrototype{}%
|
||||
\def\markdownRendererRightBracePrototype{}%
|
||||
\def\markdownRendererDollarSignPrototype{}%
|
||||
\def\markdownRendererPercentSignPrototype{}%
|
||||
\def\markdownRendererAmpersandPrototype{}%
|
||||
\def\markdownRendererUnderscorePrototype{}%
|
||||
\def\markdownRendererHashPrototype{}%
|
||||
\def\markdownRendererCircumflexPrototype{}%
|
||||
\def\markdownRendererBackslashPrototype{}%
|
||||
\def\markdownRendererTildePrototype{}%
|
||||
\def\markdownRendererPipePrototype{}%
|
||||
\def\markdownRendererCodeSpanPrototype#1{}%
|
||||
\def\markdownRendererLinkPrototype#1#2#3#4{}%
|
||||
\def\markdownRendererImagePrototype#1#2#3#4{}%
|
||||
\def\markdownRendererContentBlockPrototype#1#2#3#4{}%
|
||||
\def\markdownRendererContentBlockOnlineImagePrototype#1#2#3#4{}%
|
||||
\def\markdownRendererContentBlockCodePrototype#1#2#3#4{}%
|
||||
\def\markdownRendererUlBeginPrototype{}%
|
||||
\def\markdownRendererUlBeginTightPrototype{}%
|
||||
\def\markdownRendererUlItemPrototype{}%
|
||||
\def\markdownRendererUlItemEndPrototype{}%
|
||||
\def\markdownRendererUlEndPrototype{}%
|
||||
\def\markdownRendererUlEndTightPrototype{}%
|
||||
\def\markdownRendererOlBeginPrototype{}%
|
||||
\def\markdownRendererOlBeginTightPrototype{}%
|
||||
\def\markdownRendererOlItemPrototype{}%
|
||||
\def\markdownRendererOlItemWithNumberPrototype#1{}%
|
||||
\def\markdownRendererOlItemEndPrototype{}%
|
||||
\def\markdownRendererOlEndPrototype{}%
|
||||
\def\markdownRendererOlEndTightPrototype{}%
|
||||
\def\markdownRendererDlBeginPrototype{}%
|
||||
\def\markdownRendererDlBeginTightPrototype{}%
|
||||
\def\markdownRendererDlItemPrototype#1{}%
|
||||
\def\markdownRendererDlItemEndPrototype{}%
|
||||
\def\markdownRendererDlDefinitionBeginPrototype{}%
|
||||
\def\markdownRendererDlDefinitionEndPrototype{}%
|
||||
\def\markdownRendererDlEndPrototype{}%
|
||||
\def\markdownRendererDlEndTightPrototype{}%
|
||||
\def\markdownRendererEmphasisPrototype#1{}%
|
||||
\def\markdownRendererStrongEmphasisPrototype#1{}%
|
||||
\def\markdownRendererBlockQuoteBeginPrototype{}%
|
||||
\def\markdownRendererBlockQuoteEndPrototype{}%
|
||||
\def\markdownRendererInputVerbatimPrototype#1{}%
|
||||
\def\markdownRendererInputFencedCodePrototype#1#2{}%
|
||||
\def\markdownRendererHeadingOnePrototype#1{}%
|
||||
\def\markdownRendererHeadingTwoPrototype#1{}%
|
||||
\def\markdownRendererHeadingThreePrototype#1{}%
|
||||
\def\markdownRendererHeadingFourPrototype#1{}%
|
||||
\def\markdownRendererHeadingFivePrototype#1{}%
|
||||
\def\markdownRendererHeadingSixPrototype#1{}%
|
||||
\def\markdownRendererHorizontalRulePrototype{}%
|
||||
\def\markdownRendererFootnotePrototype#1{}%
|
||||
\def\markdownRendererCitePrototype#1{}%
|
||||
\def\markdownRendererTextCitePrototype#1{}%
|
||||
\def\markdownInfo#1{}%
|
||||
\def\markdownWarning#1{}%
|
||||
\def\markdownError#1#2{}%
|
||||
\let\markdownMakeOther\relax
|
||||
\let\markdownReadAndConvert\relax
|
||||
\begingroup
|
||||
\catcode`\|=0\catcode`\\=12%
|
||||
|gdef|markdownBegin{%
|
||||
|markdownReadAndConvert{\markdownEnd}%
|
||||
{|markdownEnd}}%
|
||||
|endgroup
|
||||
\ifx\markdownMode\undefined
|
||||
\ifx\directlua\undefined
|
||||
\def\markdownMode{0}%
|
||||
\else
|
||||
\def\markdownMode{2}%
|
||||
\fi
|
||||
\fi
|
||||
\def\markdownLuaRegisterIBCallback#1{\relax}%
|
||||
\def\markdownLuaUnregisterIBCallback#1{\relax}%
|
||||
\def\markdownInfo#1{%
|
||||
\immediate\write-1{(l.\the\inputlineno) markdown.tex info: #1.}}%
|
||||
\def\markdownWarning#1{%
|
||||
\immediate\write16{(l.\the\inputlineno) markdown.tex warning: #1}}%
|
||||
\def\markdownError#1#2{%
|
||||
\errhelp{#2.}%
|
||||
\errmessage{(l.\the\inputlineno) markdown.tex error: #1}}%
|
||||
\def\markdownRendererInterblockSeparatorPrototype{\par}%
|
||||
\def\markdownRendererLineBreakPrototype{\hfil\break}%
|
||||
\let\markdownRendererEllipsisPrototype\dots
|
||||
\def\markdownRendererNbspPrototype{~}%
|
||||
\def\markdownRendererLeftBracePrototype{\char`{}%
|
||||
\def\markdownRendererRightBracePrototype{\char`}}%
|
||||
\def\markdownRendererDollarSignPrototype{\char`$}%
|
||||
\def\markdownRendererPercentSignPrototype{\char`\%}%
|
||||
\def\markdownRendererAmpersandPrototype{\char`&}%
|
||||
\def\markdownRendererUnderscorePrototype{\char`_}%
|
||||
\def\markdownRendererHashPrototype{\char`\#}%
|
||||
\def\markdownRendererCircumflexPrototype{\char`^}%
|
||||
\def\markdownRendererBackslashPrototype{\char`\\}%
|
||||
\def\markdownRendererTildePrototype{\char`~}%
|
||||
\def\markdownRendererPipePrototype{|}%
|
||||
\def\markdownRendererCodeSpanPrototype#1{{\tt#1}}%
|
||||
\def\markdownRendererLinkPrototype#1#2#3#4{#2}%
|
||||
\def\markdownRendererContentBlockPrototype#1#2#3#4{%
|
||||
\markdownInput{#3}}%
|
||||
\def\markdownRendererContentBlockOnlineImagePrototype{%
|
||||
\markdownRendererImage}%
|
||||
\def\markdownRendererContentBlockCodePrototype#1#2#3#4#5{%
|
||||
\markdownRendererInputFencedCode{#3}{#2}}%
|
||||
\def\markdownRendererImagePrototype#1#2#3#4{#2}%
|
||||
\def\markdownRendererUlBeginPrototype{}%
|
||||
\def\markdownRendererUlBeginTightPrototype{}%
|
||||
\def\markdownRendererUlItemPrototype{}%
|
||||
\def\markdownRendererUlItemEndPrototype{}%
|
||||
\def\markdownRendererUlEndPrototype{}%
|
||||
\def\markdownRendererUlEndTightPrototype{}%
|
||||
\def\markdownRendererOlBeginPrototype{}%
|
||||
\def\markdownRendererOlBeginTightPrototype{}%
|
||||
\def\markdownRendererOlItemPrototype{}%
|
||||
\def\markdownRendererOlItemWithNumberPrototype#1{}%
|
||||
\def\markdownRendererOlItemEndPrototype{}%
|
||||
\def\markdownRendererOlEndPrototype{}%
|
||||
\def\markdownRendererOlEndTightPrototype{}%
|
||||
\def\markdownRendererDlBeginPrototype{}%
|
||||
\def\markdownRendererDlBeginTightPrototype{}%
|
||||
\def\markdownRendererDlItemPrototype#1{#1}%
|
||||
\def\markdownRendererDlItemEndPrototype{}%
|
||||
\def\markdownRendererDlDefinitionBeginPrototype{}%
|
||||
\def\markdownRendererDlDefinitionEndPrototype{\par}%
|
||||
\def\markdownRendererDlEndPrototype{}%
|
||||
\def\markdownRendererDlEndTightPrototype{}%
|
||||
\def\markdownRendererEmphasisPrototype#1{{\it#1}}%
|
||||
\def\markdownRendererStrongEmphasisPrototype#1{{\bf#1}}%
|
||||
\def\markdownRendererBlockQuoteBeginPrototype{\par\begingroup\it}%
|
||||
\def\markdownRendererBlockQuoteEndPrototype{\endgroup\par}%
|
||||
\def\markdownRendererInputVerbatimPrototype#1{%
|
||||
\par{\tt\input"#1"\relax}\par}%
|
||||
\def\markdownRendererInputFencedCodePrototype#1#2{%
|
||||
\markdownRendererInputVerbatimPrototype{#1}}%
|
||||
\def\markdownRendererHeadingOnePrototype#1{#1}%
|
||||
\def\markdownRendererHeadingTwoPrototype#1{#1}%
|
||||
\def\markdownRendererHeadingThreePrototype#1{#1}%
|
||||
\def\markdownRendererHeadingFourPrototype#1{#1}%
|
||||
\def\markdownRendererHeadingFivePrototype#1{#1}%
|
||||
\def\markdownRendererHeadingSixPrototype#1{#1}%
|
||||
\def\markdownRendererHorizontalRulePrototype{}%
|
||||
\def\markdownRendererFootnotePrototype#1{#1}%
|
||||
\def\markdownRendererCitePrototype#1{}%
|
||||
\def\markdownRendererTextCitePrototype#1{}%
|
||||
\def\markdownLuaOptions{{%
|
||||
\ifx\markdownOptionBlankBeforeBlockquote\undefined\else
|
||||
blankBeforeBlockquote = \markdownOptionBlankBeforeBlockquote,
|
||||
\fi
|
||||
\ifx\markdownOptionBlankBeforeCodeFence\undefined\else
|
||||
blankBeforeCodeFence = \markdownOptionBlankBeforeCodeFence,
|
||||
\fi
|
||||
\ifx\markdownOptionBlankBeforeHeading\undefined\else
|
||||
blankBeforeHeading = \markdownOptionBlankBeforeHeading,
|
||||
\fi
|
||||
\ifx\markdownOptionBreakableBlockquotes\undefined\else
|
||||
breakableBlockquotes = \markdownOptionBreakableBlockquotes,
|
||||
\fi
|
||||
cacheDir = "\markdownOptionCacheDir",
|
||||
\ifx\markdownOptionCitations\undefined\else
|
||||
citations = \markdownOptionCitations,
|
||||
\fi
|
||||
\ifx\markdownOptionCitationNbsps\undefined\else
|
||||
citationNbsps = \markdownOptionCitationNbsps,
|
||||
\fi
|
||||
\ifx\markdownOptionCodeSpans\undefined\else
|
||||
codeSpans = \markdownOptionCodeSpans,
|
||||
\fi
|
||||
\ifx\markdownOptionContentBlocks\undefined\else
|
||||
contentBlocks = \markdownOptionContentBlocks,
|
||||
\fi
|
||||
\ifx\markdownOptionContentBlocksLanguageMap\undefined\else
|
||||
contentBlocksLanguageMap =
|
||||
"\markdownOptionContentBlocksLanguageMap",
|
||||
\fi
|
||||
\ifx\markdownOptionDefinitionLists\undefined\else
|
||||
definitionLists = \markdownOptionDefinitionLists,
|
||||
\fi
|
||||
\ifx\markdownOptionFootnotes\undefined\else
|
||||
footnotes = \markdownOptionFootnotes,
|
||||
\fi
|
||||
\ifx\markdownOptionFencedCode\undefined\else
|
||||
fencedCode = \markdownOptionFencedCode,
|
||||
\fi
|
||||
\ifx\markdownOptionHashEnumerators\undefined\else
|
||||
hashEnumerators = \markdownOptionHashEnumerators,
|
||||
\fi
|
||||
\ifx\markdownOptionHtml\undefined\else
|
||||
html = \markdownOptionHtml,
|
||||
\fi
|
||||
\ifx\markdownOptionHybrid\undefined\else
|
||||
hybrid = \markdownOptionHybrid,
|
||||
\fi
|
||||
\ifx\markdownOptionInlineFootnotes\undefined\else
|
||||
inlineFootnotes = \markdownOptionInlineFootnotes,
|
||||
\fi
|
||||
outputDir = "\markdownOptionOutputDir",
|
||||
\ifx\markdownOptionPreserveTabs\undefined\else
|
||||
preserveTabs = \markdownOptionPreserveTabs,
|
||||
\fi
|
||||
\ifx\markdownOptionSmartEllipses\undefined\else
|
||||
smartEllipses = \markdownOptionSmartEllipses,
|
||||
\fi
|
||||
\ifx\markdownOptionStartNumber\undefined\else
|
||||
startNumber = \markdownOptionStartNumber,
|
||||
\fi
|
||||
\ifx\markdownOptionTightLists\undefined\else
|
||||
tightLists = \markdownOptionTightLists,
|
||||
\fi
|
||||
\ifx\markdownOptionUnderscores\undefined\else
|
||||
underscores = \markdownOptionUnderscores,
|
||||
\fi}
|
||||
}%
|
||||
\def\markdownPrepare{%
|
||||
local lfs = require("lfs")
|
||||
local cacheDir = "\markdownOptionCacheDir"
|
||||
if lfs.isdir(cacheDir) == true then else
|
||||
assert(lfs.mkdir(cacheDir))
|
||||
end
|
||||
local md = require("markdown")
|
||||
local convert = md.new(\markdownLuaOptions)
|
||||
}%
|
||||
\csname newread\endcsname\markdownInputFileStream
|
||||
\csname newwrite\endcsname\markdownOutputFileStream
|
||||
\begingroup
|
||||
\catcode`\^^I=12%
|
||||
\gdef\markdownReadAndConvertTab{^^I}%
|
||||
\endgroup
|
||||
\begingroup
|
||||
\catcode`\^^M=13%
|
||||
\catcode`\^^I=13%
|
||||
\catcode`|=0%
|
||||
\catcode`\\=12%
|
||||
|gdef|markdownReadAndConvert#1#2{%
|
||||
|begingroup%
|
||||
|immediate|openout|markdownOutputFileStream%
|
||||
|markdownOptionInputTempFileName%
|
||||
|markdownInfo{Buffering markdown input into the temporary %
|
||||
input file "|markdownOptionInputTempFileName" and scanning %
|
||||
for the closing token sequence "#1"}%
|
||||
|def|do##1{|catcode`##1=12}|dospecials%
|
||||
|catcode`| =12%
|
||||
|markdownMakeOther%
|
||||
|def|markdownReadAndConvertProcessLine##1#1##2#1##3|relax{%
|
||||
|ifx|relax##3|relax%
|
||||
|immediate|write|markdownOutputFileStream{##1}%
|
||||
|else%
|
||||
|def^^M{%
|
||||
|markdownInfo{The ending token sequence was found}%
|
||||
|immediate|closeout|markdownOutputFileStream%
|
||||
|endgroup%
|
||||
|markdownInput|markdownOptionInputTempFileName%
|
||||
#2}%
|
||||
|fi%
|
||||
^^M}%
|
||||
|catcode`|^^I=13%
|
||||
|def^^I{|markdownReadAndConvertTab}%
|
||||
|catcode`|^^M=13%
|
||||
|def^^M##1^^M{%
|
||||
|def^^M####1^^M{%
|
||||
|markdownReadAndConvertProcessLine####1#1#1|relax}%
|
||||
^^M}%
|
||||
^^M}%
|
||||
|endgroup
|
||||
\ifnum\markdownMode<2\relax
|
||||
\ifnum\markdownMode=0\relax
|
||||
\markdownInfo{Using mode 0: Shell escape via write18}%
|
||||
\else
|
||||
\markdownInfo{Using mode 1: Shell escape via os.execute}%
|
||||
\fi
|
||||
\ifx\pdfshellescape\undefined
|
||||
\ifx\shellescape\undefined
|
||||
\ifnum\markdownMode=0\relax
|
||||
\def\markdownExecuteShellEscape{1}%
|
||||
\else
|
||||
\def\markdownExecuteShellEscape{%
|
||||
\directlua{tex.sprint(status.shell_escape or "1")}}%
|
||||
\fi
|
||||
\else
|
||||
\let\markdownExecuteShellEscape\shellescape
|
||||
\fi
|
||||
\else
|
||||
\let\markdownExecuteShellEscape\pdfshellescape
|
||||
\fi
|
||||
\ifnum\markdownMode=0\relax
|
||||
\def\markdownExecuteDirect#1{\immediate\write18{#1}}%
|
||||
\else
|
||||
\def\markdownExecuteDirect#1{%
|
||||
\directlua{os.execute("\luaescapestring{#1}")}}%
|
||||
\fi
|
||||
\def\markdownExecute#1{%
|
||||
\ifnum\markdownExecuteShellEscape=1\relax
|
||||
\markdownExecuteDirect{#1}%
|
||||
\else
|
||||
\markdownError{I can not access the shell}{Either run the TeX
|
||||
compiler with the --shell-escape or the --enable-write18 flag,
|
||||
or set shell_escape=t in the texmf.cnf file}%
|
||||
\fi}%
|
||||
\begingroup
|
||||
\catcode`|=0%
|
||||
\catcode`\\=12%
|
||||
|gdef|markdownLuaExecute#1{%
|
||||
|immediate|openout|markdownOutputFileStream=%
|
||||
|markdownOptionHelperScriptFileName
|
||||
|markdownInfo{Writing a helper Lua script to the file
|
||||
"|markdownOptionHelperScriptFileName"}%
|
||||
|immediate|write|markdownOutputFileStream{%
|
||||
local ran_ok, error = pcall(function()
|
||||
local kpse = require('kpse')
|
||||
kpse.set_program_name('luatex')
|
||||
#1
|
||||
end)
|
||||
if not ran_ok then
|
||||
local file = io.open("%
|
||||
|markdownOptionOutputDir
|
||||
/|markdownOptionErrorTempFileName", "w")
|
||||
if file then
|
||||
file:write(error .. "\n")
|
||||
file:close()
|
||||
end
|
||||
print('\\markdownError{An error was encountered while executing
|
||||
Lua code}{For further clues, examine the file
|
||||
"|markdownOptionOutputDir
|
||||
/|markdownOptionErrorTempFileName"}')
|
||||
end}%
|
||||
|immediate|closeout|markdownOutputFileStream
|
||||
|markdownInfo{Executing a helper Lua script from the file
|
||||
"|markdownOptionHelperScriptFileName" and storing the result in the
|
||||
file "|markdownOptionOutputTempFileName"}%
|
||||
|markdownExecute{texlua "|markdownOptionOutputDir
|
||||
/|markdownOptionHelperScriptFileName" > %
|
||||
"|markdownOptionOutputDir
|
||||
/|markdownOptionOutputTempFileName"}%
|
||||
|input|markdownOptionOutputTempFileName|relax}%
|
||||
|endgroup
|
||||
\else
|
||||
\markdownInfo{Using mode 2: Direct Lua access}%
|
||||
\def\markdownLuaExecute#1{\directlua{local print = tex.print #1}}%
|
||||
\fi
|
||||
\begingroup
|
||||
\catcode`|=0%
|
||||
\catcode`\\=12%
|
||||
|gdef|markdownInput#1{%
|
||||
|markdownInfo{Including markdown document "#1"}%
|
||||
|openin|markdownInputFileStream#1
|
||||
|closein|markdownInputFileStream
|
||||
|markdownLuaExecute{%
|
||||
|markdownPrepare
|
||||
local input = assert(io.open("#1","r")):read("*a")
|
||||
print(convert(input:gsub("\r\n?", "\n")))}}%
|
||||
|endgroup
|
||||
\endinput
|
||||
%%
|
||||
%% End of file `markdown.tex'.
|
||||
161
latex/t-markdown.tex
Normal file
161
latex/t-markdown.tex
Normal file
@@ -0,0 +1,161 @@
|
||||
%%
|
||||
%% This is file `t-markdown.tex',
|
||||
%% generated with the docstrip utility.
|
||||
%%
|
||||
%% The original source files were:
|
||||
%%
|
||||
%% markdown.dtx (with options: `context')
|
||||
%%
|
||||
%% Copyright (C) 2017 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.
|
||||
%%
|
||||
\writestatus{loading}{ConTeXt User Module / markdown}%
|
||||
\unprotect
|
||||
\let\startmarkdown\relax
|
||||
\let\stopmarkdown\relax
|
||||
\def\dospecials{\do\ \do\\\do\{\do\}\do\$\do\&%
|
||||
\do\#\do\^\do\_\do\%\do\~}%
|
||||
\input markdown
|
||||
\def\markdownMakeOther{%
|
||||
\count0=128\relax
|
||||
\loop
|
||||
\catcode\count0=11\relax
|
||||
\advance\count0 by 1\relax
|
||||
\ifnum\count0<256\repeat
|
||||
\catcode`|=12}%
|
||||
\def\markdownInfo#1{\writestatus{markdown}{#1.}}%
|
||||
\def\markdownWarning#1{\writestatus{markdown\space warn}{#1.}}%
|
||||
\begingroup
|
||||
\catcode`\|=0%
|
||||
\catcode`\\=12%
|
||||
|gdef|startmarkdown{%
|
||||
|markdownReadAndConvert{\stopmarkdown}%
|
||||
{|stopmarkdown}}%
|
||||
|endgroup
|
||||
\def\markdownRendererLineBreakPrototype{\blank}%
|
||||
\def\markdownRendererLeftBracePrototype{\textbraceleft}%
|
||||
\def\markdownRendererRightBracePrototype{\textbraceright}%
|
||||
\def\markdownRendererDollarSignPrototype{\textdollar}%
|
||||
\def\markdownRendererPercentSignPrototype{\percent}%
|
||||
\def\markdownRendererUnderscorePrototype{\textunderscore}%
|
||||
\def\markdownRendererCircumflexPrototype{\textcircumflex}%
|
||||
\def\markdownRendererBackslashPrototype{\textbackslash}%
|
||||
\def\markdownRendererTildePrototype{\textasciitilde}%
|
||||
\def\markdownRendererPipePrototype{\char`|}%
|
||||
\def\markdownRendererLinkPrototype#1#2#3#4{%
|
||||
\useURL[#1][#3][][#4]#1\footnote[#1]{\ifx\empty#4\empty\else#4:
|
||||
\fi\tt<\hyphenatedurl{#3}>}}%
|
||||
\usemodule[database]
|
||||
\defineseparatedlist
|
||||
[MarkdownConTeXtCSV]
|
||||
[separator={,},
|
||||
before=\bTABLE,after=\eTABLE,
|
||||
first=\bTR,last=\eTR,
|
||||
left=\bTD,right=\eTD]
|
||||
\def\markdownConTeXtCSV{csv}
|
||||
\def\markdownRendererContentBlockPrototype#1#2#3#4{%
|
||||
\def\markdownConTeXtCSV@arg{#1}%
|
||||
\ifx\markdownConTeXtCSV@arg\markdownConTeXtCSV
|
||||
\placetable[][tab:#1]{#4}{%
|
||||
\processseparatedfile[MarkdownConTeXtCSV][#3]}%
|
||||
\else
|
||||
\markdownInput{#3}%
|
||||
\fi}%
|
||||
\def\markdownRendererImagePrototype#1#2#3#4{%
|
||||
\placefigure[][fig:#1]{#4}{\externalfigure[#3]}}%
|
||||
\def\markdownRendererUlBeginPrototype{\startitemize}%
|
||||
\def\markdownRendererUlBeginTightPrototype{\startitemize[packed]}%
|
||||
\def\markdownRendererUlItemPrototype{\item}%
|
||||
\def\markdownRendererUlEndPrototype{\stopitemize}%
|
||||
\def\markdownRendererUlEndTightPrototype{\stopitemize}%
|
||||
\def\markdownRendererOlBeginPrototype{\startitemize[n]}%
|
||||
\def\markdownRendererOlBeginTightPrototype{\startitemize[packed,n]}%
|
||||
\def\markdownRendererOlItemPrototype{\item}%
|
||||
\def\markdownRendererOlItemWithNumberPrototype#1{\sym{#1.}}%
|
||||
\def\markdownRendererOlEndPrototype{\stopitemize}%
|
||||
\def\markdownRendererOlEndTightPrototype{\stopitemize}%
|
||||
\definedescription
|
||||
[MarkdownConTeXtDlItemPrototype]
|
||||
[location=hanging,
|
||||
margin=standard,
|
||||
headstyle=bold]%
|
||||
\definestartstop
|
||||
[MarkdownConTeXtDlPrototype]
|
||||
[before=\blank,
|
||||
after=\blank]%
|
||||
\definestartstop
|
||||
[MarkdownConTeXtDlTightPrototype]
|
||||
[before=\blank\startpacked,
|
||||
after=\stoppacked\blank]%
|
||||
\def\markdownRendererDlBeginPrototype{%
|
||||
\startMarkdownConTeXtDlPrototype}%
|
||||
\def\markdownRendererDlBeginTightPrototype{%
|
||||
\startMarkdownConTeXtDlTightPrototype}%
|
||||
\def\markdownRendererDlItemPrototype#1{%
|
||||
\startMarkdownConTeXtDlItemPrototype{#1}}%
|
||||
\def\markdownRendererDlItemEndPrototype{%
|
||||
\stopMarkdownConTeXtDlItemPrototype}%
|
||||
\def\markdownRendererDlEndPrototype{%
|
||||
\stopMarkdownConTeXtDlPrototype}%
|
||||
\def\markdownRendererDlEndTightPrototype{%
|
||||
\stopMarkdownConTeXtDlTightPrototype}%
|
||||
\def\markdownRendererEmphasisPrototype#1{{\em#1}}%
|
||||
\def\markdownRendererStrongEmphasisPrototype#1{{\bf#1}}%
|
||||
\def\markdownRendererBlockQuoteBeginPrototype{\startquotation}%
|
||||
\def\markdownRendererBlockQuoteEndPrototype{\stopquotation}%
|
||||
\def\markdownRendererInputVerbatimPrototype#1{\typefile{#1}}%
|
||||
\def\markdownRendererInputFencedCodePrototype#1#2{%
|
||||
\ifx\relax#2\relax
|
||||
\typefile{#1}%
|
||||
\else
|
||||
\typefile[#2][]{#1}%
|
||||
\fi}%
|
||||
\def\markdownRendererHeadingOnePrototype#1{\chapter{#1}}%
|
||||
\def\markdownRendererHeadingTwoPrototype#1{\section{#1}}%
|
||||
\def\markdownRendererHeadingThreePrototype#1{\subsection{#1}}%
|
||||
\def\markdownRendererHeadingFourPrototype#1{\subsubsection{#1}}%
|
||||
\def\markdownRendererHeadingFivePrototype#1{\subsubsubsection{#1}}%
|
||||
\def\markdownRendererHeadingSixPrototype#1{\subsubsubsubsection{#1}}%
|
||||
\def\markdownRendererHorizontalRulePrototype{%
|
||||
\blackrule[height=1pt, width=\hsize]}%
|
||||
\def\markdownRendererFootnotePrototype#1{\footnote{#1}}%
|
||||
\stopmodule\protect
|
||||
\endinput
|
||||
%%
|
||||
%% End of file `t-markdown.tex'.
|
||||
Reference in New Issue
Block a user