]> granicus.if.org Git - multimarkdown/commitdiff
CHANGED: Update superscript/subscript algorithm to allow leading instances
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Mon, 13 Nov 2017 13:29:54 +0000 (08:29 -0500)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Mon, 13 Nov 2017 13:29:54 +0000 (08:29 -0500)
Sources/libMultiMarkdown/mmd.c
tests/MMD6Tests/Superscript.fodt
tests/MMD6Tests/Superscript.html
tests/MMD6Tests/Superscript.htmlc
tests/MMD6Tests/Superscript.tex
tests/MMD6Tests/Superscript.text

index 9d996ef39e3726564b5326f2be3a7ac367678b00..938be4ee30636dde3f189873b5f681b89ee89b7b 100644 (file)
@@ -1566,11 +1566,7 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size
 
                                offset = t->start;
 
-                               // Look left -- no whitespace to left
-                               if ((offset == 0) || (char_is_whitespace_or_line_ending_or_punctuation(str[offset - 1]))) {
-                                       t->can_open = 0;
-                               }
-
+                               // Can't close if whitespace to left
                                if ((offset != 0) && (char_is_whitespace_or_line_ending(str[offset - 1]))) {
                                        t->can_close = 0;
                                }
index 5e73b9dbfdb3c04c782b5d6def72315982bfc6df..c14c35462c9e0ddde7b9f3d01814307c6873cdc7 100644 (file)
@@ -298,7 +298,7 @@ office:mimetype="application/vnd.oasis.opendocument.text">
 
 <text:p text:style-name="Standard">~/Library/MultiMarkdown</text:p>
 
-<text:p text:style-name="Standard">^test</text:p>
+<text:p text:style-name="Standard"><text:span text:style-name="MMD-Superscript">test</text:span></text:p>
 
 <text:p text:style-name="Standard">10</text:p>
 
@@ -327,6 +327,14 @@ office:mimetype="application/vnd.oasis.opendocument.text">
 <text:p text:style-name="Standard">20</text:p>
 
 <text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">CH~4~</text:span></text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="MMD-Superscript">238</text:span>U</text:p>
+
+<text:p text:style-name="Standard">Ca<text:span text:style-name="MMD-Superscript">2+</text:span></text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="MMD-Subscript">t</text:span>p<text:span text:style-name="MMD-Subscript">x</text:span></text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="MMD-Superscript">23</text:span>Na<text:span text:style-name="MMD-Superscript">1+</text:span></text:p>
 </office:text>
 </office:body>
 </office:document>
index 593423f0dea1c3a9a39e1350e94ca75a0e83d734..9bd378ef4e79a72b3400e27f4a0779a4c7af5b62 100644 (file)
@@ -26,7 +26,7 @@
 
 <p>~/Library/MultiMarkdown</p>
 
-<p>^test</p>
+<p><sup>test</sup></p>
 
 <p>10</p>
 
 
 <p><code>CH~4~</code></p>
 
+<p><sup>238</sup>U</p>
+
+<p>Ca<sup>2+</sup></p>
+
+<p><sub>t</sub>p<sub>x</sub></p>
+
+<p><sup>23</sup>Na<sup>1+</sup></p>
+
 </body>
 </html>
 
index cc377a070ebc5fa6398786dc3d63a64db7dad87c..638639b5141f58767cded155c41d4334b6af2483 100644 (file)
@@ -50,3 +50,11 @@ latex config:        article</p>
 <p>20</p>
 
 <p><code>CH~4~</code></p>
+
+<p>^238^U</p>
+
+<p>Ca^2+^</p>
+
+<p>~t~p~x~</p>
+
+<p>^23^Na^1+^</p>
index 3dd646a44d9006a0c59b5ce49c1f4ff25f207854..ba419700ad241efa1a5a4ed48fd41f319864ac30 100644 (file)
@@ -22,7 +22,7 @@ z\textsubscript{z.}
 
 \ensuremath{\sim}\slash Library\slash MultiMarkdown
 
-\^{}test
+\textsuperscript{test}
 
 10
 
@@ -52,5 +52,13 @@ CH\textsubscript{3}CH\textsubscript{2}CH\textsubscript{2}CH\ensuremath{\sim}3
 
 \texttt{CH\ensuremath{\sim}4\ensuremath{\sim}}
 
+\textsuperscript{238}U
+
+Ca\textsuperscript{2+}
+
+\textsubscript{t}p\textsubscript{x}
+
+\textsuperscript{23}Na\textsuperscript{1+}
+
 \input{mmd6-article-footer}
 \end{document}
index 63d282f308f8bab01755914fa8a0e928565c16ec..fc6d77e0a5f1f35c2eddcb2cf00dfc6fb7a80c09 100644 (file)
@@ -50,3 +50,11 @@ CH~3~CH~2~CH~2~CH~3
 20
 
 `CH~4~`
+
+ ^238^U
+
+ Ca^2+^
+
+ ~t~p~x~
+
+ ^23^Na^1+^