User:Paxed/ReplaceCharsBlock

From NetHackWiki
< User:Paxed
Revision as of 22:30, 6 January 2011 by Paxed (talk | contribs) (docs)
Jump to navigation Jump to search

ReplaceCharsBlock extension.

NOTE: Still experimental, DO NOT USE!

<replacecharsblock>
<replacements>
b=foobar
</replacements>
abc
</replacecharsblock>

would show "afoobarc"

  • <replacecharsblock> accepts one parameter, newlines. With a value of 1, all newlines will be replaced with <br>. Any other value will be used as is.
  • default as a replacement: used for any characters that don't have explicitly defined replacement. $1 in the replacement will be substituted with the character which is being replaced.

For example:

<div class='ttyscreen'>
<replacecharsblock newlines="1">
<replacements>
k=[[kobold|{{red|k}}]]
f=[[cat|{{white|f}}]]
@={{white|@}}
|={{lightgray||}}
default={{lightgray|$1}}
</replacements>
------- ------- ------- -------
|...... |...... |...... |kkkkk.
|.....| |.....| |.....| |kkkkk|
|..k..| |.....| |..f..| |kkfkk|
|.kfk.| |..kk.| |.kkk.| |k...k|
|.k@k.| |..@fk| |..@..| |kk@kk|
|.....| |..kk.| |.....| |kkkkk|
-.----- -.----- -.----- -.-----
</replacecharsblock>
</div>

<replacements> k=k f=f @=@ |=| default=$1 </replacements>


------- ------- -------

|...... |...... |...... |kkkkk. |.....| |.....| |.....| |kkkkk| |..k..| |.....| |..f..| |kkfkk| |.kfk.| |..kk.| |.kkk.| |k...k| |.k@k.| |..@fk| |..@..| |kk@kk| |.....| |..kk.| |.....| |kkkkk| -.----- -.----- -.----- -.-----