Difference between revisions of "User:Paxed/src geshi test"

From NetHackWiki
Jump to navigation Jump to search
m (more pondering)
m (it's lang, not code, duh.)
 
(6 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
*Added <tt>lineid</tt> to the <tt><nowiki><syntaxhighlight></nowiki></tt>.
 
*Added <tt>lineid</tt> to the <tt><nowiki><syntaxhighlight></nowiki></tt>.
 
*Edited geshi.php to output the id without the dash before the number. (So line number hrefs are <tt>#line1234</tt>, to keep compatible with current ones)
 
*Edited geshi.php to output the id without the dash before the number. (So line number hrefs are <tt>#line1234</tt>, to keep compatible with current ones)
 +
*Fixed a geshi bug where line ids did not obey line numbering.
 +
*<s>Added <nowiki><mixedsyntaxhighlight></nowiki>-tag, see [[User:Paxed/src geshi test2]]. It accepts the same parameters as <nowiki><syntaxhighlight></nowiki>, but uses syntax highlighting for each line that match "<nowiki> <span id="line1234">1234. blahblah</span></nowiki>". (Note the space at the beginning of that line)</s>
 +
*Added magic word __MIXEDSYNTAXHIGHLIGHT__; See [[User:Paxed/MixedSyntaxHighlight]]. This allows for no configuration (at least not yet), but does work.
  
 
TODO:
 
TODO:
  
 +
*<s><nowiki><mixedsyntaxhighlight></nowiki> seems to prevent editing page sections?</s>
 
*<s>Geshi</s>The extension should not strip out empty lines at the end of the highlighting block.
 
*<s>Geshi</s>The extension should not strip out empty lines at the end of the highlighting block.
 +
*Better style for the code blocks.
 
*nethack function url links? (need to add the nethack functions and a lookup url ($geshi->add_keyword(), $geshi->add_keyword_group()))
 
*nethack function url links? (need to add the nethack functions and a lookup url ($geshi->add_keyword(), $geshi->add_keyword_group()))
 
**Geshi only supports function name variable, eg. <tt>http://nethackwiki.com/wiki/SrcFunc:{FNAME}</tt>, when we need both the src filename and the function name.
 
**Geshi only supports function name variable, eg. <tt>http://nethackwiki.com/wiki/SrcFunc:{FNAME}</tt>, when we need both the src filename and the function name.
Line 15: Line 20:
  
 
----
 
----
<syntaxhighlight code="c" line lineid="line" start="514">
+
<syntaxhighlight lang="nethackc" line lineid="line" start="514">
  
 
/* Called in several places - may produce output */
 
/* Called in several places - may produce output */

Latest revision as of 20:46, 20 November 2010

This is a test of tiny highlight-extension modification:

Done:

  • Added lineid to the <syntaxhighlight>.
  • Edited geshi.php to output the id without the dash before the number. (So line number hrefs are #line1234, to keep compatible with current ones)
  • Fixed a geshi bug where line ids did not obey line numbering.
  • Added <mixedsyntaxhighlight>-tag, see User:Paxed/src geshi test2. It accepts the same parameters as <syntaxhighlight>, but uses syntax highlighting for each line that match " <span id="line1234">1234. blahblah</span>". (Note the space at the beginning of that line)
  • Added magic word __MIXEDSYNTAXHIGHLIGHT__; See User:Paxed/MixedSyntaxHighlight. This allows for no configuration (at least not yet), but does work.

TODO:

  • <mixedsyntaxhighlight> seems to prevent editing page sections?
  • GeshiThe extension should not strip out empty lines at the end of the highlighting block.
  • Better style for the code blocks.
  • nethack function url links? (need to add the nethack functions and a lookup url ($geshi->add_keyword(), $geshi->add_keyword_group()))
  • Des-file format? (tricky if we want to color both the syntax and the MAP characters)
    • Could be solved by colorizing MAPs separate from other parts, or by using Geshi devel version.

/* Called in several places - may produce output */
/* eg ship_object() and dropy() -> sellobj() both produce output */
void
dropx(obj)
register struct obj *obj;
{
#ifndef GOLDOBJ
        if (obj->oclass != COIN_CLASS || obj == invent) freeinv(obj);
#else
        /* Ensure update when we drop gold objects */
        if (obj->oclass == COIN_CLASS) flags.botl = 1;
        freeinv(obj);
#endif
        if (!u.uswallow) {
            if (ship_object(obj, u.ux, u.uy, FALSE)) return;
            if (IS_ALTAR(levl[u.ux][u.uy].typ))
                doaltarobj(obj); /* set bknown */
        }
        dropy(obj);
}