From 6bd0a628c08e1a65957cdb460cd6704155e607eb Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sun, 5 Mar 2017 00:43:54 -0500 Subject: [PATCH] FIXED: latex list items need to block optional argument to allow '[' as first character --- Sources/libMultiMarkdown/latex.c | 6 +-- tests/MMD6Tests/Abbreviations.html | 3 +- tests/MMD6Tests/Abbreviations.tex | 3 +- tests/MMD6Tests/Abbreviations.text | 3 +- tests/MMD6Tests/Basic Lists.tex | 54 +++++++++++----------- tests/MMD6Tests/Edge Cases.tex | 8 ++-- tests/MMD6Tests/Fenced Code Blocks.tex | 4 +- tests/MMD6Tests/Integrated.tex | 24 +++++++--- tests/MMD6Tests/Markdown Syntax.tex | 54 +++++++++++----------- tests/MMD6Tests/Nested Lists.tex | 60 ++++++++++++------------- tests/MMD6Tests/Reference Footnotes.tex | 2 +- tests/MMD6Tests/Table of Contents.tex | 24 +++++----- 12 files changed, 128 insertions(+), 117 deletions(-) diff --git a/Sources/libMultiMarkdown/latex.c b/Sources/libMultiMarkdown/latex.c index e78402b..01b9c66 100644 --- a/Sources/libMultiMarkdown/latex.c +++ b/Sources/libMultiMarkdown/latex.c @@ -386,7 +386,7 @@ void mmd_export_toc_entry_latex(DString * out, const char * source, scratch_pad if (entry_level >= level) { // This entry is a direct descendant of the parent temp_char = label_from_header(source, entry); - print_const("\\item "); + print_const("\\item{} "); mmd_export_token_tree_latex(out, source, entry->child, scratch); printf("(\\autoref{%s})\n\n", temp_char); @@ -639,14 +639,14 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat break; case BLOCK_LIST_ITEM: pad(out, 2, scratch); - print_const("\\item "); + print_const("\\item{} "); scratch->padded = 2; mmd_export_token_tree_latex(out, source, t->child, scratch); scratch->padded = 0; break; case BLOCK_LIST_ITEM_TIGHT: pad(out, 2, scratch); - print_const("\\item "); + print_const("\\item{} "); scratch->padded = 2; mmd_export_token_tree_latex(out, source, t->child, scratch); scratch->padded = 0; diff --git a/tests/MMD6Tests/Abbreviations.html b/tests/MMD6Tests/Abbreviations.html index 888675f..0ac6fc7 100644 --- a/tests/MMD6Tests/Abbreviations.html +++ b/tests/MMD6Tests/Abbreviations.html @@ -14,8 +14,7 @@

foobar

-

foo -bar

+

foo bar

5

diff --git a/tests/MMD6Tests/Abbreviations.tex b/tests/MMD6Tests/Abbreviations.tex index ccd3b43..f63ffbc 100644 --- a/tests/MMD6Tests/Abbreviations.tex +++ b/tests/MMD6Tests/Abbreviations.tex @@ -18,8 +18,7 @@ \gls{foobar} -\gls{foo} -\gls{bar} +\gls{foo bar} 5 diff --git a/tests/MMD6Tests/Abbreviations.text b/tests/MMD6Tests/Abbreviations.text index 03308c6..802b45c 100644 --- a/tests/MMD6Tests/Abbreviations.text +++ b/tests/MMD6Tests/Abbreviations.text @@ -9,8 +9,7 @@ latex config: article [>foobar] -[>foo] -[>bar] +[>foo bar] 5 diff --git a/tests/MMD6Tests/Basic Lists.tex b/tests/MMD6Tests/Basic Lists.tex index 68ead9d..df458c8 100644 --- a/tests/MMD6Tests/Basic Lists.tex +++ b/tests/MMD6Tests/Basic Lists.tex @@ -3,101 +3,101 @@ \input{mmd6-article-begin} \begin{itemize} -\item foo +\item{} foo -\item foo +\item{} foo -\item foo +\item{} foo \end{itemize} bar \begin{itemize} -\item foo +\item{} foo -\item foo +\item{} foo -\item foo +\item{} foo \end{itemize} bar \begin{itemize} -\item foo +\item{} foo -\item foo +\item{} foo -\item foo +\item{} foo \end{itemize} 5 \begin{enumerate} -\item foo +\item{} foo -\item foo +\item{} foo -\item foo +\item{} foo \end{enumerate} bar \begin{enumerate} -\item foo +\item{} foo -\item foo +\item{} foo -\item foo +\item{} foo \end{enumerate} bar \begin{enumerate} -\item foo +\item{} foo -\item foo +\item{} foo -\item foo +\item{} foo \end{enumerate} 10 \begin{itemize} -\item foo +\item{} foo -\item foo +\item{} foo -\item foo +\item{} foo \end{itemize} bar \begin{itemize} -\item foo +\item{} foo -\item foo +\item{} foo -\item foo +\item{} foo \end{itemize} bar \begin{itemize} -\item foo +\item{} foo bar -\item foo +\item{} foo bar -\item foo +\item{} foo bar \end{itemize} diff --git a/tests/MMD6Tests/Edge Cases.tex b/tests/MMD6Tests/Edge Cases.tex index ff9ba13..dee0eb4 100644 --- a/tests/MMD6Tests/Edge Cases.tex +++ b/tests/MMD6Tests/Edge Cases.tex @@ -3,7 +3,7 @@ \input{mmd6-article-begin} \begin{itemize} -\item foo +\item{} foo bar \end{itemize} @@ -11,21 +11,21 @@ bar foo \begin{itemize} -\item bar +\item{} bar \end{itemize} foo \begin{enumerate} -\item bar +\item{} bar \end{enumerate} foo \begin{enumerate} -\item bar +\item{} bar \end{enumerate} diff --git a/tests/MMD6Tests/Fenced Code Blocks.tex b/tests/MMD6Tests/Fenced Code Blocks.tex index d439f95..e1b060d 100644 --- a/tests/MMD6Tests/Fenced Code Blocks.tex +++ b/tests/MMD6Tests/Fenced Code Blocks.tex @@ -13,13 +13,13 @@ bar \end{verbatim} \begin{itemize} -\item foo +\item{} foo \begin{verbatim} *foo* \end{verbatim} -\item foo +\item{} foo \begin{verbatim} *foo* diff --git a/tests/MMD6Tests/Integrated.tex b/tests/MMD6Tests/Integrated.tex index 14bb7f2..8654f14 100644 --- a/tests/MMD6Tests/Integrated.tex +++ b/tests/MMD6Tests/Integrated.tex @@ -1,5 +1,9 @@ \input{mmd6-article-leader} \def\mytitle{Integrated} +\longnewglossaryentry{term}{name=term}{A term to be defined.} + +\newacronym{MMD}{MMD}{MultiMarkdown} + \input{mmd6-article-begin} This file is a designed as a single test that incorporates most of the @@ -13,9 +17,9 @@ when developing a new output format. paragraph \begin{itemize} -\item list +\item{} list -\item items +\item{} items \end{itemize} @@ -43,11 +47,11 @@ blockquote \label{escaped} \begin{enumerate} -\item \$ +\item{} \$ -\item \# +\item{} \# -\item [ +\item{} [ \end{enumerate} @@ -130,6 +134,16 @@ baz bat* \begin{center}\rule{3in}{0.4pt}\end{center} +\part{Glossary } +\label{glossary} + +\gls{term} + +\part{Abbreviations} +\label{abbreviations} + +\gls{MMD} + \begin{thebibliography}{0} \bibitem{inlinecitation} diff --git a/tests/MMD6Tests/Markdown Syntax.tex b/tests/MMD6Tests/Markdown Syntax.tex index e88faa4..3f5368f 100644 --- a/tests/MMD6Tests/Markdown Syntax.tex +++ b/tests/MMD6Tests/Markdown Syntax.tex @@ -2,53 +2,53 @@ \label{markdown:syntax} \begin{itemize} -\item \autoref{overview} +\item{} \autoref{overview} \begin{itemize} -\item \autoref{philosophy} +\item{} \autoref{philosophy} -\item Inline HTML (\autoref{html}) +\item{} Inline HTML (\autoref{html}) -\item Automatic Escaping for Special Characters (\autoref{autoescape}) +\item{} Automatic Escaping for Special Characters (\autoref{autoescape}) \end{itemize} -\item Block Elements (\autoref{block}) +\item{} Block Elements (\autoref{block}) \begin{itemize} -\item Paragraphs and Line Breaks (\autoref{p}) +\item{} Paragraphs and Line Breaks (\autoref{p}) -\item Headers (\autoref{header}) +\item{} Headers (\autoref{header}) -\item Blockquotes (\autoref{blockquote}) +\item{} Blockquotes (\autoref{blockquote}) -\item Lists (\autoref{list}) +\item{} Lists (\autoref{list}) -\item Code Blocks (\autoref{precode}) +\item{} Code Blocks (\autoref{precode}) -\item Horizontal Rules (\autoref{hr}) +\item{} Horizontal Rules (\autoref{hr}) \end{itemize} -\item Span Elements (\autoref{span}) +\item{} Span Elements (\autoref{span}) \begin{itemize} -\item Links (\autoref{link}) +\item{} Links (\autoref{link}) -\item Emphasis (\autoref{em}) +\item{} Emphasis (\autoref{em}) -\item \autoref{code} +\item{} \autoref{code} -\item Images (\autoref{img}) +\item{} Images (\autoref{img}) \end{itemize} -\item Miscellaneous (\autoref{misc}) +\item{} Miscellaneous (\autoref{misc}) \begin{itemize} -\item Backslash Escapes (\autoref{backslash}) +\item{} Backslash Escapes (\autoref{backslash}) -\item Automatic Links (\autoref{autolink}) +\item{} Automatic Links (\autoref{autolink}) \end{itemize} @@ -649,16 +649,16 @@ on a line by itself: That is: \begin{itemize} -\item Square brackets containing the link identifier (optionally +\item{} Square brackets containing the link identifier (optionally indented from the left margin using up to three spaces); -\item followed by a colon; +\item{} followed by a colon; -\item followed by one or more spaces (or tabs); +\item{} followed by one or more spaces (or tabs); -\item followed by the URL for the link; +\item{} followed by the URL for the link; -\item optionally followed by a title attribute for the link, enclosed +\item{} optionally followed by a title attribute for the link, enclosed in double or single quotes, or enclosed in parentheses. \end{itemize} @@ -925,12 +925,12 @@ Inline image syntax looks like this: That is: \begin{itemize} -\item An exclamation mark: \texttt{!}; +\item{} An exclamation mark: \texttt{!}; -\item followed by a set of square brackets, containing the \texttt{alt} +\item{} followed by a set of square brackets, containing the \texttt{alt} attribute text for the image; -\item followed by a set of parentheses, containing the URL or path to +\item{} followed by a set of parentheses, containing the URL or path to the image, and an optional \texttt{title} attribute enclosed in double or single quotes. diff --git a/tests/MMD6Tests/Nested Lists.tex b/tests/MMD6Tests/Nested Lists.tex index 3f2ccc4..a87f901 100644 --- a/tests/MMD6Tests/Nested Lists.tex +++ b/tests/MMD6Tests/Nested Lists.tex @@ -3,24 +3,24 @@ \input{mmd6-article-begin} \begin{itemize} -\item foo +\item{} foo \begin{itemize} -\item bar +\item{} bar \end{itemize} -\item foo +\item{} foo \begin{itemize} -\item bar +\item{} bar \end{itemize} -\item foo +\item{} foo \begin{itemize} -\item bar +\item{} bar \end{itemize} @@ -29,24 +29,24 @@ bar \begin{itemize} -\item foo +\item{} foo \begin{itemize} -\item bar +\item{} bar \end{itemize} -\item foo +\item{} foo \begin{itemize} -\item bar +\item{} bar \end{itemize} -\item foo +\item{} foo \begin{itemize} -\item bar +\item{} bar \end{itemize} @@ -55,24 +55,24 @@ bar bar \begin{itemize} -\item foo +\item{} foo \begin{itemize} -\item bar +\item{} bar \end{itemize} -\item foo +\item{} foo \begin{itemize} -\item bar +\item{} bar \end{itemize} -\item foo +\item{} foo \begin{itemize} -\item bar +\item{} bar \end{itemize} @@ -81,24 +81,24 @@ bar 5 \begin{itemize} -\item foo +\item{} foo \begin{itemize} -\item bar +\item{} bar \end{itemize} -\item foo +\item{} foo \begin{itemize} -\item bar +\item{} bar \end{itemize} -\item foo +\item{} foo \begin{itemize} -\item bar +\item{} bar \end{itemize} @@ -107,24 +107,24 @@ bar bar \begin{itemize} -\item foo +\item{} foo \begin{itemize} -\item bar +\item{} bar \end{itemize} -\item foo +\item{} foo \begin{itemize} -\item bar +\item{} bar \end{itemize} -\item foo +\item{} foo \begin{itemize} -\item bar +\item{} bar \end{itemize} diff --git a/tests/MMD6Tests/Reference Footnotes.tex b/tests/MMD6Tests/Reference Footnotes.tex index 489179b..d98dd5d 100644 --- a/tests/MMD6Tests/Reference Footnotes.tex +++ b/tests/MMD6Tests/Reference Footnotes.tex @@ -12,7 +12,7 @@ foo.\footnote{foo \emph{bar} \begin{itemize} -\item bat +\item{} bat \end{itemize}} diff --git a/tests/MMD6Tests/Table of Contents.tex b/tests/MMD6Tests/Table of Contents.tex index 72886c7..4b4fb19 100644 --- a/tests/MMD6Tests/Table of Contents.tex +++ b/tests/MMD6Tests/Table of Contents.tex @@ -4,39 +4,39 @@ \begin{itemize} -\item Second Level (\autoref{secondlevel}) +\item{} Second Level (\autoref{secondlevel}) -\item First Level (\autoref{firstlevel}) +\item{} First Level (\autoref{firstlevel}) \begin{itemize} -\item Second Level b (\autoref{secondlevelb}) +\item{} Second Level b (\autoref{secondlevelb}) \begin{itemize} -\item Third Level (\autoref{thirdlevel}) +\item{} Third Level (\autoref{thirdlevel}) \end{itemize} -\item Second Level c (\autoref{secondlevelc}) +\item{} Second Level c (\autoref{secondlevelc}) \end{itemize} -\item First Level b (\autoref{firstlevelb}) +\item{} First Level b (\autoref{firstlevelb}) \begin{itemize} -\item Third Level b (\autoref{thirdlevelb}) +\item{} Third Level b (\autoref{thirdlevelb}) -\item Second level d (\autoref{secondleveld}) +\item{} Second level d (\autoref{secondleveld}) \begin{itemize} -\item Third level d (\autoref{thirdleveld}) +\item{} Third level d (\autoref{thirdleveld}) \begin{itemize} -\item Fourth level d (\autoref{fourthleveld}) +\item{} Fourth level d (\autoref{fourthleveld}) \end{itemize} @@ -44,11 +44,11 @@ \end{itemize} -\item First level (\autoref{firstlevele}) +\item{} First level (\autoref{firstlevele}) \begin{itemize} -\item Second level (\autoref{secondlevele}) +\item{} Second level (\autoref{secondlevele}) \end{itemize} -- 2.40.0