line->type = (first_child->type - HASH1) + LINE_ATX_1;
first_child->type = (line->type - LINE_ATX_1) + MARKER_H1;
+ t = line->child->tail;
+
// Strip trailing '#' sequence if present
- if (line->child->tail->type == TEXT_NL) {
- if ((line->child->tail->prev->type >= HASH1) &&
- (line->child->tail->prev->type <= HASH6)) {
- line->child->tail->prev->type -= HASH1;
- line->child->tail->prev->type += MARKER_H1;
- }
- } else {
- if ((line->child->tail->type >= HASH1) &&
- (line->child->tail->type <= HASH6)) {
- line->child->tail->type -= HASH1;
- line->child->tail->type += MARKER_H1;
+ while (t) {
+ switch (t->type) {
+ case INDENT_TAB:
+ case INDENT_SPACE:
+ case NON_INDENT_SPACE:
+ case TEXT_NL:
+ case TEXT_LINEBREAK:
+ case TEXT_LINEBREAK_SP:
+ t = t->prev;
+ break;
+ case HASH1:
+ case HASH2:
+ case HASH3:
+ case HASH4:
+ case HASH5:
+ case HASH6:
+ t->type -= HASH1;
+ t->type += MARKER_H1;
+ t = NULL;
+ break;
+ default:
+ // Break out of loop
+ t = NULL;
}
}
} else {
}
char * temp;
+ char * stop;
switch (t->type) {
case AMPERSAND:
case MARKER_H5:
case MARKER_H6:
temp = (char *) &source[t->start];
+ stop = (char *) &source[t->start + t->len];
- while (temp) {
+ while (temp < stop) {
switch (*temp) {
case '#':
print_const("#");
break;
default:
- temp = NULL;
+ temp = stop;
break;
}
}
bool temp_bool = 0;
token * temp_token = NULL;
footnote * temp_note = NULL;
+ size_t temp_size;
switch (t->type) {
case DOC_START_TOKEN:
free(temp_char);
}
- trim_trailing_whitespace_d_string(out);
+ temp_size = 0;
+
+ while (temp_size != out->currentStringLength) {
+ temp_size = out->currentStringLength;
+
+ trim_trailing_whitespace_d_string(out);
+ if (strcmp(&(out->str[out->currentStringLength - 11]), "<text:tab/>") == 0) {
+ d_string_erase(out, out->currentStringLength - 11, 11);
+ }
+ }
print_const("</text:h>");
scratch->padded = 0;
<text:p text:style-name="Standard"><text:a xlink:type="simple" xlink:href="#bar">bar</text:a></text:p>
<text:p text:style-name="Standard"><text:a xlink:type="simple" xlink:href="#bar">foo</text:a></text:p>
+
+<text:p text:style-name="Standard">10</text:p>
+
+<text:h text:outline-level="1"><text:bookmark text:name="bar"/>foo</text:h>
+
+<text:h text:outline-level="1"><text:bookmark text:name="bar"/>foo</text:h>
+
+<text:h text:outline-level="1"><text:bookmark text:name="bar"/>foo</text:h>
</office:text>
</office:body>
</office:document>
<p><a href="#bar">foo</a></p>
+<p>10</p>
+
+<h1 id="bar">foo</h1>
+
+<h1 id="bar">foo</h1>
+
+<h1 id="bar">foo</h1>
+
</body>
</html>
<p>[bar]</p>
<p>[foo][bar]</p>
+
+<p>10</p>
+
+<h1>foo [bar]</h1>
+
+<h1>foo [bar]</h1>
+
+<h1>foo [bar]</h1>
<outline text="foo [bar][bat][baz]" _note=" 5 "></outline>
<outline text="foo [bar]" _note=" "></outline>
<outline text="*foo* bar" _note=" "></outline>
-<outline text="*foo bar*" _note=" [bar] [foo][bar] "></outline>
+<outline text="*foo bar*" _note=" [bar] [foo][bar] 10 "></outline>
+<outline text="foo [bar]" _note=" "></outline>
+<outline text="foo [bar]" _note=" "></outline>
+<outline text="foo [bar]" _note=""></outline>
<outline text=">>Metadata<<">
<outline text="title" _note="Advanced Headers"/>
<outline text="latexconfig" _note="article"/>
foo (\autoref{bar})
+10
+
+\part{foo}
+\label{bar}
+
+\part{foo}
+\label{bar}
+
+\part{foo}
+\label{bar}
+
\input{mmd6-article-footer}
\end{document}
[bar]
[foo][bar]
+
+10
+
+# foo [bar] #
+
+# foo [bar] #
+
+# foo [bar] #
\ No newline at end of file
<h3>baz</h3>
-<h4>foo ##</h4>
+<h4>foo</h4>
-<h5>bar ##</h5>
+<h5>bar</h5>
<h6>baz</h6>