[e-lang] Peculiar wiki code conversion bug

Mark S. Miller markm at cs.jhu.edu
Thu Dec 7 10:55:02 CST 2006


Martin Scheffler wrote:
>> Is this easily fixed, or should I just manually fix all the cases I find? (At
>> the moment, from incomplete automated testing, it looks like there may only be
>> a moderate number of these.)
> 
> It seems like MediaWiki escapes all HTML entities in <pre> tags and
> ignores <nowiki> tags.
> When I use <code> instead of <pre>, it seems to work.

After some testing, I think you made exactly the right decision. Testing on 
the sandbox, the wiki source:

  <nowiki># <b>Using</b> nowiki</nowiki>

  <pre># <b>Using</b> pre instead of nowiki</pre>

  <code># <b>Using</b> code instead of nowiki</code>

  <nowiki><pre># <b>Using</b> pre inside of nowiki</pre></nowiki>

  <pre><nowiki># <b>Using</b> nowiki inside of pre</nowiki></pre>

produced the html source (with a bit of manual whitespace cleanup):

  <pre># &lt;b&gt;Using&lt;/b&gt; nowiki</pre>
  <pre># &lt;b&gt;Using&lt;/b&gt; pre instead of nowiki</pre>
  <pre><code># <b>Using</b> code instead of nowiki</code></pre>
  <pre>&lt;pre&gt;# &lt;b&gt;Using&lt;/b&gt; pre inside of
       nowiki&lt;/pre&gt;</pre>
  <pre># &lt;b&gt;Using&lt;/b&gt; nowiki inside of pre</pre>

Only the third case rendered, IMO, acceptably, i.e., by passing through the 
wiki bold annotation to an unquoted html bold annotation.


 > I don't think there were many occurences of this problem, but:
 > In the safe serialization paper (and I guess in most other pages in
 > erights.org), there is syntax highlighted E code. I simply removed
 > that on the two pages I converted from that paper.
 > Is that OK or is syntax highlighting an essential feature?


It is not essential, and I will do likewise as I encounter other markup in 
code blocks.

 > If someone
 > is REALLY bored, he could probably write an E syntax highlighter for
 > MediaWiki :)

Since we're running our own wiki, if I did write an E syntax highlighter in E 
-- converting E source text to syntax highlighted html -- would it be possible 
to run that as part of our wiki's rendering of wiki <code> into html <pre> blocks?


-- 
Text by me above is hereby placed in the public domain

     Cheers,
     --MarkM


More information about the e-lang mailing list