]> granicus.if.org Git - multimarkdown/commitdiff
FIXED: Fix HTML 5 compliance with image dimensions; Fix CriticMarkup inside code...
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Fri, 29 Dec 2017 18:22:04 +0000 (13:22 -0500)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Fri, 29 Dec 2017 18:22:04 +0000 (13:22 -0500)
13 files changed:
Sources/libMultiMarkdown/html.c
tests/MMD6Tests/CriticMarkup.fodt
tests/MMD6Tests/CriticMarkup.html
tests/MMD6Tests/CriticMarkup.htmlc
tests/MMD6Tests/CriticMarkup.tex
tests/MMD6Tests/CriticMarkup.text
tests/MMD6Tests/Figure Images.fodt
tests/MMD6Tests/Figure Images.html
tests/MMD6Tests/Figure Images.htmlc
tests/MMD6Tests/Figure Images.tex
tests/MMD6Tests/Figure Images.text
tests/MMD6Tests/Integrated.html
tests/MMD6Tests/Link Attributes.html

index fdc89c2aa68da999a93764add07539d08cedd7c8..0fa1f28e3e9f493beb276f01517aa0d41858e174 100644 (file)
@@ -259,11 +259,6 @@ static char * strip_dimension_units(char *original) {
                result[i] = tolower(result[i]);
        }
 
-       if (strstr(&result[strlen(result) - 2], "px")) {
-               // Leave 'px' alone
-               return result;
-       }
-
        // Trim anything other than digits
        for (i = 0; result[i]; i++) {
                if (result[i] < '0' || result[i] > '9') {
@@ -373,6 +368,12 @@ void mmd_export_image_html(DString * out, const char * source, token * text, lin
                if (strcmp(a->key, "width") == 0) {
                        width = strip_dimension_units(a->value);
 
+            if (strlen(width) + 2 == strlen(a->value)) {
+                if (strcmp(&(a->value[strlen(width)]), "px") == 0) {
+                    a->value[strlen(width)] = '\0';
+                }
+            }
+            
                        if (strcmp(a->value, width) == 0) {
                                print_const(" ");
                                print(a->key);
@@ -388,6 +389,12 @@ void mmd_export_image_html(DString * out, const char * source, token * text, lin
                } else if (strcmp(a->key, "height") == 0) {
                        height = strip_dimension_units(a->value);
 
+            if (strlen(height) + 2 == strlen(a->value)) {
+                if (strcmp(&(a->value[strlen(height)]), "px") == 0) {
+                    a->value[strlen(height)] = '\0';
+                }
+            }
+            
                        if (strcmp(a->value, height) == 0) {
                                print_const(" ");
                                print(a->key);
@@ -2067,7 +2074,27 @@ void mmd_export_token_html_raw(DString * out, const char * source, token * t, sc
                        print_const("&lt;");
                        break;
 
-               case ESCAPED_CHARACTER:
+        case CRITIC_COM_OPEN:
+            print_const("{&gt;&gt;");
+            break;
+            
+        case CRITIC_COM_CLOSE:
+            print_const("&lt;&lt;}");
+            break;
+
+        case CRITIC_SUB_DIV:
+            print_const("~&gt;");
+            break;
+            
+        case CRITIC_SUB_DIV_A:
+            print_const("~");
+            break;
+            
+        case CRITIC_SUB_DIV_B:
+            print_const("&gt;");
+            break;
+            
+        case ESCAPED_CHARACTER:
                        print_const("\\");
                        mmd_print_char_html(out, source[t->start + 1], false);
                        break;
index e9577ae5bb72069d9aeea468dd6b443541f29e12..6df481e88710857ee040dc33bc4c5c2e7f50a6b8 100644 (file)
@@ -338,6 +338,30 @@ office:mimetype="application/vnd.oasis.opendocument.text">
 
 <text:p text:style-name="Standard">25</text:p>
 
+<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">{++foo++}</text:span></text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">{--bar--}</text:span></text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">{~~foo~>bar~~}</text:span></text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">{>>foo<<}</text:span></text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">{==bar==}</text:span></text:p>
+
+<text:p text:style-name="Standard">30</text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="math">$${++foo++}$$</text:span></text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="math">$${--bar--}$$</text:span></text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="math">$${~~foo~>bar~~}$$</text:span></text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="math">$${>>foo<<}$$</text:span></text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="math">$${==bar==}$$</text:span></text:p>
+
+<text:p text:style-name="Standard">35</text:p>
+
 <text:p text:style-name="Standard"><text:span text:style-name="Underline">foo<text:span text:style-name="Underline"> bar</text:span></text:span></text:p>
 
 <text:p text:style-name="Standard"><text:span text:style-name="Strike">foo<text:span text:style-name="Strike"> bar</text:span></text:span></text:p>
index 291f80115026543de08370d0f8af2fe205eed5f1..c3ae52889d620e215496735c4eed0f5757e48304 100644 (file)
 
 <p>25</p>
 
+<p><code>{++foo++}</code></p>
+
+<p><code>{--bar--}</code></p>
+
+<p><code>{~~foo~&gt;bar~~}</code></p>
+
+<p><code>{&gt;&gt;foo&lt;&lt;}</code></p>
+
+<p><code>{==bar==}</code></p>
+
+<p>30</p>
+
+<p><span class="math">\[{++foo++}\]</span></p>
+
+<p><span class="math">\[{--bar--}\]</span></p>
+
+<p><span class="math">\[{~~foo~&gt;bar~~}\]</span></p>
+
+<p><span class="math">\[{&gt;&gt;foo&lt;&lt;}\]</span></p>
+
+<p><span class="math">\[{==bar==}\]</span></p>
+
+<p>35</p>
+
 <p><ins>foo<ins> bar</ins></ins></p>
 
 <p><del>foo<del> bar</del></del></p>
index da6ead4bc7868b425f9f2819d3e90ec44a4f9a95..28de00759ee10992f110ad679c0dd9adb8f452e5 100644 (file)
@@ -61,6 +61,30 @@ latex config:        article</p>
 
 <p>25</p>
 
+<p><code>{++foo++}</code></p>
+
+<p><code>{--bar--}</code></p>
+
+<p><code>{~~foo~&gt;bar~~}</code></p>
+
+<p><code>{&gt;&gt;foo&lt;&lt;}</code></p>
+
+<p><code>{==bar==}</code></p>
+
+<p>30</p>
+
+<p>$${++foo++}$$</p>
+
+<p>$${--bar--}$$</p>
+
+<p>$${~~foo~&gt;bar~~}$$</p>
+
+<p>$${&gt;&gt;foo&lt;&lt;}$$</p>
+
+<p>$${==bar==}$$</p>
+
+<p>35</p>
+
 <p>{++foo{++ bar++}++}</p>
 
 <p>{--foo{-- bar--}--}</p>
index 89c1f98ca7c42b709b81c8177ea3cb4183fe9e8b..c50b8387690d4ab243f50a96c397335de42aa2e5 100644 (file)
@@ -62,6 +62,30 @@ foo **\hl{bar**}
 
 25
 
+\texttt{\{++foo++\}}
+
+\texttt{\{--bar--\}}
+
+\texttt{\{~~foo~>bar~~\}}
+
+\texttt{\{>>foo<<\}}
+
+\texttt{\{==bar==\}}
+
+30
+
+$${++foo++}$$
+
+$${--bar--}$$
+
+$${~~foo~>bar~~}$$
+
+$${>>foo<<}$$
+
+$${==bar==}$$
+
+35
+
 \underline{foo\underline{ bar}}
 
 \sout{foo\sout{ bar}}
index e7b427c88915e76a07b4849e22fe2684021d4565..5acadf71461af4827800ce817b17c923501278a2 100644 (file)
@@ -61,6 +61,30 @@ foo **{==bar**==}
 
 25
 
+`{++foo++}`
+
+`{--bar--}`
+
+`{~~foo~>bar~~}`
+
+`{>>foo<<}`
+
+`{==bar==}`
+
+30
+
+$${++foo++}$$
+
+$${--bar--}$$
+
+$${~~foo~>bar~~}$$
+
+$${>>foo<<}$$
+
+$${==bar==}$$
+
+35
+
 {++foo{++ bar++}++}
 
 {--foo{-- bar--}--}
index 6dacec3e452dc88557ce0ce2bcaebe49bb4a2bd2..f594d8edf7d7e1e11c570abe0f8d23642d41606e 100644 (file)
@@ -280,7 +280,7 @@ office:mimetype="application/vnd.oasis.opendocument.text">
 <office:text>
 <text:p text:style-name="Standard"><draw:frame text:anchor-type="as-char"
 draw:z-index="0" draw:style-name="fr1" svg:width="40pt">
-<draw:text-box><text:p><draw:frame text:anchor-type="as-char" draw:z-index="1" >
+<draw:text-box><text:p><draw:frame text:anchor-type="as-char" draw:z-index="1" svg:height="20pt" svg:width="40pt" >
 <draw:image xlink:href="http://foo.bar/" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" draw:filter-name="&lt;All formats&gt;"/>
 </draw:frame></text:p>
 <text:p>Figure <text:sequence text:name="Figure" text:formula="ooow:Figure+1" style:num-format="1"> Update Fields to calculate numbers</text:sequence>: foo</text:p>
@@ -289,7 +289,7 @@ draw:z-index="0" draw:style-name="fr1" svg:width="40pt">
 
 <text:p text:style-name="Standard"><draw:frame text:anchor-type="as-char"
 draw:z-index="0" draw:style-name="fr1" svg:width="40pt">
-<draw:text-box><text:p><draw:frame text:anchor-type="as-char" draw:z-index="1" >
+<draw:text-box><text:p><draw:frame text:anchor-type="as-char" draw:z-index="1" svg:height="20pt" svg:width="40pt" >
 <draw:image xlink:href="http://foo.bar/" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" draw:filter-name="&lt;All formats&gt;"/>
 </draw:frame></text:p>
 <text:p>Figure <text:sequence text:name="Figure" text:formula="ooow:Figure+1" style:num-format="1"> Update Fields to calculate numbers</text:sequence>: <text:span text:style-name="MMD-Italic">bar</text:span></text:p>
@@ -298,12 +298,21 @@ draw:z-index="0" draw:style-name="fr1" svg:width="40pt">
 
 <text:p text:style-name="Standard"><draw:frame text:anchor-type="as-char"
 draw:z-index="0" draw:style-name="fr1" svg:width="40pt">
-<draw:text-box><text:p><draw:frame text:anchor-type="as-char" draw:z-index="1" >
+<draw:text-box><text:p><draw:frame text:anchor-type="as-char" draw:z-index="1" svg:height="20pt" svg:width="40pt" >
 <draw:image xlink:href="http://foo.bar/" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" draw:filter-name="&lt;All formats&gt;"/>
 </draw:frame></text:p>
 </draw:text-box></draw:frame>
  bar</text:p>
 
+<text:p text:style-name="Standard"><draw:frame text:anchor-type="as-char"
+draw:z-index="0" draw:style-name="fr1" svg:width="40pt">
+<draw:text-box><text:p><draw:frame text:anchor-type="as-char" draw:z-index="1" svg:height="20pt" svg:width="40pt" >
+<draw:image xlink:href="http://foo.bar/" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" draw:filter-name="&lt;All formats&gt;"/>
+</draw:frame></text:p>
+<text:p>Figure <text:sequence text:name="Figure" text:formula="ooow:Figure+1" style:num-format="1"> Update Fields to calculate numbers</text:sequence>: <text:span text:style-name="MMD-Italic">foo</text:span></text:p>
+</draw:text-box></draw:frame>
+</text:p>
+
 <text:p text:style-name="Standard"><draw:frame text:anchor-type="as-char"
 draw:z-index="0" draw:style-name="fr1" svg:width="40pt">
 <draw:text-box><text:p><draw:frame text:anchor-type="as-char" draw:z-index="1" >
index 8bd46c32debb4238b6c9841c26f0c5127f27be33..fd33948c2246d85d25abfb7fd661a63d17c6de5e 100644 (file)
@@ -7,19 +7,24 @@
 <body>
 
 <figure>
-<img src="http://foo.bar/" alt="foo" id="foo" title="foo" width="40px" />
+<img src="http://foo.bar/" alt="foo" id="foo" title="foo" width="40" height="20" />
 <figcaption>foo</figcaption>
 </figure>
 
 <figure>
-<img src="http://foo.bar/" alt="bar" id="foo" title="foo" width="40px" />
+<img src="http://foo.bar/" alt="bar" id="foo" title="foo" width="40" height="20" />
 <figcaption><em>bar</em></figcaption>
 </figure>
 
-<p><img src="http://foo.bar/" alt="bar" id="foo" title="foo" width="40px" /> bar</p>
+<p><img src="http://foo.bar/" alt="bar" id="foo" title="foo" width="40" height="20" /> bar</p>
 
 <figure>
-<img src="http://foo.bar/" alt="foo" title="foo" width="40px" />
+<img src="http://foo.bar/" alt="foo" title="foo" width="40" height="20" />
+<figcaption><em>foo</em></figcaption>
+</figure>
+
+<figure>
+<img src="http://foo.bar/" alt="foo" title="foo" width="40" />
 <figcaption><em>foo</em></figcaption>
 </figure>
 
index d119d488a824ecfed9a4ef52be18f903f99c5056..913b54c310bfd0eeec06f5cc529890714d14940f 100644 (file)
@@ -7,6 +7,8 @@ latex config:   article</p>
 
 <p>![<em>bar</em>][foo] bar</p>
 
+<p>![<em>foo</em>](http://foo.bar/ &quot;foo&quot; width=&quot;40px&quot; height=&quot;20px&quot;)</p>
+
 <p>![<em>foo</em>](http://foo.bar/ &quot;foo&quot; width=&quot;40px&quot;)</p>
 
-<p>[foo]: http://foo.bar/      &quot;foo&quot; width=&quot;40px&quot;</p>
+<p>[foo]: http://foo.bar/      &quot;foo&quot; width=&quot;40px&quot; height=&quot;20px&quot;</p>
index 6c9dbfff81a91bf14ede147192d760da115652c2..5911c87e7acc93f47a69b6d3bce257be2dba6d4c 100644 (file)
@@ -4,19 +4,25 @@
 
 \begin{figure}[htbp]
 \centering
-\includegraphics[keepaspectratio,width=40pt,height=0.75\textheight]{http://foo.bar/}
+\includegraphics[width=40pt,height=20pt]{http://foo.bar/}
 \caption{foo}
 \label{foo}
 \end{figure}
 
 \begin{figure}[htbp]
 \centering
-\includegraphics[keepaspectratio,width=40pt,height=0.75\textheight]{http://foo.bar/}
+\includegraphics[width=40pt,height=20pt]{http://foo.bar/}
 \caption{\emph{bar}}
 \label{foo}
 \end{figure}
 
-\includegraphics[keepaspectratio,width=40pt,height=0.75\textheight]{http://foo.bar/} bar
+\includegraphics[width=40pt,height=20pt]{http://foo.bar/} bar
+
+\begin{figure}[htbp]
+\centering
+\includegraphics[width=40pt,height=20pt]{http://foo.bar/}
+\caption{\emph{foo}}
+\end{figure}
 
 \begin{figure}[htbp]
 \centering
index 81bba6f7cbfa5d99feebf9bd47e49343d1020ac2..7384187d72507a279ae1559aba93110fdda2dcab 100644 (file)
@@ -7,6 +7,9 @@ latex config:   article
 
 ![*bar*][foo] bar
 
+![*foo*](http://foo.bar/ "foo" width="40px" height="20px")
+
 ![*foo*](http://foo.bar/ "foo" width="40px")
 
-[foo]: http://foo.bar/ "foo" width="40px"
+[foo]: http://foo.bar/ "foo" width="40px" height="20px"
+
index 3ad5e365c886fb5d40e6c2229bf4992c131eb513..d29dfb690e326451fcb56b04002bf79275ff7f5a 100644 (file)
@@ -61,7 +61,7 @@ code
 <p><a href="http://foo.net/">link</a> and <a href="http://bar.net" title="title" class="custom">link</a></p>
 
 <figure>
-<img src="http://foo.bar/" alt="test" title="title" width="40px" height="400px" />
+<img src="http://foo.bar/" alt="test" title="title" width="40" height="400" />
 <figcaption>test</figcaption>
 </figure>
 
index 4ce49287fb6f55f7240621453b44ee4bb90e2e3b..52dee78852b7f97e50ee0614f47277cc2d95d24e 100644 (file)
@@ -6,7 +6,7 @@
 </head>
 <body>
 
-<p>foo <img src="http://foo.bar/" alt="image" id="image" title="title" width="40px" height="400px" /></p>
+<p>foo <img src="http://foo.bar/" alt="image" id="image" title="title" width="40" height="400" /></p>
 
 <p>foo <a href="http://foo.bar/1" class="external" style="border: solid black 1px;">link</a></p>
 
@@ -15,7 +15,7 @@
 <p>foo <a href="http://foo.bar/3" class="external" style="border: solid black 1px;">link3</a></p>
 
 <figure>
-<img src="http://foo.bar/" alt="test" title="title" width="40px" height="400px" />
+<img src="http://foo.bar/" alt="test" title="title" width="40" height="400" />
 <figcaption>test</figcaption>
 </figure>