Difference between revisions of "User:Paxed/ReplaceCharsBlock"
Jump to navigation
Jump to search
------- ------- -------
(default) |
(docs) |
||
Line 1: | Line 1: | ||
− | + | '''ReplaceCharsBlock''' extension. | |
NOTE: Still experimental, DO NOT USE! | NOTE: Still experimental, DO NOT USE! | ||
+ | <pre> | ||
+ | <replacecharsblock> | ||
+ | <replacements> | ||
+ | b=foobar | ||
+ | </replacements> | ||
+ | abc | ||
+ | </replacecharsblock> | ||
+ | </pre> | ||
+ | would show "afoobarc" | ||
+ | |||
+ | *<nowiki><replacecharsblock></nowiki> accepts one parameter, ''newlines''. With a value of '''1''', all newlines will be replaced with <nowiki><br></nowiki>. 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: | ||
+ | <pre> | ||
+ | <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> | ||
+ | </pre> | ||
<div class='ttyscreen'> | <div class='ttyscreen'> |
Revision as of 22:30, 6 January 2011
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| -.----- -.----- -.----- -.-----