Difference between revisions of "User:Celierra Darling/Sandbox"

From Second Life Wiki
Jump to navigation Jump to search
(→‎Specific Instruction Template: links to test articles)
(+ variable method)
 
Line 25: Line 25:


P.S. I think the noinclude tags are an obfuscatory hack.  Does anyone know of a better way to do it?
P.S. I think the noinclude tags are an obfuscatory hack.  Does anyone know of a better way to do it?
''Update'': If you find yourself using the noinclude trick often, you can instead define a variable within noinclude tags, i.e.
<nowiki><noinclude>{{#vardefine:OnPageName|*}}</noinclude></nowiki>
...and then use this variable later:
<nowiki>{{Specific Instruction | {{{A|{{#var:OnPageName}}}}} | B | text}}</nowiki>
Be sure to use a name that will be unique and only used on this article (so I suggest "On''PageName''".)

Latest revision as of 15:50, 7 January 2009

Specific Instruction Template

Update: Tests available at /SpecInstr, /Leaf, /Node

I think Template:Specific Instruction would be something like:

{{#ifeq: {{{current|{{{1|}}}}}} | * | {{{3|{{{2|}}}}}} |
 {{#if: {{{target|{{{3|}}}}}} |
  {{#ifeq: {{{current|{{{1|}}}}}} | {{{target|{{{2|}}}}}} | {{{3|}}} | }} |
  {{#if: {{{current|{{{1|}}}}}} | {{{2|}}} | }}
 }} }} 

...but I haven't tested this thoroughly.

I imagine the template would be used in one of these ways:

{{Specific Instruction | {{{A|<noinclude>*</noinclude>}}} | text}}

...which outputs the text if A is defined and non-blank or if the current page is being viewed on its own (e.g. if you're looking at CMake, not some article that calls {{:CMake}}). It outputs nothing otherwise.

{{Specific Instruction | {{{A|*}}} | B | text}}

...which outputs text iff A is the string "B", A is the string "*", or the current page is being viewed on its own. This defaults to showing the message if A is undefined.

{{Specific Instruction | {{{A|<noinclude>*</noinclude>}}} | B | text}}

...the same as above, but defaults to not showing the message if A is undefined.

Also, there will probably need to be a different template designed to test versions (i.e. whether 1.22 < 1.20), using #ifexpr statements.

P.S. I think the noinclude tags are an obfuscatory hack. Does anyone know of a better way to do it?

Update: If you find yourself using the noinclude trick often, you can instead define a variable within noinclude tags, i.e.

<noinclude>{{#vardefine:OnPageName|*}}</noinclude>

...and then use this variable later:

{{Specific Instruction | {{{A|{{#var:OnPageName}}}}} | B | text}}

Be sure to use a name that will be unique and only used on this article (so I suggest "OnPageName".)