summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-04-09 21:09:18 +0000
committerKarl Berry <karl@freefriends.org>2018-04-09 21:09:18 +0000
commit1e0147a88c7bc3a3e2986968f697ef5fbcef2bcb (patch)
tree35ebdb8da7eee58a5bc80c155c61714de0e10683 /Master/texmf-dist/tex
parent13f04854f4814353751f9cbe298a3ba169ffd972 (diff)
markdown (9apr18)
git-svn-id: svn://tug.org/texlive/trunk@47397 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/context/third/markdown/t-markdown.tex2
-rw-r--r--Master/texmf-dist/tex/generic/markdown/markdown.tex110
-rw-r--r--Master/texmf-dist/tex/latex/markdown/markdown.sty24
-rw-r--r--Master/texmf-dist/tex/luatex/markdown/markdown.lua20
4 files changed, 96 insertions, 60 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 a65798af1d0..40f891b19bd 100644
--- a/Master/texmf-dist/tex/context/third/markdown/t-markdown.tex
+++ b/Master/texmf-dist/tex/context/third/markdown/t-markdown.tex
@@ -6,7 +6,7 @@
%%
%% markdown.dtx (with options: `context')
%%
-%% Copyright (C) 2017 Vít Novotný
+%% Copyright (C) 2018 Vít Novotný
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
diff --git a/Master/texmf-dist/tex/generic/markdown/markdown.tex b/Master/texmf-dist/tex/generic/markdown/markdown.tex
index 74f1ca40cfb..8b33ee045de 100644
--- a/Master/texmf-dist/tex/generic/markdown/markdown.tex
+++ b/Master/texmf-dist/tex/generic/markdown/markdown.tex
@@ -6,7 +6,7 @@
%%
%% markdown.dtx (with options: `tex')
%%
-%% Copyright (C) 2017 Vít Novotný
+%% Copyright (C) 2018 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,8 +45,8 @@
%%
%% The names of the source files used are shown above.
%%
-\def\markdownLastModified{2018/01/08}%
-\def\markdownVersion{2.5.5}%
+\def\markdownLastModified{2018/04/08}%
+\def\markdownVersion{2.5.6}%
\let\markdownBegin\relax
\let\markdownEnd\relax
\let\markdownInput\relax
@@ -75,6 +75,18 @@
\let\markdownOptionSmartEllipses\undefined
\let\markdownOptionStartNumber\undefined
\let\markdownOptionTightLists\undefined
+\def\markdownOptionStripPercentSigns{false}%
+\def\markdownIfOption#1{%
+ \def\next##1##2##3##4##5{%
+ \expandafter\def\expandafter\next\expandafter{%
+ \csname iffalse\endcsname}%
+ \if##1t\if##2r\if##3u\if##4e
+ \expandafter\def\expandafter\next\expandafter{%
+ \csname iftrue\endcsname}%
+ \fi\fi\fi\fi
+ \next}%
+ \expandafter\expandafter\expandafter\next
+ \csname markdownOption#1\endcsname\relax\relax\relax\relax\relax}
\def\markdownRendererInterblockSeparator{%
\markdownRendererInterblockSeparatorPrototype}%
\def\markdownRendererLineBreak{%
@@ -280,8 +292,8 @@
\def\markdownRendererLineBreakPrototype{\hfil\break}%
\let\markdownRendererEllipsisPrototype\dots
\def\markdownRendererNbspPrototype{~}%
-\def\markdownRendererLeftBracePrototype{\char`{}%
-\def\markdownRendererRightBracePrototype{\char`}}%
+\def\markdownRendererLeftBracePrototype{\char`\{}%
+\def\markdownRendererRightBracePrototype{\char`\}}%
\def\markdownRendererDollarSignPrototype{\char`$}%
\def\markdownRendererPercentSignPrototype{\char`\%}%
\def\markdownRendererAmpersandPrototype{\char`&}%
@@ -326,7 +338,7 @@
\def\markdownRendererBlockQuoteBeginPrototype{\par\begingroup\it}%
\def\markdownRendererBlockQuoteEndPrototype{\endgroup\par}%
\def\markdownRendererInputVerbatimPrototype#1{%
- \par{\tt\input"#1"\relax}\par}%
+ \par{\tt\input"#1"\relax{}}\par}%
\def\markdownRendererInputFencedCodePrototype#1#2{%
\markdownRendererInputVerbatimPrototype{#1}}%
\def\markdownRendererHeadingOnePrototype#1{#1}%
@@ -390,7 +402,6 @@
\ifx\markdownOptionInlineFootnotes\undefined\else
inlineFootnotes = \markdownOptionInlineFootnotes,
\fi
- outputDir = "\markdownOptionOutputDir",
\ifx\markdownOptionPreserveTabs\undefined\else
preserveTabs = \markdownOptionPreserveTabs,
\fi
@@ -410,7 +421,7 @@
\def\markdownPrepare{%
local lfs = require("lfs")
local cacheDir = "\markdownOptionCacheDir"
-if lfs.isdir(cacheDir) == true then else
+if not lfs.isdir(cacheDir) then
assert(lfs.mkdir(cacheDir))
end
local md = require("markdown")
@@ -427,36 +438,53 @@ local convert = md.new(\markdownLuaOptions)
\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}%
+ |catcode`@=14%
+ |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|markdownReadAndConvertStripPercentSign##1{@
+ |markdownIfOption{StripPercentSigns}@
+ |if##1%@
+ |expandafter|expandafter|expandafter@
+ |markdownReadAndConvertProcessLine@
+ |else@
+ |expandafter|expandafter|expandafter@
+ |markdownReadAndConvertProcessLine@
+ |expandafter|expandafter|expandafter##1@
+ |fi@
+ |else@
+ |expandafter@
+ |markdownReadAndConvertProcessLine@
+ |expandafter##1@
+ |fi}@
+ |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{@
+ |markdownReadAndConvertStripPercentSign####1#1#1|relax}@
+ ^^M}@
+ ^^M}@
|endgroup
\ifnum\markdownMode<2\relax
\ifnum\markdownMode=0\relax
@@ -502,8 +530,8 @@ local convert = md.new(\markdownLuaOptions)
"|markdownOptionHelperScriptFileName"}%
|immediate|write|markdownOutputFileStream{%
local ran_ok, error = pcall(function()
- local kpse = require('kpse')
- kpse.set_program_name('luatex')
+ local kpse = require("kpse")
+ kpse.set_program_name("luatex")
#1
end)
if not ran_ok then
@@ -542,7 +570,7 @@ local convert = md.new(\markdownLuaOptions)
|closein|markdownInputFileStream
|markdownLuaExecute{%
|markdownPrepare
- local input = assert(io.open("#1","r")):read("*a")
+ local input = assert(io.open("#1", "r"):read("*a"))
print(convert(input:gsub("\r\n?", "\n")))}}%
|endgroup
\endinput
diff --git a/Master/texmf-dist/tex/latex/markdown/markdown.sty b/Master/texmf-dist/tex/latex/markdown/markdown.sty
index f60dc234e7e..251a2f62d74 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) 2017 Vít Novotný
+%% Copyright (C) 2018 Vít Novotný
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -110,6 +110,8 @@
\def\markdownOptionTightLists{#1}}%
\define@key{markdownOptions}{underscores}[true]{%
\def\markdownOptionUnderscores{#1}}%
+\define@key{markdownOptions}{stripPercentSigns}[true]{%
+ \def\markdownOptionStripPercentSigns{#1}}%
\define@key{markdownRenderers}{interblockSeparator}{%
\renewcommand\markdownRendererInterblockSeparator{#1}}%
\define@key{markdownRenderers}{lineBreak}{%
@@ -410,8 +412,6 @@
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}%
@@ -452,7 +452,7 @@
\ifx\relax#2\relax
\VerbatimInput{#1}%
\else
- \ifx\minted@jobname\undefined
+ \ifx\minted@code\undefined
\ifx\lst@version\undefined
\markdownRendererInputFencedCode{#1}{}%
\else
@@ -482,16 +482,16 @@
headingOne = {\section{#1}},
headingTwo = {\subsection{#1}},
headingThree = {\subsubsection{#1}},
- headingFour = {\paragraph{#1}},
- headingFive = {\subparagraph{#1}}}}
+ headingFour = {\paragraph{#1}\leavevmode},
+ headingFive = {\subparagraph{#1}\leavevmode}}}
\else
\markdownSetup{rendererPrototypes = {
headingOne = {\chapter{#1}},
headingTwo = {\section{#1}},
headingThree = {\subsection{#1}},
headingFour = {\subsubsection{#1}},
- headingFive = {\paragraph{#1}},
- headingSix = {\subparagraph{#1}}}}
+ headingFive = {\paragraph{#1}\leavevmode},
+ headingSix = {\subparagraph{#1}\leavevmode}}}
\fi
\newcount\markdownLaTeXCitationsCounter
@@ -539,6 +539,14 @@
\markdownLaTeXBibLaTeXTextCitations
\expandafter{\expandafter}%
\fi}}}
+\def\markdownRendererLinkPrototype{%
+ \begingroup
+ \catcode`\#=12
+ \def\next##1##2##3##4{%
+ ##1\footnote{%
+ \ifx\empty##4\empty\else##4: \fi\texttt<\url{##3}\texttt>}%
+ \endgroup}%
+ \next}
\newcommand\markdownMakeOther{%
\count0=128\relax
\loop
diff --git a/Master/texmf-dist/tex/luatex/markdown/markdown.lua b/Master/texmf-dist/tex/luatex/markdown/markdown.lua
index 61f2b734bbc..25d45c32da2 100644
--- a/Master/texmf-dist/tex/luatex/markdown/markdown.lua
+++ b/Master/texmf-dist/tex/luatex/markdown/markdown.lua
@@ -58,22 +58,22 @@
-- those in the standard .ins files.
--
local metadata = {
- version = "2.5.5",
+ version = "2.5.6",
comment = "A module for the conversion from markdown to plain TeX",
author = "John MacFarlane, Hans Hagen, Vít Novotný",
- copyright = "2009-2016 John MacFarlane, Hans Hagen; " ..
- "2016-2018 Vít Novotný",
+ copyright = {"2009-2016 John MacFarlane, Hans Hagen",
+ "2016-2018 Vít Novotný"},
license = "LPPL 1.3"
}
+
if not modules then modules = { } end
modules['markdown'] = metadata
local lpeg = require("lpeg")
local unicode = require("unicode")
local md5 = require("md5")
-local M = {}
+local M = {metadata = metadata}
local defaultOptions = {}
defaultOptions.cacheDir = "."
-defaultOptions.outputDir = "."
defaultOptions.blankBeforeBlockquote = false
defaultOptions.blankBeforeCodeFence = false
defaultOptions.blankBeforeHeading = false
@@ -508,7 +508,7 @@ function M.writer.new(options)
return s
end
function self.pack(name)
- return [[\input"]] .. name .. [["\relax]]
+ return [[\input"]] .. name .. [["\relax{}]]
end
self.interblocksep = "\\markdownRendererInterblockSeparator\n{}"
self.eof = [[\relax]]
@@ -573,13 +573,13 @@ function M.writer.new(options)
"{",self.string(tit or ""),"}"}
end
local languages_json = (function()
- local kpse = require('kpse')
- kpse.set_program_name('luatex')
+ local kpse = require("kpse")
+ kpse.set_program_name("luatex")
local base, prev, curr
for _, file in ipairs{kpse.lookup(options.contentBlocksLanguageMap,
{ all=true })} do
- json = assert(io.open(file, "r")):read("*all")
- :gsub('("[^\n]-"):','[%1]=')
+ json = io.open(file, "r"):read("*all")
+ :gsub('("[^\n]-"):','[%1]=')
curr = (function()
local _ENV={ json=json, load=load } -- run in sandbox
return load("return "..json)()