From: Fletcher T. Penney Date: Tue, 26 Jun 2018 10:23:54 +0000 (-0400) Subject: FIXED: Escape square brackets, e.g. '{[foo]}' (addresses #128 and #129) X-Git-Tag: 6.4.0^2~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ea8ed5636541ea642a3af5ad06cfac2e7524a5b;p=multimarkdown FIXED: Escape square brackets, e.g. '{[foo]}' (addresses #128 and #129) --- diff --git a/Sources/libMultiMarkdown/latex.c b/Sources/libMultiMarkdown/latex.c index c758811..a01052d 100644 --- a/Sources/libMultiMarkdown/latex.c +++ b/Sources/libMultiMarkdown/latex.c @@ -1287,7 +1287,9 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat } // No links exist, so treat as normal + print_const("{"); mmd_export_token_tree_latex(out, source, t->child, scratch); + print_const("}"); break; case PAIR_BRACKET_ABBREVIATION: @@ -1302,9 +1304,9 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat if (temp_short == -1) { // This instance is not properly formed - print_const("[>"); + print_const("{[>"); mmd_export_token_tree_latex(out, source, t->child->next, scratch); - print_const("]"); + print_const("]}"); break; } @@ -1328,7 +1330,9 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat } } else { // Note-based syntax disabled + print_const("{"); mmd_export_token_tree_latex(out, source, t->child, scratch); + print_const("}"); } break; @@ -1369,9 +1373,9 @@ parse_citation: // Ensure we aren't using BibTeX if (!scratch->bibtex_file) { // This instance is not properly formed - print_const("[#"); + print_const("{[#"); mmd_export_token_tree_latex(out, source, t->child->next, scratch); - print_const("]"); + print_const("]}"); free(temp_char); break; @@ -1451,7 +1455,9 @@ parse_citation: free(temp_char); } else { // Note-based syntax disabled + print_const("{"); mmd_export_token_tree_latex(out, source, t->child, scratch); + print_const("}"); } break; @@ -1466,9 +1472,9 @@ parse_citation: if (temp_short == -1) { // This instance is not properly formed - print_const("[?"); + print_const("{[?"); mmd_export_token_tree_latex(out, source, t->child->next, scratch); - print_const("]"); + print_const("]}"); break; } @@ -1500,7 +1506,9 @@ parse_citation: } } else { // Note-based syntax disabled + print_const("{"); mmd_export_token_tree_latex(out, source, t->child, scratch); + print_const("}"); } break; @@ -1518,7 +1526,7 @@ parse_citation: if (temp_short == -1) { // This instance is not properly formed - print_const("[?"); + print_const("{[?"); if (t->child) { mmd_export_token_tree_latex(out, source, t->child->next, scratch); @@ -1526,7 +1534,7 @@ parse_citation: print_token(t); } - print_const("]"); + print_const("]}"); break; } @@ -1566,7 +1574,9 @@ parse_citation: } } else { // Note-based syntax disabled + print_const("{"); mmd_export_token_tree_latex(out, source, t->child, scratch); + print_const("}"); } break; @@ -1578,7 +1588,9 @@ parse_citation: if (temp_char2) { mmd_print_string_latex(out, temp_char2); } else { + print_const("{"); mmd_export_token_tree_latex(out, source, t->child, scratch); + print_const("}"); } // Don't free temp_char2 (it belongs to meta *) diff --git a/tests/Beamer/What Is MMD.tex b/tests/Beamer/What Is MMD.tex index 3947133..4e2983d 100644 --- a/tests/Beamer/What Is MMD.tex +++ b/tests/Beamer/What Is MMD.tex @@ -320,7 +320,7 @@ It uses the \texttt{beamer} XSLT file, and the \texttt{keynote-gradient} beamer \begin{thebibliography}{0} \bibitem{gruber} -John Gruber. Daring Fireball: Markdown. [Cited January 2006]. Available from \href{http://daringfireball.net/projects/markdown/}{http:\slash \slash daringfireball.net\slash projects\slash markdown\slash }. +John Gruber. Daring Fireball: Markdown. {[Cited January 2006]}. Available from \href{http://daringfireball.net/projects/markdown/}{http:\slash \slash daringfireball.net\slash projects\slash markdown\slash }. diff --git a/tests/MMD6Tests/Citations.tex b/tests/MMD6Tests/Citations.tex index ed445e8..06997f8 100644 --- a/tests/MMD6Tests/Citations.tex +++ b/tests/MMD6Tests/Citations.tex @@ -7,7 +7,7 @@ ~\citep{foo1} -~\citep{foo1}[] +~\citep{foo1}{[]} ~\citep[p. 123]{foo1} @@ -22,7 +22,7 @@ \citet{foo1} -\citet{foo1}[] +\citet{foo1}{[]} \citet[p. 123]{foo1} diff --git a/tests/MMD6Tests/Emph and Strong Star.tex b/tests/MMD6Tests/Emph and Strong Star.tex index 5b1cf15..77a0946 100644 --- a/tests/MMD6Tests/Emph and Strong Star.tex +++ b/tests/MMD6Tests/Emph and Strong Star.tex @@ -118,7 +118,7 @@ foo \textbf{1. bar} \textbf{foo:} bar -\emph{foo [bar]} +\emph{foo {[bar]}} 50 diff --git a/tests/MMD6Tests/Emph and Strong UL.tex b/tests/MMD6Tests/Emph and Strong UL.tex index 07a765b..7282b81 100644 --- a/tests/MMD6Tests/Emph and Strong UL.tex +++ b/tests/MMD6Tests/Emph and Strong UL.tex @@ -118,7 +118,7 @@ foo \textbf{1. bar} \textbf{foo:} bar -\emph{foo [bar]} +\emph{foo {[bar]}} 50 diff --git a/tests/MMD6Tests/Fuzz.tex b/tests/MMD6Tests/Fuzz.tex index c446704..4256a90 100644 --- a/tests/MMD6Tests/Fuzz.tex +++ b/tests/MMD6Tests/Fuzz.tex @@ -26,7 +26,7 @@ foo2 (\autoref{bar}) ]: And aÄe footn.I\textsuperscript{Thi1}. \$ -[MMD]: +{[MMD]}: f \gls{o o} f \gls{o o} diff --git a/tests/MMD6Tests/Inline Links.tex b/tests/MMD6Tests/Inline Links.tex index 2969cbe..d9b93ce 100644 --- a/tests/MMD6Tests/Inline Links.tex +++ b/tests/MMD6Tests/Inline Links.tex @@ -30,9 +30,9 @@ Just a \href{http://url/file.txt}{URL}\footnote{\href{http://url/file.txt}{http: \href{/url/file.txt}{URL and title}\footnote{\href{/url/file.txt}{\slash url\slash file.txt}}. -[URL and title] (\slash url\slash file.txt ``\emph{title}''). +{[URL and title]} (\slash url\slash file.txt ``\emph{title}''). -[URL and title] +{[URL and title]} (\slash url\slash file.txt ``\emph{title}''). \href{/url/file.txt}{URL and title}\footnote{\href{/url/file.txt}{\slash url\slash file.txt}}. diff --git a/tests/MMD6Tests/Markdown Syntax.tex b/tests/MMD6Tests/Markdown Syntax.tex index 5f09774..222c2b7 100644 --- a/tests/MMD6Tests/Markdown Syntax.tex +++ b/tests/MMD6Tests/Markdown Syntax.tex @@ -596,7 +596,7 @@ following lines will produce a horizontal rule: Markdown supports two style of links: \emph{inline} and \emph{reference}. -In both styles, the link text is delimited by [square brackets]. +In both styles, the link text is delimited by {[square brackets]}. To create an inline link, use a set of regular parentheses immediately after the link text's closing square bracket. Inside the parentheses, diff --git a/tests/MMD6Tests/Special Characters.tex b/tests/MMD6Tests/Special Characters.tex index 0b5b317..ea410f1 100644 --- a/tests/MMD6Tests/Special Characters.tex +++ b/tests/MMD6Tests/Special Characters.tex @@ -4,11 +4,11 @@ \{foo\} -[foo] +{[foo]} \{\{foo\}\} -[[foo]] +{[{[foo]}]} (foo) diff --git a/tests/MMD6Tests/Variables.tex b/tests/MMD6Tests/Variables.tex index fcf3139..eb999dd 100644 --- a/tests/MMD6Tests/Variables.tex +++ b/tests/MMD6Tests/Variables.tex @@ -8,7 +8,7 @@ foo: bar bar foo bar foo bar -[%bar] +{[%bar]} **foo**