summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-12-08 23:00:36 +0000
committerKarl Berry <karl@freefriends.org>2016-12-08 23:00:36 +0000
commit0289f1e978eb4e6e1c0b025309fdcfe3eb43e5c9 (patch)
treec4684ce2aa25a5d09c0b23e5063c870e9810d417 /Master
parent75ab39a4900b7447f06b9e39d9b6480d266fb254 (diff)
markdown (8dec16)
git-svn-id: svn://tug.org/texlive/trunk@42652 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/generic/markdown/markdown.pdfbin323329 -> 323348 bytes
-rw-r--r--Master/texmf-dist/source/generic/markdown/markdown.dtx250
-rw-r--r--Master/texmf-dist/tex/generic/markdown/markdown.tex8
-rw-r--r--Master/texmf-dist/tex/latex/markdown/markdown.sty2
-rw-r--r--Master/texmf-dist/tex/luatex/markdown/markdown.lua205
5 files changed, 263 insertions, 202 deletions
diff --git a/Master/texmf-dist/doc/generic/markdown/markdown.pdf b/Master/texmf-dist/doc/generic/markdown/markdown.pdf
index 90fb77c78b5..f2b3519705c 100644
--- a/Master/texmf-dist/doc/generic/markdown/markdown.pdf
+++ b/Master/texmf-dist/doc/generic/markdown/markdown.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/generic/markdown/markdown.dtx b/Master/texmf-dist/source/generic/markdown/markdown.dtx
index 894d6063472..5b3f8f65963 100644
--- a/Master/texmf-dist/source/generic/markdown/markdown.dtx
+++ b/Master/texmf-dist/source/generic/markdown/markdown.dtx
@@ -74,10 +74,10 @@
\begin{filecontents}{markdown.bib}
@book{luatex16,
author = {{Lua\TeX{} development team}},
- title = {Lua\TeX{} reference manual (0.98.3)},
- date = {2016-08-23},
+ title = {Lua\TeX{} reference manual},
+ date = {2016-09-27},
url = {http://www.luatex.org/svn/trunk/manual/luatex.pdf},
- urldate = {2016-08-30}}
+ urldate = {2016-11-27}}
@book{latex16,
author = {Braams, Johannes and Carlisle, David and Jeffrey, Alan and
Lamport, Leslie and Mittelbach, Frank and Rowley, Chris and
@@ -85,7 +85,7 @@
title = {The \Hologo{LaTeX2e} Sources},
date = {2016-03-31},
url = {http://mirrors.ctan.org/macros/latex/base/source2e.pdf},
- urldate = {2016-06-02}}
+ urldate = {2016-09-27}}
@book{ierusalimschy13,
author = {Ierusalimschy, Roberto},
year = {2013},
@@ -137,7 +137,7 @@
% packages that enable the direct inclusion of markdown documents inside \TeX{}
% documents.
%
-% Architecturally, the package consists of the \pkg{Lunamark} v1.4.0 Lua module
+% Architecturally, the package consists of the \pkg{Lunamark} v0.5.0 Lua module
% by John MacFarlane, which was slimmed down and rewritten for the needs of the
% package. On top of \pkg{Lunamark} sits code for the plain \TeX{}, \LaTeX{},
% and \Hologo{ConTeXt} formats by Vít Novotný.
@@ -147,7 +147,7 @@
% \fi
% \begin{macrocode}
local metadata = {
- version = "2.1.3",
+ version = "2.2.1",
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 Vít Novotný",
@@ -530,6 +530,20 @@ defaultOptions.fencedCode = false
defaultOptions.footnotes = false
% \end{macrocode}
%
+% \Optitem[false]{inlineFootnotes}{\opt{true}, \opt{false}}
+% \begin{valuelist}
+% \item[true] Enable the pandoc inline footnote syntax extension:
+% \begin{Verbatim}
+% Here is an inline note.^[Inlines notes are easier to
+% write, since you don't have to pick an identifier and
+% move down to type the note.]
+% \end{Verbatim}
+% \item[false] Disable the pandoc inline footnote syntax extension.
+% \end{valuelist}
+% \begin{macrocode}
+defaultOptions.inlineFootnotes = false
+% \end{macrocode}
+%
% \Optitem[false]{preserveTabs}{\opt{true}, \opt{false}}
% \begin{valuelist}
% \item[true] Preserve all tabs in the input.
@@ -586,8 +600,8 @@ defaultOptions.tightLists = true
% \ref{sec:luaoptions}) used during the conversion from markdown to plain
% \TeX{}, and for changing the way markdown the tokens are rendered.
% \begin{macrocode}
-\def\markdownLastModified{2016/09/15}%
-\def\markdownVersion{2.1.3}%
+\def\markdownLastModified{2016/12/07}%
+\def\markdownVersion{2.2.1}%
% \end{macrocode}
%
% The plain \TeX{} interface is implemented by the \t`markdown.tex` file that
@@ -732,6 +746,7 @@ defaultOptions.tightLists = true
\let\markdownOptionFencedCode\undefined
\let\markdownOptionHashEnumerators\undefined
\let\markdownOptionHybrid\undefined
+\let\markdownOptionInlineFootnotes\undefined
\let\markdownOptionPreserveTabs\undefined
\let\markdownOptionSmartEllipses\undefined
\let\markdownOptionStartNumber\undefined
@@ -1449,6 +1464,8 @@ defaultOptions.tightLists = true
\def\markdownOptionHashEnumerators{#1}}%
\define@key{markdownOptions}{hybrid}[true]{%
\def\markdownOptionHybrid{#1}}%
+\define@key{markdownOptions}{inlineFotnotes}[true]{%
+ \def\markdownOptionInlineFootnotes{#1}}%
\define@key{markdownOptions}{preserveTabs}[true]{%
\def\markdownOptionPreserveTabs{#1}}%
\define@key{markdownOptions}{smartEllipses}[true]{%
@@ -2424,6 +2441,100 @@ function M.writer.new(options)
return self
end
% \end{macrocode}
+% \subsubsection{Generic \acro{peg} Patterns}
+% These \acro{peg} patterns have been temporarily moved outside the
+% \luam{reader.new} method, which is currently hitting the limit of 200 local
+% variables. To resolve this issue, all the \acro{peg} patterns local to
+% \luam{reader.new} will be moved to a static hash table at some point in the
+% future.
+% \begin{macrocode}
+local percent = P("%")
+local at = P("@")
+local comma = P(",")
+local asterisk = P("*")
+local dash = P("-")
+local plus = P("+")
+local underscore = P("_")
+local period = P(".")
+local hash = P("#")
+local ampersand = P("&")
+local backtick = P("`")
+local less = P("<")
+local more = P(">")
+local space = P(" ")
+local squote = P("'")
+local dquote = P('"')
+local lparent = P("(")
+local rparent = P(")")
+local lbracket = P("[")
+local rbracket = P("]")
+local circumflex = P("^")
+local slash = P("/")
+local equal = P("=")
+local colon = P(":")
+local semicolon = P(";")
+local exclamation = P("!")
+local tilde = P("~")
+
+local digit = R("09")
+local hexdigit = R("09","af","AF")
+local letter = R("AZ","az")
+local alphanumeric = R("AZ","az","09")
+local keyword = letter * alphanumeric^0
+local internal_punctuation = S(":;,.#$%&-+?<>~/")
+
+local doubleasterisks = P("**")
+local doubleunderscores = P("__")
+local fourspaces = P(" ")
+
+local any = P(1)
+local fail = any - 1
+local always = P("")
+
+local escapable = S("\\`*_{}[]()+_.!<>#-~:^@;")
+
+local anyescaped = P("\\") / "" * escapable
+ + any
+
+local tab = P("\t")
+local spacechar = S("\t ")
+local spacing = S(" \n\r\t")
+local newline = P("\n")
+local nonspacechar = any - spacing
+local tightblocksep = P("\001")
+
+local specialchar = S("*_`&[]<!\\.@-^")
+
+local normalchar = any -
+ (specialchar + spacing + tightblocksep)
+local optionalspace = spacechar^0
+local eof = - any
+local nonindentspace = space^-3 * - spacechar
+local indent = space^-3 * tab
+ + fourspaces / ""
+local linechar = P(1 - newline)
+
+local blankline = optionalspace * newline / "\n"
+local blanklines = blankline^0
+local skipblanklines = (optionalspace * newline)^0
+local indentedline = indent /"" * C(linechar^1 * newline^-1)
+local optionallyindentedline = indent^-1 /"" * C(linechar^1 * newline^-1)
+local sp = spacing^0
+local spnl = optionalspace * (newline * optionalspace)^-1
+local line = linechar^0 * newline
+ + linechar^1 * eof
+local nonemptyline = line - blankline
+
+local chunk = line * (optionallyindentedline - blankline)^0
+
+-- block followed by 0 or more optionally
+-- indented blocks with first line indented.
+local function indented_blocks(bl)
+ return Cs( bl
+ * (blankline^1 * indent * -blankline * bl)^0
+ * (blankline^1 + eof) )
+end
+% \end{macrocode}
%
% \subsubsection{Markdown Reader}\label{sec:markdownreader}
% This section documents the \luam{reader} object, which implements the
@@ -2492,7 +2603,10 @@ function M.reader.new(writer, options)
local syntax
local blocks_toplevel
local blocks
- local inlines, inlines_no_link, inlines_nbsp
+ local inlines
+ local inlines_no_link
+ local inlines_no_inline_note
+ local inlines_nbsp
local function create_parser(name, grammar)
return function(str)
@@ -2513,98 +2627,12 @@ function M.reader.new(writer, options)
function() return inlines end)
local parse_inlines_no_link = create_parser("parse_inlines_no_link",
function() return inlines_no_link end)
+ local parse_inlines_no_inline_note = create_parser(
+ "parse_inlines_no_inline_note",
+ function() return inlines_no_inline_note end)
local parse_inlines_nbsp = create_parser("parse_inlines_nbsp",
function() return inlines_nbsp end)
% \end{macrocode}
-% \paragraph{Generic \acro{peg} Patterns}
-% \begin{macrocode}
- local percent = P("%")
- local at = P("@")
- local comma = P(",")
- local asterisk = P("*")
- local dash = P("-")
- local plus = P("+")
- local underscore = P("_")
- local period = P(".")
- local hash = P("#")
- local ampersand = P("&")
- local backtick = P("`")
- local less = P("<")
- local more = P(">")
- local space = P(" ")
- local squote = P("'")
- local dquote = P('"')
- local lparent = P("(")
- local rparent = P(")")
- local lbracket = P("[")
- local rbracket = P("]")
- local circumflex = P("^")
- local slash = P("/")
- local equal = P("=")
- local colon = P(":")
- local semicolon = P(";")
- local exclamation = P("!")
- local tilde = P("~")
-
- local digit = R("09")
- local hexdigit = R("09","af","AF")
- local letter = R("AZ","az")
- local alphanumeric = R("AZ","az","09")
- local keyword = letter * alphanumeric^0
- local internal_punctuation = S(":;,.#$%&-+?<>~/")
-
- local doubleasterisks = P("**")
- local doubleunderscores = P("__")
- local fourspaces = P(" ")
-
- local any = P(1)
- local fail = any - 1
- local always = P("")
-
- local escapable = S("\\`*_{}[]()+_.!<>#-~:^@;")
-
- local anyescaped = P("\\") / "" * escapable
- + any
-
- local tab = P("\t")
- local spacechar = S("\t ")
- local spacing = S(" \n\r\t")
- local newline = P("\n")
- local nonspacechar = any - spacing
- local tightblocksep = P("\001")
-
- local specialchar = S("*_`&[]<!\\.@-")
-
- local normalchar = any -
- (specialchar + spacing + tightblocksep)
- local optionalspace = spacechar^0
- local eof = - any
- local nonindentspace = space^-3 * - spacechar
- local indent = space^-3 * tab
- + fourspaces / ""
- local linechar = P(1 - newline)
-
- local blankline = optionalspace * newline / "\n"
- local blanklines = blankline^0
- local skipblanklines = (optionalspace * newline)^0
- local indentedline = indent /"" * C(linechar^1 * newline^-1)
- local optionallyindentedline = indent^-1 /"" * C(linechar^1 * newline^-1)
- local sp = spacing^0
- local spnl = optionalspace * (newline * optionalspace)^-1
- local line = linechar^0 * newline
- + linechar^1 * eof
- local nonemptyline = line - blankline
-
- local chunk = line * (optionallyindentedline - blankline)^0
-
- -- block followed by 0 or more optionally
- -- indented blocks with first line indented.
- local function indented_blocks(bl)
- return Cs( bl
- * (blankline^1 * indent * -blankline * bl)^0
- * (blankline^1 + eof) )
- end
-% \end{macrocode}
% \paragraph{List \acro{peg} Patterns}
% \begin{macrocode}
local bulletchar = C(plus + asterisk + dash)
@@ -2803,14 +2831,13 @@ function M.reader.new(writer, options)
local NoteRef = RawNoteRef / lookup_note
- local NoteBlock
- if options.footnotes then
- NoteBlock = leader * RawNoteRef * colon * spnl *
- indented_blocks(chunk) / register_note
- else
- NoteBlock = fail
- end
+ local NoteBlock = leader * RawNoteRef * colon * spnl
+ * indented_blocks(chunk) / register_note
+
+ local InlineNote = circumflex -- no notes inside notes
+ * (tag / parse_inlines_no_inline_note)
+ / writer.note
% \end{macrocode}
% \paragraph{Link and Image \acro{peg} Patterns}
% \begin{macrocode}
@@ -3295,6 +3322,7 @@ function M.reader.new(writer, options)
+ V("UlOrStarLine")
+ V("Strong")
+ V("Emph")
+ + V("InlineNote")
+ V("NoteRef")
+ V("Citations")
+ V("Link")
@@ -3312,6 +3340,7 @@ function M.reader.new(writer, options)
UlOrStarLine = UlOrStarLine,
Strong = Strong,
Emph = Emph,
+ InlineNote = InlineNote,
NoteRef = NoteRef,
Citations = Citations,
Link = Link,
@@ -3342,6 +3371,10 @@ function M.reader.new(writer, options)
syntax.NoteRef = fail
end
+ if not options.inlineFootnotes then
+ syntax.InlineNote = fail
+ end
+
if not options.smartEllipses then
syntax.Smart = fail
end
@@ -3361,6 +3394,10 @@ function M.reader.new(writer, options)
inlines_no_link_t.Link = fail
inlines_no_link = Ct(inlines_no_link_t)
+ local inlines_no_inline_note_t = util.table_copy(inlines_t)
+ inlines_no_inline_note_t.InlineNote = fail
+ inlines_no_inline_note = Ct(inlines_no_inline_note_t)
+
local inlines_nbsp_t = util.table_copy(inlines_t)
inlines_nbsp_t.Endline = NonbreakingEndline
inlines_nbsp_t.Space = NonbreakingSpace
@@ -3539,6 +3576,9 @@ return M
\ifx\markdownOptionHybrid\undefined\else
hybrid = \markdownOptionHybrid,
\fi
+\ifx\markdownOptionInlineFootnotes\undefined\else
+ inlineFootnotes = \markdownOptionInlineFootnotes,
+\fi
\ifx\markdownOptionPreserveTabs\undefined\else
preserveTabs = \markdownOptionPreserveTabs,
\fi
diff --git a/Master/texmf-dist/tex/generic/markdown/markdown.tex b/Master/texmf-dist/tex/generic/markdown/markdown.tex
index ae4811949d7..9412ff5cda1 100644
--- a/Master/texmf-dist/tex/generic/markdown/markdown.tex
+++ b/Master/texmf-dist/tex/generic/markdown/markdown.tex
@@ -45,8 +45,8 @@
%%
%% The names of the source files used are shown above.
%%
-\def\markdownLastModified{2016/09/15}%
-\def\markdownVersion{2.1.3}%
+\def\markdownLastModified{2016/12/07}%
+\def\markdownVersion{2.2.1}%
\let\markdownBegin\relax
\let\markdownEnd\relax
\let\markdownInput\relax
@@ -64,6 +64,7 @@
\let\markdownOptionFencedCode\undefined
\let\markdownOptionHashEnumerators\undefined
\let\markdownOptionHybrid\undefined
+\let\markdownOptionInlineFootnotes\undefined
\let\markdownOptionPreserveTabs\undefined
\let\markdownOptionSmartEllipses\undefined
\let\markdownOptionStartNumber\undefined
@@ -354,6 +355,9 @@
\ifx\markdownOptionHybrid\undefined\else
hybrid = \markdownOptionHybrid,
\fi
+\ifx\markdownOptionInlineFootnotes\undefined\else
+ inlineFootnotes = \markdownOptionInlineFootnotes,
+\fi
\ifx\markdownOptionPreserveTabs\undefined\else
preserveTabs = \markdownOptionPreserveTabs,
\fi
diff --git a/Master/texmf-dist/tex/latex/markdown/markdown.sty b/Master/texmf-dist/tex/latex/markdown/markdown.sty
index ecaa4448cc2..a086cc4eb82 100644
--- a/Master/texmf-dist/tex/latex/markdown/markdown.sty
+++ b/Master/texmf-dist/tex/latex/markdown/markdown.sty
@@ -79,6 +79,8 @@
\def\markdownOptionHashEnumerators{#1}}%
\define@key{markdownOptions}{hybrid}[true]{%
\def\markdownOptionHybrid{#1}}%
+\define@key{markdownOptions}{inlineFotnotes}[true]{%
+ \def\markdownOptionInlineFootnotes{#1}}%
\define@key{markdownOptions}{preserveTabs}[true]{%
\def\markdownOptionPreserveTabs{#1}}%
\define@key{markdownOptions}{smartEllipses}[true]{%
diff --git a/Master/texmf-dist/tex/luatex/markdown/markdown.lua b/Master/texmf-dist/tex/luatex/markdown/markdown.lua
index bddbcaa6c07..8b374e3af3b 100644
--- a/Master/texmf-dist/tex/luatex/markdown/markdown.lua
+++ b/Master/texmf-dist/tex/luatex/markdown/markdown.lua
@@ -58,7 +58,7 @@
-- those in the standard .ins files.
--
local metadata = {
- version = "2.1.3",
+ version = "2.2.1",
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 Vít Novotný",
@@ -82,6 +82,7 @@ defaultOptions.hashEnumerators = false
defaultOptions.hybrid = false
defaultOptions.fencedCode = false
defaultOptions.footnotes = false
+defaultOptions.inlineFootnotes = false
defaultOptions.preserveTabs = false
defaultOptions.smartEllipses = false
defaultOptions.startNumber = true
@@ -409,6 +410,92 @@ function M.writer.new(options)
return self
end
+local percent = P("%")
+local at = P("@")
+local comma = P(",")
+local asterisk = P("*")
+local dash = P("-")
+local plus = P("+")
+local underscore = P("_")
+local period = P(".")
+local hash = P("#")
+local ampersand = P("&")
+local backtick = P("`")
+local less = P("<")
+local more = P(">")
+local space = P(" ")
+local squote = P("'")
+local dquote = P('"')
+local lparent = P("(")
+local rparent = P(")")
+local lbracket = P("[")
+local rbracket = P("]")
+local circumflex = P("^")
+local slash = P("/")
+local equal = P("=")
+local colon = P(":")
+local semicolon = P(";")
+local exclamation = P("!")
+local tilde = P("~")
+
+local digit = R("09")
+local hexdigit = R("09","af","AF")
+local letter = R("AZ","az")
+local alphanumeric = R("AZ","az","09")
+local keyword = letter * alphanumeric^0
+local internal_punctuation = S(":;,.#$%&-+?<>~/")
+
+local doubleasterisks = P("**")
+local doubleunderscores = P("__")
+local fourspaces = P(" ")
+
+local any = P(1)
+local fail = any - 1
+local always = P("")
+
+local escapable = S("\\`*_{}[]()+_.!<>#-~:^@;")
+
+local anyescaped = P("\\") / "" * escapable
+ + any
+
+local tab = P("\t")
+local spacechar = S("\t ")
+local spacing = S(" \n\r\t")
+local newline = P("\n")
+local nonspacechar = any - spacing
+local tightblocksep = P("\001")
+
+local specialchar = S("*_`&[]<!\\.@-^")
+
+local normalchar = any -
+ (specialchar + spacing + tightblocksep)
+local optionalspace = spacechar^0
+local eof = - any
+local nonindentspace = space^-3 * - spacechar
+local indent = space^-3 * tab
+ + fourspaces / ""
+local linechar = P(1 - newline)
+
+local blankline = optionalspace * newline / "\n"
+local blanklines = blankline^0
+local skipblanklines = (optionalspace * newline)^0
+local indentedline = indent /"" * C(linechar^1 * newline^-1)
+local optionallyindentedline = indent^-1 /"" * C(linechar^1 * newline^-1)
+local sp = spacing^0
+local spnl = optionalspace * (newline * optionalspace)^-1
+local line = linechar^0 * newline
+ + linechar^1 * eof
+local nonemptyline = line - blankline
+
+local chunk = line * (optionallyindentedline - blankline)^0
+
+-- block followed by 0 or more optionally
+-- indented blocks with first line indented.
+local function indented_blocks(bl)
+ return Cs( bl
+ * (blankline^1 * indent * -blankline * bl)^0
+ * (blankline^1 + eof) )
+end
M.reader = {}
function M.reader.new(writer, options)
local self = {}
@@ -434,7 +521,10 @@ function M.reader.new(writer, options)
local syntax
local blocks_toplevel
local blocks
- local inlines, inlines_no_link, inlines_nbsp
+ local inlines
+ local inlines_no_link
+ local inlines_no_inline_note
+ local inlines_nbsp
local function create_parser(name, grammar)
return function(str)
@@ -455,94 +545,11 @@ function M.reader.new(writer, options)
function() return inlines end)
local parse_inlines_no_link = create_parser("parse_inlines_no_link",
function() return inlines_no_link end)
+ local parse_inlines_no_inline_note = create_parser(
+ "parse_inlines_no_inline_note",
+ function() return inlines_no_inline_note end)
local parse_inlines_nbsp = create_parser("parse_inlines_nbsp",
function() return inlines_nbsp end)
- local percent = P("%")
- local at = P("@")
- local comma = P(",")
- local asterisk = P("*")
- local dash = P("-")
- local plus = P("+")
- local underscore = P("_")
- local period = P(".")
- local hash = P("#")
- local ampersand = P("&")
- local backtick = P("`")
- local less = P("<")
- local more = P(">")
- local space = P(" ")
- local squote = P("'")
- local dquote = P('"')
- local lparent = P("(")
- local rparent = P(")")
- local lbracket = P("[")
- local rbracket = P("]")
- local circumflex = P("^")
- local slash = P("/")
- local equal = P("=")
- local colon = P(":")
- local semicolon = P(";")
- local exclamation = P("!")
- local tilde = P("~")
-
- local digit = R("09")
- local hexdigit = R("09","af","AF")
- local letter = R("AZ","az")
- local alphanumeric = R("AZ","az","09")
- local keyword = letter * alphanumeric^0
- local internal_punctuation = S(":;,.#$%&-+?<>~/")
-
- local doubleasterisks = P("**")
- local doubleunderscores = P("__")
- local fourspaces = P(" ")
-
- local any = P(1)
- local fail = any - 1
- local always = P("")
-
- local escapable = S("\\`*_{}[]()+_.!<>#-~:^@;")
-
- local anyescaped = P("\\") / "" * escapable
- + any
-
- local tab = P("\t")
- local spacechar = S("\t ")
- local spacing = S(" \n\r\t")
- local newline = P("\n")
- local nonspacechar = any - spacing
- local tightblocksep = P("\001")
-
- local specialchar = S("*_`&[]<!\\.@-")
-
- local normalchar = any -
- (specialchar + spacing + tightblocksep)
- local optionalspace = spacechar^0
- local eof = - any
- local nonindentspace = space^-3 * - spacechar
- local indent = space^-3 * tab
- + fourspaces / ""
- local linechar = P(1 - newline)
-
- local blankline = optionalspace * newline / "\n"
- local blanklines = blankline^0
- local skipblanklines = (optionalspace * newline)^0
- local indentedline = indent /"" * C(linechar^1 * newline^-1)
- local optionallyindentedline = indent^-1 /"" * C(linechar^1 * newline^-1)
- local sp = spacing^0
- local spnl = optionalspace * (newline * optionalspace)^-1
- local line = linechar^0 * newline
- + linechar^1 * eof
- local nonemptyline = line - blankline
-
- local chunk = line * (optionallyindentedline - blankline)^0
-
- -- block followed by 0 or more optionally
- -- indented blocks with first line indented.
- local function indented_blocks(bl)
- return Cs( bl
- * (blankline^1 * indent * -blankline * bl)^0
- * (blankline^1 + eof) )
- end
local bulletchar = C(plus + asterisk + dash)
local bullet = ( Cg(bulletchar, "bulletchar") * #spacing * (tab + space^-3)
@@ -725,14 +732,12 @@ function M.reader.new(writer, options)
local NoteRef = RawNoteRef / lookup_note
- local NoteBlock
+ local NoteBlock = leader * RawNoteRef * colon * spnl
+ * indented_blocks(chunk) / register_note
- if options.footnotes then
- NoteBlock = leader * RawNoteRef * colon * spnl *
- indented_blocks(chunk) / register_note
- else
- NoteBlock = fail
- end
+ local InlineNote = circumflex -- no notes inside notes
+ * (tag / parse_inlines_no_inline_note)
+ / writer.note
-- List of references defined in the document
local references
@@ -1160,6 +1165,7 @@ function M.reader.new(writer, options)
+ V("UlOrStarLine")
+ V("Strong")
+ V("Emph")
+ + V("InlineNote")
+ V("NoteRef")
+ V("Citations")
+ V("Link")
@@ -1177,6 +1183,7 @@ function M.reader.new(writer, options)
UlOrStarLine = UlOrStarLine,
Strong = Strong,
Emph = Emph,
+ InlineNote = InlineNote,
NoteRef = NoteRef,
Citations = Citations,
Link = Link,
@@ -1207,6 +1214,10 @@ function M.reader.new(writer, options)
syntax.NoteRef = fail
end
+ if not options.inlineFootnotes then
+ syntax.InlineNote = fail
+ end
+
if not options.smartEllipses then
syntax.Smart = fail
end
@@ -1226,6 +1237,10 @@ function M.reader.new(writer, options)
inlines_no_link_t.Link = fail
inlines_no_link = Ct(inlines_no_link_t)
+ local inlines_no_inline_note_t = util.table_copy(inlines_t)
+ inlines_no_inline_note_t.InlineNote = fail
+ inlines_no_inline_note = Ct(inlines_no_inline_note_t)
+
local inlines_nbsp_t = util.table_copy(inlines_t)
inlines_nbsp_t.Endline = NonbreakingEndline
inlines_nbsp_t.Space = NonbreakingSpace