summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/context/third/markdown/t-markdown.tex18
-rw-r--r--Master/texmf-dist/tex/generic/markdown/markdown.tex32
-rw-r--r--Master/texmf-dist/tex/latex/markdown/markdown.sty34
-rw-r--r--Master/texmf-dist/tex/luatex/markdown/markdown.lua155
4 files changed, 221 insertions, 18 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 91e89c1dc20..a65798af1d0 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) 2016 Vít Novotný
+%% 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
@@ -81,6 +81,22 @@
\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}%
diff --git a/Master/texmf-dist/tex/generic/markdown/markdown.tex b/Master/texmf-dist/tex/generic/markdown/markdown.tex
index 8de36017864..6bc0a916571 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) 2016 Vít Novotný
+%% 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
@@ -45,8 +45,8 @@
%%
%% The names of the source files used are shown above.
%%
-\def\markdownLastModified{2017/01/05}%
-\def\markdownVersion{2.3.0}%
+\def\markdownLastModified{2017/03/27}%
+\def\markdownVersion{2.4.0}%
\let\markdownBegin\relax
\let\markdownEnd\relax
\let\markdownInput\relax
@@ -60,6 +60,8 @@
\let\markdownOptionBreakableBlockquotes\undefined
\let\markdownOptionCitations\undefined
\let\markdownOptionCitationNbsps\undefined
+\let\markdownOptionContentBlocks\undefined
+\let\markdownOptionContentBlocksLanguageMap\undefined
\let\markdownOptionDefinitionLists\undefined
\let\markdownOptionFootnotes\undefined
\let\markdownOptionFencedCode\undefined
@@ -107,6 +109,12 @@
\markdownRendererLinkPrototype}%
\def\markdownRendererImage{%
\markdownRendererImagePrototype}%
+\def\markdownRendererContentBlock{%
+ \markdownRendererContentBlockPrototype}%
+\def\markdownRendererContentBlockOnlineImage{%
+ \markdownRendererContentBlockOnlineImagePrototype}%
+\def\markdownRendererContentBlockCode{%
+ \markdownRendererContentBlockCodePrototype}%
\def\markdownRendererUlBegin{%
\markdownRendererUlBeginPrototype}%
\def\markdownRendererUlBeginTight{%
@@ -199,6 +207,9 @@
\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{}%
@@ -238,7 +249,7 @@
\def\markdownRendererTextCitePrototype#1{}%
\def\markdownInfo#1{}%
\def\markdownWarning#1{}%
-\def\markdownError#1{}%
+\def\markdownError#1#2{}%
\let\markdownMakeOther\relax
\let\markdownReadAndConvert\relax
\begingroup
@@ -280,6 +291,12 @@
\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{}%
@@ -342,6 +359,13 @@
\ifx\markdownOptionCitationNbsps\undefined\else
citationNbsps = \markdownOptionCitationNbsps,
\fi
+\ifx\markdownOptionContentBlocks\undefined\else
+ contentBlocks = \markdownOptionContentBlocks,
+\fi
+\ifx\markdownOptionContentBlocksLanguageMap\undefined\else
+ contentBlocksLanguageMap =
+ "\markdownOptionContentBlocksLanguageMap",
+\fi
\ifx\markdownOptionDefinitionLists\undefined\else
definitionLists = \markdownOptionDefinitionLists,
\fi
diff --git a/Master/texmf-dist/tex/latex/markdown/markdown.sty b/Master/texmf-dist/tex/latex/markdown/markdown.sty
index 94997e75fb8..229d810b920 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 Vít Novotný
+%% 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
@@ -71,6 +71,10 @@
\def\markdownOptionCitationNbsps{#1}}%
\define@key{markdownOptions}{cacheDir}{%
\def\markdownOptionCacheDir{#1}}%
+\define@key{markdownOptions}{contentBlocks}[true]{%
+ \def\markdownOptionContentBlocks{#1}}%
+\define@key{markdownOptions}{contentBlocksLanguageMap}{%
+ \def\markdownOptionContentBlocksLanguageMap{#1}}%
\define@key{markdownOptions}{definitionLists}[true]{%
\def\markdownOptionDefinitionLists{#1}}%
\define@key{markdownOptions}{footnotes}[true]{%
@@ -127,6 +131,12 @@
\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}{%
@@ -237,6 +247,12 @@
\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}{%
@@ -374,6 +390,7 @@
dlBeginTight = {\markdownRendererDlBegin},
dlEndTight = {\markdownRendererDlEnd}}}}
\RequirePackage{fancyvrb}
+\RequirePackage{csvsimple}
\markdownSetup{rendererPrototypes={
lineBreak = {\\},
leftBrace = {\textbraceleft},
@@ -387,7 +404,20 @@
codeSpan = {\texttt{#1}},
link = {#1\footnote{\ifx\empty#4\empty\else#4:
\fi\texttt<\url{#3}\texttt>}},
- image = {\begin{figure}
+ 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}%
diff --git a/Master/texmf-dist/tex/luatex/markdown/markdown.lua b/Master/texmf-dist/tex/luatex/markdown/markdown.lua
index 63e4effda43..de9895c8c27 100644
--- a/Master/texmf-dist/tex/luatex/markdown/markdown.lua
+++ b/Master/texmf-dist/tex/luatex/markdown/markdown.lua
@@ -1,5 +1,5 @@
--
--- Copyright (C) 2009-2016 John MacFarlane, Hans Hagen
+-- Copyright (C) 2009-2017 John MacFarlane, Hans Hagen
--
-- Permission is hereby granted, free of charge, to any person obtaining
-- a copy of this software and associated documentation files (the
@@ -58,7 +58,7 @@
-- those in the standard .ins files.
--
local metadata = {
- version = "2.3.0",
+ version = "2.4.0",
comment = "A module for the conversion from markdown to plain TeX",
author = "John MacFarlane, Hans Hagen, Vít Novotný",
copyright = "2009-2017 John MacFarlane, Hans Hagen; " ..
@@ -79,6 +79,8 @@ defaultOptions.breakableBlockquotes = false
defaultOptions.cacheDir = "."
defaultOptions.citationNbsps = true
defaultOptions.citations = false
+defaultOptions.contentBlocks = false
+defaultOptions.contentBlocksLanguageMap = "markdown-languages.json"
defaultOptions.definitionLists = false
defaultOptions.hashEnumerators = false
defaultOptions.html = false
@@ -554,6 +556,50 @@ function M.writer.new(options)
"{",self.uri(src),"}",
"{",self.string(tit or ""),"}"}
end
+local languages_json = (function()
+ 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]=')
+ curr = (function()
+ local _ENV={ json=json, load=load } -- run in sandbox
+ return load("return "..json)()
+ end)()
+ if type(curr) == "table" then
+ if base == nil then
+ base = curr
+ else
+ setmetatable(prev, { __index = curr })
+ end
+ prev = curr
+ end
+ end
+ return base or {}
+end)()
+ function self.contentblock(src,suf,type,tit)
+ src = src.."."..suf
+ suf = suf:lower()
+ if type == "onlineimage" then
+ return {"\\markdownRendererContentBlockOnlineImage{",suf,"}",
+ "{",self.string(src),"}",
+ "{",self.uri(src),"}",
+ "{",self.string(tit or ""),"}"}
+ elseif languages_json[suf] then
+ return {"\\markdownRendererContentBlockCode{",suf,"}",
+ "{",self.string(languages_json[suf]),"}",
+ "{",self.string(src),"}",
+ "{",self.uri(src),"}",
+ "{",self.string(tit or ""),"}"}
+ else
+ return {"\\markdownRendererContentBlock{",suf,"}",
+ "{",self.string(src),"}",
+ "{",self.uri(src),"}",
+ "{",self.string(tit or ""),"}"}
+ end
+ end
local function ulitem(s)
return {"\\markdownRendererUlItem ",s,
"\\markdownRendererUlItemEnd "}
@@ -829,7 +875,7 @@ parsers.fencedline = function(char)
end
parsers.leader = parsers.space^-3
--- in balanced brackets, parentheses, quotes:
+-- content in balanced brackets, parentheses, or quotes:
parsers.bracketed = P{ parsers.lbracket
* ((parsers.anyescaped - (parsers.lbracket
+ parsers.rbracket
@@ -856,22 +902,24 @@ parsers.dquoted = P{ parsers.dquote * parsers.alphanumeric
) + V(1))^0
* parsers.dquote }
--- bracketed 'tag' for markdown links, allowing nested brackets:
+-- bracketed tag for markdown links, allowing nested brackets:
parsers.tag = parsers.lbracket
* Cs((parsers.alphanumeric^1
+ parsers.bracketed
+ parsers.inticks
- + (parsers.anyescaped - (parsers.rbracket
- + parsers.blankline^2)))^0)
+ + (parsers.anyescaped
+ - (parsers.rbracket + parsers.blankline^2)))^0)
* parsers.rbracket
--- url for markdown links, allowing balanced parentheses:
-parsers.url = parsers.less * Cs((parsers.anyescaped-parsers.more)^0)
+-- url for markdown links, allowing nested brackets:
+parsers.url = parsers.less * Cs((parsers.anyescaped
+ - parsers.more)^0)
* parsers.more
+ Cs((parsers.inparens + (parsers.anyescaped
- -parsers.spacing-parsers.rparent))^1)
+ - parsers.spacing
+ - parsers.rparent))^1)
--- quoted text possibly with nested quotes:
+-- quoted text, possibly with nested quotes:
parsers.title_s = parsers.squote * Cs(((parsers.anyescaped-parsers.squote)
+ parsers.squoted)^0)
* parsers.squote
@@ -889,6 +937,70 @@ parsers.title = parsers.title_d + parsers.title_s + parsers.title_p
parsers.optionaltitle
= parsers.spnl * parsers.title * parsers.spacechar^0
+ Cc("")
+parsers.contentblock_tail
+ = parsers.optionaltitle
+ * (parsers.newline + parsers.eof)
+
+-- case insensitive online image suffix:
+parsers.onlineimagesuffix
+ = (function(...)
+ local parser = nil
+ for _,suffix in ipairs({...}) do
+ local pattern=nil
+ for i=1,#suffix do
+ local char=suffix:sub(i,i)
+ char = S(char:lower()..char:upper())
+ if pattern == nil then
+ pattern = char
+ else
+ pattern = pattern * char
+ end
+ end
+ if parser == nil then
+ parser = pattern
+ else
+ parser = parser + pattern
+ end
+ end
+ return parser
+ end)("png", "jpg", "jpeg", "gif", "tif", "tiff")
+
+-- online image url for iA Writer content blocks with mandatory suffix,
+-- allowing nested brackets:
+parsers.onlineimageurl
+ = (parsers.less
+ * Cs((parsers.anyescaped
+ - parsers.more
+ - #(parsers.period
+ * parsers.onlineimagesuffix
+ * parsers.more
+ * parsers.contentblock_tail))^0)
+ * parsers.period
+ * Cs(parsers.onlineimagesuffix)
+ * parsers.more
+ + (Cs((parsers.inparens
+ + (parsers.anyescaped
+ - parsers.spacing
+ - parsers.rparent
+ - #(parsers.period
+ * parsers.onlineimagesuffix
+ * parsers.contentblock_tail)))^0)
+ * parsers.period
+ * Cs(parsers.onlineimagesuffix))
+ ) * Cc("onlineimage")
+
+-- filename for iA Writer content blocks with mandatory suffix:
+parsers.localfilepath
+ = parsers.slash
+ * Cs((parsers.anyescaped
+ - parsers.tab
+ - parsers.newline
+ - #(parsers.period
+ * parsers.alphanumeric^1
+ * parsers.contentblock_tail))^1)
+ * parsers.period
+ * Cs(parsers.alphanumeric^1)
+ * Cc("localfile")
parsers.citation_name = Cs(parsers.dash^-1) * parsers.at
* Cs(parsers.alphanumeric
* (parsers.alphanumeric + parsers.internal_punctuation
@@ -1067,6 +1179,16 @@ end
parsers.urlchar = parsers.anyescaped - parsers.newline - parsers.more
parsers.Block = V("Block")
+parsers.OnlineImageURL
+ = parsers.leader
+ * parsers.onlineimageurl
+ * parsers.optionaltitle
+
+parsers.LocalFilePath
+ = parsers.leader
+ * parsers.localfilepath
+ * parsers.optionaltitle
+
parsers.TildeFencedCode
= parsers.fencehead(parsers.tilde)
* Cs(parsers.fencedline(parsers.tilde)^0)
@@ -1460,6 +1582,11 @@ function M.reader.new(writer, options)
larsers.HtmlEntity = parsers.hexentity / entities.hex_entity / writer.string
+ parsers.decentity / entities.dec_entity / writer.string
+ parsers.tagentity / entities.char_entity / writer.string
+ larsers.ContentBlock = parsers.leader
+ * (parsers.localfilepath + parsers.onlineimageurl)
+ * parsers.contentblock_tail
+ / writer.contentblock
+
larsers.DisplayHtml = C(parsers.displayhtml)
/ expandtabs / writer.display_html
@@ -1612,7 +1739,8 @@ function M.reader.new(writer, options)
Blank = larsers.Blank,
- Block = V("Blockquote")
+ Block = V("ContentBlock")
+ + V("Blockquote")
+ V("Verbatim")
+ V("FencedCode")
+ V("HorizontalRule")
@@ -1624,6 +1752,7 @@ function M.reader.new(writer, options)
+ V("Paragraph")
+ V("Plain"),
+ ContentBlock = larsers.ContentBlock,
Blockquote = larsers.Blockquote,
Verbatim = larsers.Verbatim,
FencedCode = larsers.FencedCode,
@@ -1689,6 +1818,10 @@ function M.reader.new(writer, options)
syntax.Citations = parsers.fail
end
+ if not options.contentBlocks then
+ syntax.ContentBlock = parsers.fail
+ end
+
if not options.footnotes then
syntax.NoteRef = parsers.fail
end