moinwiki / moin-1.9

MoinMoin Wiki (1.9, also: 1.5a ... 1.8), stable, for production wikis
https://moinmo.in/
Other
140 stars 51 forks source link

highlight parser: use language as code_type rather than "highlight" #61

Closed geirha closed 4 years ago

geirha commented 4 years ago

When using {{{#!highlight python, it should set code_type to 'python' instead of 'highlight'

This was originally reported by Vincent Vega here: http://moinmo.in/MoinMoinBugs/RenderAsDocbookXmlFailsPdfGenBecauseLangEqualHighlight

geirha commented 4 years ago

Difference between /HelpOnMoinWikiSyntax?action=show&mimetype=text/html before and after patch:

--- orig-html   2020-08-22 19:40:38.000000000 +0200
+++ new-html    2020-08-22 19:41:37.000000000 +0200
@@ -270,7 +270,7 @@
   <td><p class="line862"> <a class="nonexistent" href="/PageName#anchorname">description</a> </td>
 </tr>
 <tr>  <td><span class="anchor" id="line-76"></span><p class="line862"> <tt class="backtick">[[attachment:filename.txt]]</tt> </td>
-  <td><p class="line862"> <a class="attachment nonexistent" href="/HelpOnMoinWikiSyntax?action=AttachFile&amp;do=upload_form&amp;ticket=005f415896.93041213a08b3d676acaa5f2e958cde2e256c5f4&amp;target=filename.txt" title="Upload new attachment &quot;filename.txt&quot;">filename.txt</a> </td>
+  <td><p class="line862"> <a class="attachment nonexistent" href="/HelpOnMoinWikiSyntax?action=AttachFile&amp;do=upload_form&amp;ticket=005f4158d1.4ec20ff56241f8f460eb53f4254abecb72d8a908&amp;target=filename.txt" title="Upload new attachment &quot;filename.txt&quot;">filename.txt</a> </td>
 </tr>
 </tbody></table></div><span class="anchor" id="line-77"></span><span class="anchor" id="line-78"></span><span class="anchor" id="line-79"></span><p class="line867">
 <h2 id="External_Links">External Links</h2>

Difference between /HelpOnMoinWikiSyntax?action=show&mimetype=text/docbook before and after patch:

--- orig-docbook    2020-08-22 19:40:30.000000000 +0200
+++ new-docbook 2020-08-22 19:41:28.000000000 +0200
@@ -53,7 +53,7 @@
     print "Hello World!"]]></screen></section><section><title>Syntax Highlighting</title><screen><![CDATA[{{{#!highlight python
 def hello():
     print "Hello World!"
-}}}]]></screen><programlisting format="linespecific" language="highlight" linenumbering="numbered" startinglinenumber="1"><token><![CDATA[def]]></token><![CDATA[ ]]><methodname><![CDATA[hello]]></methodname><![CDATA[():]]>
+}}}]]></screen><programlisting format="linespecific" language="python" linenumbering="numbered" startinglinenumber="1"><token><![CDATA[def]]></token><![CDATA[ ]]><methodname><![CDATA[hello]]></methodname><![CDATA[():]]>
 <![CDATA[    ]]><token><![CDATA[print]]></token><![CDATA[ ]]><phrase><![CDATA["]]></phrase><phrase><![CDATA[Hello World!]]></phrase><phrase><![CDATA["]]></phrase>
 </programlisting></section><section><title>Using the wiki parser with css classes</title><screen><![CDATA[{{{#!wiki red/solid
 This is wiki markup in a '''div''' with __css__ `class="red solid"`.

No differences for text/plain

ThomasWaldmann commented 4 years ago

I had a look at MoinMoin/formatters/*.py -> code_area method and this change looks rather harmless.

Guess the only change in output will be in dom_xml formatter, not sure if anybody uses this.

ThomasWaldmann commented 4 years ago

can you change the commit comment to something like:

highlight parser: use language as code_type rather than "highlight"

ThomasWaldmann commented 4 years ago

thanks! will be in next release, maybe rather soon.