Meta:Sandbox
From No LJ Ads Wiki
Contents |
[edit] Yaaay sandbox for testing!
[edit] User tags!!
| Code | Output | Comment |
<ljuser>kunzite1</ljuser>
| | // normal <ljuser>
|
<ljuser>bob_underscore</ljuser>
| | // single_mid_underscore <ljuser>
|
<ljuser>_brightness_</ljuser>
| | // _single_first_underscore <ljuser>
|
<ljuser>the_unadvocate</ljuser>
| | // single_mid_underscore <ljuser>
|
<ljuser>the-unadvocate</ljuser>
| | // mid-hyphen <ljuser>
|
<ljcomm>no_lj_ads</ljcomm>
| | // multiple_mid_underscore <ljcomm>
|
<ljcomm>no-lj-ads</ljcomm>
| | // multiple-mid-hyphen <ljcomm>
|
<ljsyn>moz_exts</ljsyn>
| | // mid_underscore <ljsyn>
|
<ljsyn>moz-exts</ljsyn>
| | // mid-hyphen <ljsyn>
|
<ljuser>news</ljuser>
| | // <ljuser> news
|
<ljcomm>news</ljcomm>
| | // <ljcomm> news
|
<ijcomm>announcements</ijcomm>
| | // Insane Journal comm |
<ijuser>squeaky</ijuser>
| | // normal <ijuser>
|
<ijuser>_squeaky</ijuser>
| | // <ijuser> with starting underscore
|
<ijuser>squeaky_squeaky</ijuser>
| | // <ijuser> with middle underscore
|
<jfcomm>fandom_wank</jfcomm>
| | // JournalFen comm |
<jfuser>snacky</jfuser>
| | // normal <jfuser>
|
<vox>team</vox>
| | // normal <vox>
|
[edit] LJ Links!!!
Code
- Output
- Comment
<ljlink href="http://community.livejournal.com/no_lj_ads/30690.html">Latest post</ljlink>
<ljlink href="http://foxfirefey.livejournal.com/204505.html">Oh the wank</ljlink>
<ljlink href="http://users.livejournal.com/_brightness_/44613.html">Underscore test</ljlink>
<ljlink href="http://syndicated.livejournal.com/sinfestfeed/230802.html?view=9194642#t9194642">Syndicated test</ljlink>
[edit] IJ Links!!!
<ijlink href="http://asylums.insanejournal.com/announcements/49583.html">1 day fundraising sale</ljlink>
<ijlink href="http://stewardess.insanejournal.com/228245.html">Circle the one that doesn't belong</ljlink>
[edit] Vox Links!!!!
Code
- Output
- Comment
<voxlink href="http://kunzite1.vox.com/profile/">Kunzite</voxlink>
[edit] ParserFunctions tests!!!!!
[edit] #expr:
Evaluates an expression and returns the value
{{#expr: <expression>}}
{{#expr: 0 + 1}} // should be: 1
1
{{#expr: 0 + 0}} // should be: 0
0
{{#expr: 1 + 5 * 8 + 1}} // should be: 42
42 // should be: 42
{{#expr: (1 + 5) * (8 + 1)}} // should be: 54
54 // should be: 54
{{#expr: 6 * 9}} // should be: 54
54 // should be: 54
[edit] #if:
Returns <true value> if <condition> is true. true means "not an empty string and not whitespace."
Returns <false value> if <condition> is false. false means "an empty string or just whitespace."
- Note:
#ifis broken in MediaWiki v1.6. A proposed fix and some additional installation instructions can be found here.
{{#if: <condition> |<true value>|<false value>}}
{{#if: moo |true|false}} // should be: true, because not empty and not whitespace
true
{{#if:|true|false}} // should be: false, because is empty
false
{{#if: |true|false}} // should be: false, because is whitespace
false
[edit] #ifeq:
Returns <true value> if two numbers are equal or two strings are equal.
Returns <false value> if two numbers are not equal or two strings are not equal.
{{#ifeq: <number one> | <number two> |<equal value>|<not equal value>}}
{{#ifeq:<string one>|<string two>|<equal value>|<not equal value>}}
{{#ifeq:2|2|equal|not equal}} // should be: equal
equal // should be: equal
{{#ifeq:{{#expr:2 + 2}}|{{#expr:2 * 2}}|equal|not equal}} // should be: equal
equal // should be: equal
{{#ifeq:{{#expr:2 - 2}}|{{#expr:2 + 2}}|equal|not equal}} // should be: not equal
not equal // should be: not equal
{{#ifeq:one|one|equal|not equal}} // should be: equal
equal // should be: equal
{{#ifeq:one|two|equal|not equal}} // should be: not equal
not equal // should be: not equal
[edit] #ifexist:
Returns <true value> if the given Page called <page name> exists in the Wiki.
{{#ifexist:<page name>|<true value>|<false value>}}
{{#ifexist:Main Page|Does exist|Does not exist}} // should be: Does exist
Does exist // should be: Does exist
{{#ifexist:Main_Page|Does exist|Does not exist}} // should be: Does exist
Does exist // should be: Does exist
{{#ifexist:SnAfUbArMoOzIpPeRs|Does exist|Does not exist}} // should be: Does not exist
Does not exist // should be: Does not exist
[edit] #ifexpr:
Returns <true value> if <expression> evaluates to true or a non-zero value.
Returns <false value> if <expression> evaluates to false or zero.
{{#ifexpr:<expression>|<true value>|<false value>}}
{{#ifexpr:1|True/Non-zero|False/Zero}} // should be: True/Non-zero
True/Non-zero // should be: True/Non-zero
{{#ifexpr:0|True/Non-zero|False/Zero}} // should be: False/Zero
False/Zero // should be: False/Zero
{{#ifexpr:0=0|True/Non-zero|False/Zero}} // should be: True/Non-zero
True/Non-zero // should be: True/Non-zero
{{#ifexpr:1=1|True/Non-zero|False/Zero}} // should be: True/Non-zero
True/Non-zero // should be: True/Non-zero
{{#ifexpr:1=0|True/Non-zero|False/Zero}} // should be: False/Zero
False/Zero // should be: False/Zero
{{#ifexpr:2 + 2 = 2 * 2|True/Non-zero|False/Zero}} // should be: True/Non-zero
True/Non-zero // should be: True/Non-zero
{{#ifexpr:2 - 2 = 2 + 2|True/Non-zero|False/Zero}} // should be: False/Zero
False/Zero // should be: False/Zero
[edit] #switch:
Compares a single value against multiple others, returning a string if a match is found.
{{#switch: <comparison value>
| <case1> = <result1>
| <case2> = <result2>
| ...
| <casen> = <resultn>
| <default result>
}}
{{#switch: <comparison value>
| <case1> = <result1>
| <case2> = <result2>
| ...
| <casen> = <resultn>
| #default = <default result>
}}
Consider the following #switch statement:
{{#switch: <char>
| A = 1
| B = 2
| C = 3
| D = 4
| 5
}}
1 // <char> = A 2 // <char> = B 3 // <char> = C 4 // <char> = D 5 // <char> = E 5 // <char> = F
Consider the following #switch statement:
{{#switch: <char>
| A = 1
| B = 2
| C = 3
| D = 4
| #default = 5
}}
1 // <char> = A 2 // <char> = B 3 // <char> = C 4 // <char> = D 5 // <char> = E 5 // <char> = F
[edit] NEW LJ TAGS TEST
<ljuser>exampleusername</ljuser> will make
exampleusername
<ljcomm>communityname</ljcomm> will make
communityname
<ljspon>sponsored_comm</ljspon> will make
sponsored_comm
<ljsyn>syndicated_feed</ljsyn> will make
syndicated_feed
<ljlink href="http://community.livejournal.com/communityname/21475.html">Link Text</ljlink> will make Link Text (
communityname)
<vox>voxuser</vox> will make
voxuser
<voxlink href="http://foxfirefey.vox.com/library/post/vox-to-receive-more-ads.html#comments">Link Text</voxlink> will make Link Text (
foxfirefey)
<genuser url="greatestjournal.com">coyotecult</genuser> will make
coyotecult (greatestjournal.com)
<gencomm url="greatestjournal.com">fandom_wank</gencomm> will make
fandom_wank (greatestjournal.com)
<gensyn url="greatestjournal.com">syn_random</gensyn> will make
syn_random (greatestjournal.com)
<openid>http://bradfitz.com/</openid> will make
bradfitz.com
<openid>foxfirefey.livejournal.com</openid> will make
foxfirefey.livejournal.com
<openid>http://www.livejournal.com/index.bml</openid> will make
www.livejournal.com/index.bml
<openid>http://foxfirefey.livejournal.com/</openid> will make
foxfirefey.livejournal.com
<openid>http://users.livejournal.com/exampleusername</openid> will make
users.livejournal.com/exampleusername
<openid>http://www.livejournal.com/users/exampleusername</openid> will make
www.livejournal.com/users/exampleusername

