]> granicus.if.org Git - multimarkdown/commitdiff
FIXED: Escape square brackets, e.g. '{[foo]}' (addresses #128 and #129)
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Tue, 26 Jun 2018 10:23:54 +0000 (06:23 -0400)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Tue, 26 Jun 2018 10:23:54 +0000 (06:23 -0400)
Sources/libMultiMarkdown/latex.c
tests/Beamer/What Is MMD.tex
tests/MMD6Tests/Citations.tex
tests/MMD6Tests/Emph and Strong Star.tex
tests/MMD6Tests/Emph and Strong UL.tex
tests/MMD6Tests/Fuzz.tex
tests/MMD6Tests/Inline Links.tex
tests/MMD6Tests/Markdown Syntax.tex
tests/MMD6Tests/Special Characters.tex
tests/MMD6Tests/Variables.tex

index c7588113548bb12316bbbc269d703ea5ab8fdc35..a01052d3169da0c3c2ed78b22c4fe742192c5c4d 100644 (file)
@@ -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 *)
index 39471333c4ebbc6bd0d3ad8077e43c7ca98b8697..4e2983d6ee6057a3d1f97dfe05b9bb22fc58cb97 100644 (file)
@@ -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 }.
 
 
 
index ed445e8dff06a06c0a62dc32eb22dfffd67ca653..06997f85785896b51c83ae9c7449c4e3bc9c88a5 100644 (file)
@@ -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}
 
index 5b1cf15cce6c967fe89d2ccad3c0dd852bd7bd6e..77a094658b3d21f609c8f41ac5a6c5c48fa31dd1 100644 (file)
@@ -118,7 +118,7 @@ foo \textbf{1. bar}
 
 \textbf{foo:} bar
 
-\emph{foo [bar]}
+\emph{foo {[bar]}}
 
 50
 
index 07a765b92f2cb41fa111056c6e27be025c780f22..7282b81cb3bb2de9ece333a58636d019454c0bb3 100644 (file)
@@ -118,7 +118,7 @@ foo \textbf{1. bar}
 
 \textbf{foo:} bar
 
-\emph{foo [bar]}
+\emph{foo {[bar]}}
 
 50
 
index c4467045a3a25d4e97e44675ef12a937929d66ed..4256a90e7664375e3d9b7a7aabc2f2060f05b9d9 100644 (file)
@@ -26,7 +26,7 @@ foo2 (\autoref{bar})
 
 ]: And aÄe footn.I\textsuperscript{Thi1}. \$
 
-[MMD]:
+{[MMD]}:
 
 f \gls{o o} f \gls{o o}
 
index 2969cbe060a6a0bb85c3477dab074b7ed5ef4edc..d9b93ce43c587bc5dde7bee1090ed71356cf5946 100644 (file)
@@ -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}}.
index 5f0977402496511e041381d2be004d477d654aa9..222c2b749d23b929986c8ca6b75e4a955a7871bd 100644 (file)
@@ -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,
index 0b5b3171a738e896f1db8fd8a238020ad4dfc1a1..ea410f1160c0a9fa9b99ecde4c92c3e0cbb9f5cd 100644 (file)
@@ -4,11 +4,11 @@
 
 \{foo\}
 
-[foo]
+{[foo]}
 
 \{\{foo\}\}
 
-[[foo]]
+{[{[foo]}]}
 
 (foo)
 
index fcf31390fad5fdbc39abb3ba93e5885a3c9f88ad..eb999dd5ba96c824cf1c20ea046b35bd4b628fb3 100644 (file)
@@ -8,7 +8,7 @@ foo:    bar
 
 bar foo bar foo bar
 
-[%bar]
+{[%bar]}
 
 **foo**