footnote * footnote_new(const char * source, token * label, token * content, bool lowercase) {
footnote * f = malloc(sizeof(footnote));
+ token * walker;
if (f) {
f->label = label;
token_trim_leading_whitespace(content, source);
default:
+ // Trim trailing newlines
+ walker = content->tail;
+ while (walker) {
+ switch (walker->type) {
+ case TEXT_NL:
+ case TEXT_NL_SP:
+ content->tail = walker->prev;
+ token_free(walker);
+ walker = content->tail;
+ walker->next = NULL;
+ break;
+
+ default:
+ walker = NULL;
+ break;
+ }
+ }
+
f->content = token_new_parent(content, BLOCK_PARA);
f->free_para = true;
break;
<office:text>
<text:h text:outline-level="1"><text:bookmark text:name="citep"/>citep </text:h>
-<text:p text:style-name="Standard"><text:note text:id="cite1" text:note-class="endnote"><text:note-body><text:p text:style-name="Footnote">John Doe. <text:span text:style-name="MMD-Italic">A Totally Fake Book 1</text:span>. Vanity Press, 2006.
-</text:p></text:note-body></text:note></text:p>
+<text:p text:style-name="Standard"><text:note text:id="cite1" text:note-class="endnote"><text:note-body><text:p text:style-name="Footnote">John Doe. <text:span text:style-name="MMD-Italic">A Totally Fake Book 1</text:span>. Vanity Press, 2006.</text:p></text:note-body></text:note></text:p>
<text:p text:style-name="Standard"><text:span text:style-name="Footnote_20_anchor"><text:note-ref text:note-class="endnote" text:reference-format="text" text:ref-name="cite1">1</text:note-ref></text:span>[]</text:p>
<text:p text:style-name="Standard"><text:span text:style-name="Footnote_20_anchor"><text:note-ref text:note-class="endnote" text:reference-format="text" text:ref-name="cite1">1</text:note-ref></text:span></text:p>
-<text:p text:style-name="Standard"><text:span text:style-name="Footnote_20_anchor"><text:note-ref text:note-class="endnote" text:reference-format="text" text:ref-name="cite1">1</text:note-ref></text:span><text:note text:id="cite2" text:note-class="endnote"><text:note-body><text:p text:style-name="Footnote">John Doe. <text:span text:style-name="MMD-Italic">A Totally Fake Book 2</text:span>. Vanity Press, 2006.
-</text:p></text:note-body></text:note></text:p>
+<text:p text:style-name="Standard"><text:span text:style-name="Footnote_20_anchor"><text:note-ref text:note-class="endnote" text:reference-format="text" text:ref-name="cite1">1</text:note-ref></text:span><text:note text:id="cite2" text:note-class="endnote"><text:note-body><text:p text:style-name="Footnote">John Doe. <text:span text:style-name="MMD-Italic">A Totally Fake Book 2</text:span>. Vanity Press, 2006.</text:p></text:note-body></text:note></text:p>
<text:h text:outline-level="1"><text:bookmark text:name="citet"/>citet </text:h>
<ol>
<li id="cn:1">
-<p>John Doe. <em>A Totally Fake Book 1</em>. Vanity Press, 2006.
- <a href="#cnref:1" title="return to body" class="reversecitation"> ↩</a></p>
+<p>John Doe. <em>A Totally Fake Book 1</em>. Vanity Press, 2006. <a href="#cnref:1" title="return to body" class="reversecitation"> ↩</a></p>
</li>
<li id="cn:2">
-<p>John Doe. <em>A Totally Fake Book 2</em>. Vanity Press, 2006.
- <a href="#cnref:2" title="return to body" class="reversecitation"> ↩</a></p>
+<p>John Doe. <em>A Totally Fake Book 2</em>. Vanity Press, 2006. <a href="#cnref:2" title="return to body" class="reversecitation"> ↩</a></p>
</li>
<li id="cn:3">
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<opml version="1.0">
+<head><title>Citations</title></head>
+<body>
+<outline text="(Untitled Preamble)" _note=" "></outline>
+<outline text="citep " _note=" [#foo1] [#foo1][] [p. 123][#foo1] [][#foo1] [foo\]\[bar][#foo1] [#foo1][#foo2] "></outline>
+<outline text="citet " _note=" [#foo1;] [#foo1;][] [p. 123][#foo1;] [][#foo1;] [foo\]\[bar][#foo1;] [#foo1;][#foo2;] [Not Cited][#foo3] [#foo1]: John Doe. *A Totally Fake Book 1*. Vanity Press, 2006. [#foo2]: John Doe. *A Totally Fake Book 2*. Vanity Press, 2006. [#foo3]: John Doe. *A Totally Fake Book 3*. Vanity Press, 2006. "></outline>
+<outline text="Metadata">
+<outline text="title" _note="Citations"/>
+<outline text="latexconfig" _note="article"/>
+</outline>
+</body>
+</opml>
+
\bibitem{foo1}
John Doe. \emph{A Totally Fake Book 1}. Vanity Press, 2006.
-
\bibitem{foo2}
John Doe. \emph{A Totally Fake Book 2}. Vanity Press, 2006.
-
\bibitem{foo3}
John Doe. \emph{A Totally Fake Book 3}. Vanity Press, 2006.
\end{thebibliography}
<text:p text:style-name="Standard">Cite.<text:note text:id="cite1" text:note-class="endnote"><text:note-body><text:p text:style-name="Footnote">Inline Citation</text:p></text:note-body></text:note></text:p>
-<text:p text:style-name="Standard">Cite.<text:note text:id="cite2" text:note-class="endnote"><text:note-body><text:p text:style-name="Footnote">bar
-
-</text:p></text:note-body></text:note></text:p>
+<text:p text:style-name="Standard">Cite.<text:note text:id="cite2" text:note-class="endnote"><text:note-body><text:p text:style-name="Footnote">bar</text:p></text:note-body></text:note></text:p>
<text:h text:outline-level="1"><text:bookmark text:name="linksandimages"/>Links and Images </text:h>
</li>
<li id="cn:2">
-<p>bar
-
- <a href="#cnref:2" title="return to body" class="reversecitation"> ↩</a></p>
+<p>bar <a href="#cnref:2" title="return to body" class="reversecitation"> ↩</a></p>
</li>
</ol>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<opml version="1.0">
+<head><title>Integrated</title></head>
+<body>
+<outline text="(Untitled Preamble)" _note=" This file is a designed as a single test that incorporates most of the *commonly* used MultiMarkdown features. This allows a single test file to identify common structures that are not supported yet -- particularly useful when developing a new output format. "></outline>
+<outline text="Basic Blocks " _note=" paragraph * list * items ``` fenced code ``` 	indented 	code > blockquote `code span` *emph* and **strong** and ***both*** _emph_ and __strong__ and ___both___ "><outline text="Escapes [escaped]" _note=" 1. \$ 2. \# 3. \[ "></outline>
+</outline>
+<outline text="Footnotes " _note=" Foo.[^This is an inline footnote] Bar.[^foot] [^foot]: And a reference footnote. Cite.[#Inline Citation] Cite.[#foo] [#foo]: bar "></outline>
+<outline text="Links and Images " _note=" [link](http://foo.net/) and [link] [link]: http://bar.net "title" class="custom"  [Math] [foo][math] [bar][foo1] [bar][foo2] [foo1]: #bar [foo2]: #bar "></outline>
+<outline text="Math " _note=" foo \\({e}^{i\pi }+1=0\\) bar \\[ {x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a} \\] foo ${e}^{i\pi }+1=0$ bar foo ${e}^{i\pi }+1=0$, bar $${x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a}$$ "></outline>
+<outline text="Smart Quotes " _note=" "foo" and 'bar' -- with --- dashes... "></outline>
+<outline text="CriticMarkup " _note=" {++foo++} {--bar--} {~~foo~>bar~~} {>>foo<<} {==bar==} "></outline>
+<outline text="Definition Lists " _note=" foo bar :	*foo bar :	baz bat* "></outline>
+<outline text="Horizontal Rules " _note=" ---- "></outline>
+<outline text="Glossary " _note=" [?term] [?term]: A term to be defined. "></outline>
+<outline text="Abbreviations" _note=" [>MMD] [>MMD]: MultiMarkdown "></outline>
+<outline text="Metadata">
+<outline text="title" _note="Integrated"/>
+<outline text="latexconfig" _note="article"/>
+</outline>
+</body>
+</opml>
+
\bibitem{foo}
bar
-
-
\end{thebibliography}
\input{mmd6-article-footer}