User:Paxed/src geshi test

From NetHackWiki
< User:Paxed(Redirected from User:Paxed/test)
Jump to: navigation, search

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.

  1. /* Called in several places - may produce output */
  2. /* eg ship_object() and dropy() -> sellobj() both produce output */
  3. void
  4. dropx(obj)
  5. register struct obj *obj;
  6. {
  7. #ifndef GOLDOBJ
  8.         if (obj->oclass != COIN_CLASS || obj == invent) freeinv(obj);
  9. #else
  10.         /* Ensure update when we drop gold objects */
  11.         if (obj->oclass == COIN_CLASS) flags.botl = 1;
  12.         freeinv(obj);
  13. #endif
  14.         if (!u.uswallow) {
  15.             if (ship_object(obj, u.ux, u.uy, FALSE)) return;
  16.             if (IS_ALTAR(levl[u.ux][u.uy].typ))
  17.                 doaltarobj(obj); /* set bknown */
  18.         }
  19.         dropy(obj);
  20. }