t->can_open = 0;
}
+ // We need to be contiguous in order to match
+ if (t->can_close) {
+ offset = t->start;
+ t->can_close = 0;
+
+ while ((offset > 0) && !(char_is_whitespace_or_line_ending(str[offset - 1]))) {
+ if (str[offset - 1] == str[t->start]) {
+ t->can_close = 1;
+ break;
+ }
+
+ offset--;
+ }
+ }
+
// We need to be contiguous in order to match
if (t->can_open) {
offset = t->start + t->len;
t->can_open = 0;
while (!(char_is_whitespace_or_line_ending(str[offset]))) {
- if (str[offset] == str[t->start])
+ if (str[offset] == str[t->start]) {
t->can_open = 1;
+ break;
+ }
+
offset++;
}
// Are we a standalone, e.g x^2
- if (!t->can_open) {
+ if (!t->can_close && !t->can_open) {
offset = t->start + t->len;
while (!char_is_whitespace_or_line_ending_or_punctuation(str[offset]))
offset++;
}
}
- // We need to be contiguous in order to match
- if (t->can_close) {
- offset = t->start;
- t->can_close = 0;
-
- while ((offset > 0) && !(char_is_whitespace_or_line_ending(str[offset - 1]))) {
- if (str[offset - 1] == str[t->start])
- t->can_close = 1;
- offset--;
- }
- }
break;
}
<text:p text:style-name="Standard">x<text:span text:style-name="MMD-Subscript">2</text:span> 3~</text:p>
<text:p text:style-name="Standard">x<text:span text:style-name="MMD-Subscript">2</text:span> 3<text:span text:style-name="MMD-Subscript">2</text:span></text:p>
+
+<text:p text:style-name="Standard">H<text:span text:style-name="MMD-Subscript">2</text:span>O</text:p>
+
+<text:p text:style-name="Standard">15</text:p>
+
+<text:p text:style-name="Standard">CH<text:span text:style-name="MMD-Subscript">3</text:span>CH<text:span text:style-name="MMD-Subscript">2</text:span>CH<text:span text:style-name="MMD-Subscript">2</text:span>CH<text:span text:style-name="MMD-Subscript">3</text:span></text:p>
+
+<text:p text:style-name="Standard">CH<text:span text:style-name="MMD-Subscript">3</text:span>CH<text:span text:style-name="MMD-Subscript">2</text:span>CH<text:span text:style-name="MMD-Subscript">2</text:span>CH~3</text:p>
</office:text>
</office:body>
</office:document>
<p>x<sub>2</sub> 3<sub>2</sub></p>
+<p>H<sub>2</sub>O</p>
+
+<p>15</p>
+
+<p>CH<sub>3</sub>CH<sub>2</sub>CH<sub>2</sub>CH<sub>3</sub></p>
+
+<p>CH<sub>3</sub>CH<sub>2</sub>CH<sub>2</sub>CH~3</p>
+
</body>
</html>
<p>x~2 3~</p>
<p>x~2 3~2</p>
+
+<p>H~2~O</p>
+
+<p>15</p>
+
+<p>CH~3~CH~2~CH~2~CH~3~</p>
+
+<p>CH~3~CH~2~CH~2~CH~3</p>
x\textsubscript{2} 3\textsubscript{2}
+H\textsubscript{2}O
+
+15
+
+CH\textsubscript{3}CH\textsubscript{2}CH\textsubscript{2}CH\textsubscript{3}
+
+CH\textsubscript{3}CH\textsubscript{2}CH\textsubscript{2}CH\ensuremath{\sim}3
+
\input{mmd6-article-footer}
\end{document}
x~2 3~
x~2 3~2
+
+H~2~O
+
+15
+
+CH~3~CH~2~CH~2~CH~3~
+
+CH~3~CH~2~CH~2~CH~3
\ No newline at end of file