From: Fletcher T. Penney
Date: Fri, 17 Nov 2017 14:54:23 +0000 (-0500)
Subject: FIXED: Fix bug with multiple footnotes in single paragraph when exporting to LaTeX
X-Git-Tag: 6.2.3^2~2
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e80f5e6d20e43e1762df8daa7904810ca5420bd9;p=multimarkdown
FIXED: Fix bug with multiple footnotes in single paragraph when exporting to LaTeX
---
diff --git a/Sources/libMultiMarkdown/latex.c b/Sources/libMultiMarkdown/latex.c
index 4795fc5..81af5e0 100644
--- a/Sources/libMultiMarkdown/latex.c
+++ b/Sources/libMultiMarkdown/latex.c
@@ -1490,10 +1490,10 @@ parse_citation:
print_const("}");
} else {
// This is the first time this note was used
-
print_const("\\footnote{");
temp_note = stack_peek_index(scratch->used_footnotes, temp_short - 1);
-
+ // Reset padding counter in case of multiple footnotes in single paragraph
+ scratch->padded = 2;
mmd_export_token_tree_latex(out, source, temp_note->content, scratch);
print_const("}");
}
diff --git a/tests/MMD6Tests/Inline Citations.fodt b/tests/MMD6Tests/Inline Citations.fodt
new file mode 100644
index 0000000..50080dd
--- /dev/null
+++ b/tests/MMD6Tests/Inline Citations.fodt
@@ -0,0 +1,287 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bibliography
+
+
+
+ Inline Citations
+
+
+
+Inline. John Doe. A Totally Fake Book 1. Vanity Press, 2006.
+
+
+John Doe. A Totally Fake Book 2. Vanity Press, 2006.
+
+
+
diff --git a/tests/MMD6Tests/Inline Citations.html b/tests/MMD6Tests/Inline Citations.html
new file mode 100644
index 0000000..40f0159
--- /dev/null
+++ b/tests/MMD6Tests/Inline Citations.html
@@ -0,0 +1,29 @@
+
+
+
+
+ Inline Citations
+
+
+
+Inline. (1)
+(2)
+
+
+
+
+
+-
+
John Doe. A Totally Fake Book 1. Vanity Press, 2006. ↩
+
+
+-
+
John Doe. A Totally Fake Book 2. Vanity Press, 2006. ↩
+
+
+
+
+
+
+
+
diff --git a/tests/MMD6Tests/Inline Citations.htmlc b/tests/MMD6Tests/Inline Citations.htmlc
new file mode 100644
index 0000000..5d93776
--- /dev/null
+++ b/tests/MMD6Tests/Inline Citations.htmlc
@@ -0,0 +1,5 @@
+Title: Inline Citations
+latex config: article
+
+Inline. [#John Doe. A Totally Fake Book 1. Vanity Press, 2006.]
+[#John Doe. A Totally Fake Book 2. Vanity Press, 2006.]
diff --git a/tests/MMD6Tests/Inline Citations.tex b/tests/MMD6Tests/Inline Citations.tex
new file mode 100644
index 0000000..48bebb7
--- /dev/null
+++ b/tests/MMD6Tests/Inline Citations.tex
@@ -0,0 +1,18 @@
+\input{mmd6-article-leader}
+\def\mytitle{Inline Citations}
+\input{mmd6-article-begin}
+
+Inline. ~\citep{johndoe.atotallyfakebook1.vanitypress2006.}
+~\citep{johndoe.atotallyfakebook2.vanitypress2006.}
+
+\begin{thebibliography}{0}
+
+\bibitem{johndoe.atotallyfakebook1.vanitypress2006.}
+John Doe. \emph{A Totally Fake Book 1}. Vanity Press, 2006.
+
+\bibitem{johndoe.atotallyfakebook2.vanitypress2006.}
+John Doe. \emph{A Totally Fake Book 2}. Vanity Press, 2006.
+\end{thebibliography}
+
+\input{mmd6-article-footer}
+\end{document}
diff --git a/tests/MMD6Tests/Inline Citations.text b/tests/MMD6Tests/Inline Citations.text
new file mode 100644
index 0000000..495a82b
--- /dev/null
+++ b/tests/MMD6Tests/Inline Citations.text
@@ -0,0 +1,5 @@
+Title: Inline Citations
+latex config: article
+
+Inline. [#John Doe. *A Totally Fake Book 1*. Vanity Press, 2006.]
+[#John Doe. *A Totally Fake Book 2*. Vanity Press, 2006.]
diff --git a/tests/MMD6Tests/Inline Footnotes.fodt b/tests/MMD6Tests/Inline Footnotes.fodt
index 897aec0..9dc0540 100644
--- a/tests/MMD6Tests/Inline Footnotes.fodt
+++ b/tests/MMD6Tests/Inline Footnotes.fodt
@@ -285,6 +285,12 @@ office:mimetype="application/vnd.oasis.opendocument.text">
foo.
Inline.foo bar
+
+Inline.foo
+
+foo
+
+bar
diff --git a/tests/MMD6Tests/Inline Footnotes.html b/tests/MMD6Tests/Inline Footnotes.html
index 994877c..709a8fe 100644
--- a/tests/MMD6Tests/Inline Footnotes.html
+++ b/tests/MMD6Tests/Inline Footnotes.html
@@ -12,6 +12,8 @@
Inline.
+Inline.
+
diff --git a/tests/MMD6Tests/Inline Footnotes.htmlc b/tests/MMD6Tests/Inline Footnotes.htmlc
index f1fcf66..939174e 100644
--- a/tests/MMD6Tests/Inline Footnotes.htmlc
+++ b/tests/MMD6Tests/Inline Footnotes.htmlc
@@ -8,3 +8,5 @@ latex config: article
foo.]
Inline.[^foo bar]
+
+Inline.[^foo][^foo][^bar]
diff --git a/tests/MMD6Tests/Inline Footnotes.tex b/tests/MMD6Tests/Inline Footnotes.tex
index d3f70da..dffa9bf 100644
--- a/tests/MMD6Tests/Inline Footnotes.tex
+++ b/tests/MMD6Tests/Inline Footnotes.tex
@@ -10,5 +10,7 @@ Inline.\footnote{foo \emph{bar}
Inline.\footnote{foo \emph{bar}}
+Inline.\footnote{foo}\footnote{foo}\footnote{bar}
+
\input{mmd6-article-footer}
\end{document}
diff --git a/tests/MMD6Tests/Inline Footnotes.text b/tests/MMD6Tests/Inline Footnotes.text
index c88fc32..f98bfff 100644
--- a/tests/MMD6Tests/Inline Footnotes.text
+++ b/tests/MMD6Tests/Inline Footnotes.text
@@ -8,3 +8,5 @@ Inline.[^foo *bar*
**foo**.]
Inline.[^foo *bar*]
+
+Inline.[^foo][^foo][^bar]