User:Gorgon/Sandbox/Sandbox Alpha: Difference between revisions

From Avlis Wiki
Jump to navigation Jump to search
m (transcludesection doesn't work directly from the template. Need to pass it on to each spell.)
m (Different approach to transcluding, using the new Template:Sec and sec# section tags, plus a trick to not parse them until they are in the destination spell. Can't test the results without new edits here, so preview edits don't work.)
Line 1: Line 1:
Anything up to/including the '''Template start''' heading will not be included in transclusion of this template (or any part of the trailing documentation section either, though that will eventually be formalized template documentation, with transcluded categories at the end).
<noinclude>Anything up to/including the '''Template start''' heading will not be included in transclusion of this template (or any part of the trailing documentation section either, though that will eventually be formalized template documentation, possibly with transcluded categories at the end).


I love to over-comment my code, so why change things here...
I love to over-comment my code, so why change things here...
Line 15: Line 15:


* [http://www.mediawiki.org/wiki/Extension:Labeled_Section_Transclusion Extension:Labeled Section Transclusion] - Allows '''selective''' transclusion of marked-off sections of text.
* [http://www.mediawiki.org/wiki/Extension:Labeled_Section_Transclusion Extension:Labeled Section Transclusion] - Allows '''selective''' transclusion of marked-off sections of text.
** [[Wikipedia:Wikipedia:Transclusion#Without_using_the_labeled_section_method | Wikipedia:Selective transclusion without using the labeled section method]] - This works here with onlyinclude and includeonly, so transcludesection=SECTIONNAME parameters are doable if [http://www.mediawiki.org/wiki/Extension:Labeled_Section_Transclusion Extension:Labeled Section Transclusion] isn't added.
** [[Wikipedia:Wikipedia:Transclusion#Without_using_the_labeled_section_method | Wikipedia:Selective transclusion without using the labeled section method]] - This works here with onlyinclude and includeonly, so transcludesection=SECTIONNAME parameters are doable if [http://www.mediawiki.org/wiki/Extension:Labeled_Section_Transclusion Extension:Labeled Section Transclusion] isn't added.
* [http://www.mediawiki.org/wiki/Extension:DynamicPageList_(third-party) Extension:DynamicPageList (third-party)] - Enhanced version of [http://www.mediawiki.org/wiki/Extension:DynamicPageList_(Wikimedia) Extension:DynamicPageList (Wikimedia)]
* [http://www.mediawiki.org/wiki/Extension:DynamicPageList_(third-party) Extension:DynamicPageList (third-party)] - Enhanced version of [http://www.mediawiki.org/wiki/Extension:DynamicPageList_(Wikimedia) Extension:DynamicPageList (Wikimedia)]
** [http://semeb.com/dpldemo/index.php?title=DPL:Overview DPL:Overview] - Generate dynamic reports based on category members and selective included info from each (Extension:Labeled Section Transclusion above would really help there).
** [http://semeb.com/dpldemo/index.php?title=DPL:Overview DPL:Overview] - Generate dynamic reports based on category members and selective included info from each (Extension:Labeled Section Transclusion above would really help there).
** [http://semeb.com/dpldemo/index.php?title=Template:Catlist DPL:Template:Catlist] - Picture this totally reformatted as filter/sort options up top of the [[Magic:Spell_List | Spell List]] page, as a dynamic table. It starts showing all spells, but sortable with one click by level, school, class, or any other useful [[Template:Spell]] parameter/category used by them. Then add in the ability to filter results to only certain kinds/combinations (e.g, Show only cleric evocation spells, sorted by level, with the option of showing specific domain ones as well).  
** [http://semeb.com/dpldemo/index.php?title=Template:Catlist DPL:Template:Catlist] - Picture this totally reformatted as filter/sort options up top of the [[Magic:Spell_List | Spell List]] page, as a dynamic table. It starts showing all spells, but sortable with one click by level, school, class, or any other useful [[Template:Spell]] parameter/category used by them. Then add in the ability to filter results to only certain kinds/combinations (e.g, Show only cleric evocation spells, sorted by level, with the option of showing specific domain ones as well).
** I doubt anyone else besides me would use this (except maybe the occasional dabbler), but it would really be useful for spells, and maybe a few other things eventually. Revamping all spells via this template is a huge undertaking (and my main goal for wiki updating, now that I can verify/test spells again), so adding this extension for that work alone would make a huge difference.
** I doubt anyone else besides me would use this (except maybe the occasional dabbler), but it would really be useful for spells, and maybe a few other things eventually. Revamping all spells via this template is a huge undertaking (and my main goal for wiki updating, now that I can verify/test spells again), so adding this extension for that work alone would make a huge difference.
** After looking into the more recent version of [http://www.mediawiki.org/wiki/Extension:DynamicPageList_(Wikimedia) Extension:DynamicPageList (Wikimedia)] (the one used by most Wikimedia projects, not the "enhanced - 3rd party one"), it may be just as useful (or better), since it allows more sort options. Need to see both in practical use before deciding anything.
** After looking into the more recent version of [http://www.mediawiki.org/wiki/Extension:DynamicPageList_(Wikimedia) Extension:DynamicPageList (Wikimedia)] (the one used by most Wikimedia projects, not the "enhanced - 3rd party one"), it may be just as useful (or better), since it allows more sort options. Need to see both in practical use before deciding anything.
Line 55: Line 55:
* All parameters are now Proper Case.
* All parameters are now Proper Case.
* Lowercase conversion is used for comparison validation of parameter values (when possible).
* Lowercase conversion is used for comparison validation of parameter values (when possible).
** ifeq: and case entries in a switch are case sensitive, so this is necessary.  
** ifeq: and case entries in a switch are case sensitive, so this is necessary.
* Proper Case conversion is used (when possible) in output results.
* Proper Case conversion is used (when possible) in output results.
** If people don't use the right case, this should fix at least some of the issues.
** If people don't use the right case, this should fix at least some of the issues.
Line 67: Line 67:
* I don't like all the ifeq: <nowiki>{{NAMESPACE}}</nowiki> | Main checks I added (part of my hiding missing entries above). That can be done a better way.
* I don't like all the ifeq: <nowiki>{{NAMESPACE}}</nowiki> | Main checks I added (part of my hiding missing entries above). That can be done a better way.
* Also need to split up all the level parameters.
* Also need to split up all the level parameters.
* Just getting started. Too many other things to do, so not gonna try listing them all (lots of trial and error with ideas anyway).  
* Just getting started. Too many other things to do, so not gonna try listing them all (lots of trial and error with ideas anyway).




'''I'm an idiot. I'm trying to use transcludesection directly from the template, instead of passing it on to each spell. Taking a break and I'll come at it fresh later.'''
'''I'm an idiot. I'm trying to use transcludesection directly from the template, instead of passing it on to each spell. Taking a break and I'll come at it fresh later.'''
----
* Added the test Template:Sec (Section Transclusion) by the author of [http://www.mediawiki.org/wiki/Extension:Labeled_Section_Transclusion Extension:Labeled Section Transclusion] and redid this to be used by it, with other reformatting.
** Only the name and description use it so far, but easier than redoing it all while testing (something always needs tweaking).
* Need the sec# tags on the spell pages themselves, so trying some tricks for that.
** <code><nowiki>&lt;includeonly>&amp;lt;onlyinclude>{{{sec1 |&lt;/includeonly></nowiki></code> and <code><nowiki>&lt;includeonly>}}}&amp;lt;/onlyinclude>&lt;/includeonly></nowiki></code> should be easier than the 3 templates below (might be able to do only 1 with a parameter for sec# too). Trying to avoid more templates that I don't know are even needed, or if they will work right (deletion requests here don't get resolved).
*** If this does work as I hope, and all parameters get separate tags included this way, adding a template makes sense (shouldn't need all 3 below then).
** [https://stackoverflow.com/questions/8947654/is-there-a-way-to-get-onlyinclude-included-onto-a-mediawiki-page-via-a-templa Hack for including onlyinclude tags] - uses safesubst and 3 simple templates.




Line 79: Line 91:




<!-- End of notes. -->
== Template start ==
== Template start ==
<!-- End of notes. -->
 
<onlyinclude>{{#ifeq:{{{transcludesection | spell updates}}} | spell updates | <div class="notice metadata" id="spell updates" style="background-color: #FFFFE0; margin: 0 1em; padding: 10px; border: 1px solid #CDCDB4;">
 
</noinclude><div class="notice metadata" id="spell updates" style="background-color: #FFFFE0; margin: 1em; padding: 10px; border: 1px solid #CDCDB4;">


''<font style="font-size: 16px;">Spell articles are presently undergoing an overhaul to improve ease of updating. Please excuse any mess that this may cause for the duration.</font>
''<font style="font-size: 16px;">Spell articles are presently undergoing an overhaul to improve ease of updating. Please excuse any mess that this may cause for the duration.</font>
</div>
</div>
}}
<includeonly>&lt;onlyinclude>{{{sec1 |</includeonly><b>Spell Name:</b> <!-- {{#ifeq: {{NAMESPACE}} | Main | {{{Name | {{SUBPAGENAME}} }}} | {{{Name}}} }} -->{{#ifeq: {{#titleparts: {{FULLPAGENAMEE}} | -1 }} | User:Gorgon/Sandbox/Sandbox_Alpha | {{{Name | {{SUBPAGENAME}} }}} | {{{Name}}} }} <includeonly>}}}&lt;/onlyinclude></includeonly> <br />
<includeonly>{{#ifeq:{{{transcludesection | name}}} | name | </includeonly><b>Spell Name:</b> {{{Name | {{SUBPAGENAME}} }}}<includeonly> }}</includeonly>{{#ifeq:{{{transcludesection | break 1}}} | break 1 |  <br />}}
<b>[[Magic:School | School]]:</b>&nbsp;<!-- {{#ifeq: {{NAMESPACE}} | Main -->{{#ifeq: {{#titleparts: {{FULLPAGENAMEE}} | -1 }} | User:Gorgon/Sandbox/Sandbox_Alpha
{{#ifeq:{{{transcludesection | template body}}} | template body
|  {{#switch: {{lc: {{{School | }}} }}
| <b>[[Magic:School | School]]</b>:&nbsp;<!-- {{#ifeq: {{NAMESPACE}} | Main -->{{#ifeq: {{#titleparts: {{FULLPAGENAMEE}} | -1 }} | User:Gorgon/Sandbox/Sandbox_Alpha
        |              = <span style="color:red">Empty "School" parameter!</span>
    |  {{#switch: {{lc: {{{School | }}} }}
        | abjuration    = [[Magic:Abjuration | Abjuration]]
            |              = <span style="color:red">Empty "School" parameter!</span>
        | conjuration  = [[Magic:Conjuration | Conjuration]]
            | abjuration    = [[Magic:Abjuration | Abjuration]]
        | conjuration  = [[Magic:Conjuration | Conjuration]]
            | conjuration  = [[Magic:Conjuration | Conjuration]]
        | divination    = [[Magic:Divination | Divination]]
            | conjuration  = [[Magic:Conjuration | Conjuration]]
        | enchantment  = [[Magic:Enchantment | Enchantment]]
            | divination    = [[Magic:Divination | Divination]]
        | evocation    = [[Magic:Evocation | Evocation]]
            | enchantment  = [[Magic:Enchantment | Enchantment]]
        | illusion      = [[Magic:Illusion | Illusion]]
            | evocation    = [[Magic:Evocation | Evocation]]
        | necromancy    = [[Magic:Necromancy | Necromancy]]
            | illusion      = [[Magic:Illusion | Illusion]]
        | transmutation = [[Magic:Transmutation | Transmutation]]
            | necromancy    = [[Magic:Necromancy | Necromancy]]
        | universal    = Universal
            | transmutation = [[Magic:Transmutation | Transmutation]]
        | #default      = <span style="color:red">Invalid "School" parameter!</span>
            | universal    = Universal
    }}
            | #default      = <span style="color:red">Invalid "School" parameter!</span>
    {{#switch: {{lc: {{{Subschool | }}} }}
        }}
        |            = <!-- This blank case and result is needed to not trigger the default Invalid "Subschool" error -->
        {{#switch: {{lc: {{{Subschool | }}} }}
        | calling    = {{#ifeq: {{lc: {{{School | }}} }} | conjuration | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]:</b> [[Magic:Conjuration#Calling | Calling]] ) | ( <span style="color:red"><nowiki>"Subschool = Calling" requires "School = Conjuration"!</nowiki></span> ) }}
            |            = <!-- This blank case and result is needed to not trigger the default Invalid "Subschool" error -->
        | creation  = {{#ifeq: {{lc: {{{School | }}} }} | conjuration | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]:</b> [[Magic:Conjuration#Creation | Creation]] ) | ( <span style="color:red"><nowiki>"Subschool = Creation" requires "School = Conjuration"!</nowiki></span> ) }}
            | calling    = {{#ifeq: {{lc: {{{School | }}} }} | conjuration | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]</b>: [[Magic:Conjuration#Calling | Calling]] ) | ( <span style="color:red"><nowiki>"Subschool = Calling" requires "School = Conjuration"!</nowiki></span> ) }}
        | healing    = {{#ifeq: {{lc: {{{School | }}} }} | conjuration | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]:</b> [[Magic:Conjuration#Healing | Healing]] ) | ( <span style="color:red"><nowiki>"Subschool = Healing" requires "School = Conjuration"!</nowiki></span> ) }}
            | creation  = {{#ifeq: {{lc: {{{School | }}} }} | conjuration | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]</b>: [[Magic:Conjuration#Creation | Creation]] ) | ( <span style="color:red"><nowiki>"Subschool = Creation" requires "School = Conjuration"!</nowiki></span> ) }}
        | summoning  = {{#ifeq: {{lc: {{{School | }}} }} | conjuration | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]:</b> [[Magic:Conjuration#Summoning | Summoning]] ) | ( <span style="color:red"><nowiki>"Subschool = Summoning" requires "School = Conjuration"!</nowiki></span> ) }}
            | healing    = {{#ifeq: {{lc: {{{School | }}} }} | conjuration | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]</b>: [[Magic:Conjuration#Healing | Healing]] ) | ( <span style="color:red"><nowiki>"Subschool = Healing" requires "School = Conjuration"!</nowiki></span> ) }}
        | charm      = {{#ifeq: {{lc: {{{School | }}} }} | enchantment | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]:</b> [[Magic:Enchantment#Charm | Charm]] ) | ( <span style="color:red"><nowiki>"Subschool = Charm" requires "School = Enchantment"!</nowiki></span> ) }}
            | summoning  = {{#ifeq: {{lc: {{{School | }}} }} | conjuration | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]</b>: [[Magic:Conjuration#Summoning | Summoning]] ) | ( <span style="color:red"><nowiki>"Subschool = Summoning" requires "School = Conjuration"!</nowiki></span> ) }}
        | compulsion = {{#ifeq: {{lc: {{{School | }}} }} | enchantment | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]:</b> [[Magic:Enchantment#Compulsion | Compulsion]] ) | ( <span style="color:red"><nowiki>"Subschool = Compulsion" requires "School = Enchantment"!</nowiki></span> ) }}
            | charm      = {{#ifeq: {{lc: {{{School | }}} }} | enchantment | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]</b>: [[Magic:Enchantment#Charm | Charm]] ) | ( <span style="color:red"><nowiki>"Subschool = Charm" requires "School = Enchantment"!</nowiki></span> ) }}
        | figment    = {{#ifeq: {{lc: {{{School | }}} }} | Illusion | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]:</b> [[Magic:Illusion#Figment | Figment]] ) | ( <span style="color:red"><nowiki>"Subschool = Figment" requires "School = Illusion"!</nowiki></span> ) }}
            | compulsion = {{#ifeq: {{lc: {{{School | }}} }} | enchantment | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]</b>: [[Magic:Enchantment#Compulsion | Compulsion]] ) | ( <span style="color:red"><nowiki>"Subschool = Compulsion" requires "School = Enchantment"!</nowiki></span> ) }}
        | glamer    = {{#ifeq: {{lc: {{{School | }}} }} | Illusion | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]:</b> [[Magic:Illusion#Glamer | Glamer]] ) | ( <span style="color:red"><nowiki>"Subschool = Glamer" requires "School = Illusion"!</nowiki></span> ) }}
            | figment    = {{#ifeq: {{lc: {{{School | }}} }} | Illusion | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]</b>: [[Magic:Illusion#Figment | Figment]] ) | ( <span style="color:red"><nowiki>"Subschool = Figment" requires "School = Illusion"!</nowiki></span> ) }}
        | pattern    = {{#ifeq: {{lc: {{{School | }}} }} | Illusion | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]:</b> [[Magic:Illusion#Pattern | Pattern]] ) | ( <span style="color:red"><nowiki>"Subschool = Pattern" requires "School = Illusion"!</nowiki></span> ) }}
            | glamer    = {{#ifeq: {{lc: {{{School | }}} }} | Illusion | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]</b>: [[Magic:Illusion#Glamer | Glamer]] ) | ( <span style="color:red"><nowiki>"Subschool = Glamer" requires "School = Illusion"!</nowiki></span> ) }}
        | phantasm  = {{#ifeq: {{lc: {{{School | }}} }} | Illusion | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]:</b> [[Magic:Illusion#Phantasm | Phantasm]] ) | ( <span style="color:red"><nowiki>"Subschool = Phantasm" requires "School = Illusion"!</nowiki></span> ) }}
            | pattern    = {{#ifeq: {{lc: {{{School | }}} }} | Illusion | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]</b>: [[Magic:Illusion#Pattern | Pattern]] ) | ( <span style="color:red"><nowiki>"Subschool = Pattern" requires "School = Illusion"!</nowiki></span> ) }}
        | shadow    = {{#ifeq: {{lc: {{{School | }}} }} | Illusion | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]:</b> [[Magic:Illusion#Shadow | Shadow]] ) | ( <span style="color:red"><nowiki>"Subschool = Shadow" requires "School = Illusion"!</nowiki></span> ) }}
            | phantasm  = {{#ifeq: {{lc: {{{School | }}} }} | Illusion | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]</b>: [[Magic:Illusion#Phantasm | Phantasm]] ) | ( <span style="color:red"><nowiki>"Subschool = Phantasm" requires "School = Illusion"!</nowiki></span> ) }}
        | #default  = &nbsp;( <span style="color:red">Invalid "Subschool" parameter!</span> )
            | shadow    = {{#ifeq: {{lc: {{{School | }}} }} | Illusion | &nbsp;( <b>[[Magic:Spell_Format:Subschool | Subschool]]</b>: [[Magic:Illusion#Shadow | Shadow]] ) | ( <span style="color:red"><nowiki>"Subschool = Shadow" requires "School = Illusion"!</nowiki></span> ) }}
    }}
            | #default  = &nbsp;( <span style="color:red">Invalid "Subschool" parameter!</span> )
    {{#switch: {{lc: {{{Descriptor | }}} }}
        }}
        |                    = <!-- This blank case and result is needed to not trigger the default Invalid "Descriptor" error -->
        {{#switch: {{lc: {{{Descriptor | }}} }}
        | acid | chaotic | cold | darkness | death | disease | divine | electricity | evil
            |                    = <!-- This blank case and result is needed to not trigger the default Invalid "Descriptor" error -->
        | fear | fire | force | good | language-dependent | lawful | light | mind-affecting
            | acid | chaotic | cold | darkness | death | disease | divine | electricity | evil
        | negative | nature | paralyze | poison | positive | sonic | teleportation
            | fear | fire | force | good | language-dependent | lawful | light | mind-affecting
        | weapon enchantment = &nbsp;[ <b>[[Magic:Descriptors | Descriptors]]:</b> {{{Descriptor}}}
            | negative | nature | paralyze | poison | positive | sonic | teleportation
            {{#if: {{{Descriptor 2 | }}}
            | weapon enchantment = &nbsp;[ <b>[[Magic:Descriptors | Descriptors]]</b>: {{{Descriptor}}}
            |  {{#switch: {{lc: {{{Descriptor 2 | }}} }}
                {{#if: {{{Descriptor 2 | }}}
                    | {{lc: {{{Descriptor}}} }} = <span style="color:red">, Duplicate "Descriptor 2" parameter!</span>
                |   {{#switch: {{lc: {{{Descriptor 2 | }}} }}
                    | acid | chaotic | cold | darkness | death | disease | divine | electricity | evil
                        | {{lc: {{{Descriptor}}} }} = <span style="color:red">, Duplicate "Descriptor 2" parameter!</span>
                    | fear | fire | force | good | language-dependent | lawful | light | mind-affecting
                    | negative | nature | paralyze | poison | positive | sonic | teleportation
                    | weapon enchantment = , {{{Descriptor 2}}}
                    | #default          = <span style="color:red">, Invalid "Descriptor 2" parameter!</span>
                }}
                {{#if: {{{Descriptor 3 | }}}
                |  {{#switch: {{lc: {{{Descriptor 3 | }}} }}
                        | {{lc: {{{Descriptor | }}} }} | {{lc: {{{Descriptor 2 | }}} }} = <span style="color:red">, Duplicate "Descriptor 3" parameter!</span>
                         | acid | chaotic | cold | darkness | death | disease | divine | electricity | evil
                         | acid | chaotic | cold | darkness | death | disease | divine | electricity | evil
                         | fear | fire | force | good | language-dependent | lawful | light | mind-affecting
                         | fear | fire | force | good | language-dependent | lawful | light | mind-affecting
                         | negative | nature | paralyze | poison | positive | sonic | teleportation
                         | negative | nature | paralyze | poison | positive | sonic | teleportation
                         | weapon enchantment = , {{{Descriptor 2}}}
                         | weapon enchantment = , {{{Descriptor 3}}}
                         | #default          = <span style="color:red">, Invalid "Descriptor 2" parameter!</span>
                         | #default          = <span style="color:red">, Invalid "Descriptor 3" parameter!</span>
                    }}
                    {{#if: {{{Descriptor 3 | }}}
                    |  {{#switch: {{lc: {{{Descriptor 3 | }}} }}
                            | {{lc: {{{Descriptor | }}} }} | {{lc: {{{Descriptor 2 | }}} }} = <span style="color:red">, Duplicate "Descriptor 3" parameter!</span>
                            | acid | chaotic | cold | darkness | death | disease | divine | electricity | evil
                            | fear | fire | force | good | language-dependent | lawful | light | mind-affecting
                            | negative | nature | paralyze | poison | positive | sonic | teleportation
                            | weapon enchantment = , {{{Descriptor 3}}}
                            | #default          = <span style="color:red">, Invalid "Descriptor 3" parameter!</span>
                        }}
                     }}
                     }}
                 }} ]
                 }}
            | #default = &nbsp;[ <b>[[Magic:Descriptors | Descriptors]]</b>: <span style="color:red">Invalid "Descriptor" parameter! ]</span>
            }} ]
        }}
        | #default = &nbsp;[ <b>[[Magic:Descriptors | Descriptors]]:</b> <span style="color:red">Invalid "Descriptor" parameter! ]</span>
    |  {{{School}}} ( <b>[[Magic:Spell_Format:Subschool | Subschool]]</b>: {{{Subschool}}} ) [ <b>[[Magic:Descriptors | Descriptors]]</b>: {{{Descriptor}}}, {{{Descriptor 2}}}, {{{Descriptor 3}}} ]
    }}
    }} <br />
|  {{{School}}} ( <b>[[Magic:Spell_Format:Subschool | Subschool]]:</b> {{{Subschool}}} ) [ <b>[[Magic:Descriptors | Descriptors]]:</b> {{{Descriptor}}}, {{{Descriptor 2}}}, {{{Descriptor 3}}} ] }} <br />
<b>[[Magic:Level | Level]]:</b> {{#ifeq: {{NAMESPACE}} | Main | {{{Level | }}} | {{{Level}}} }} <br />
<b>[[Magic:Level | Level(s)]]:</b> {{#ifeq: {{NAMESPACE}} | Main | {{{Level | }}} | {{{Level}}} }} <br />
<b>[[Magic:Innate_Level | Innate Level]]:</b> {{#ifeq: {{NAMESPACE}} | Main | {{{Innate Level | }}} | {{{Innate Level}}} }} <br />
<b>[[Magic:Innate_Level | Innate Level]]:</b> {{#ifeq: {{NAMESPACE}} | Main | {{{Innate Level | }}} | {{{Innate Level}}} }} <br />
<b>[[Magic:Components | Component(s)]]:</b> {{#ifeq: {{NAMESPACE}} | Main | {{{Components | }}} | {{{Components}}} }} <br />
<b>[[Magic:Components | Component(s)]]:</b> {{#ifeq: {{NAMESPACE}} | Main | {{{Components | }}} | {{{Components}}} }} <br />
Line 161: Line 171:
<b>[[Magic:Metamagic | Metamagic]]:</b> {{#ifeq: {{NAMESPACE}} | Main | {{{Metamagic | }}} | {{{Metamagic}}} }} <br />
<b>[[Magic:Metamagic | Metamagic]]:</b> {{#ifeq: {{NAMESPACE}} | Main | {{{Metamagic | }}} | {{{Metamagic}}} }} <br />
<b>[[Magic:Energy_Substitution | Energy Substitution]]:</b> {{#ifeq: {{NAMESPACE}} | Main | {{{Energy Substitution | }}} | {{{Energy Substitution}}} }} <br />
<b>[[Magic:Energy_Substitution | Energy Substitution]]:</b> {{#ifeq: {{NAMESPACE}} | Main | {{{Energy Substitution | }}} | {{{Energy Substitution}}} }} <br />
}}
<includeonly>&lt;onlyinclude>{{{sec5 |</includeonly>{{#ifeq: {{NAMESPACE}} | Main |{{{Description Summary | }}} |{{{Description Summary}}} }} <includeonly>}}}&lt;/onlyinclude></includeonly>
{{#ifeq:{{{transcludesection | description summary}}} | description summary | {{#ifeq: {{NAMESPACE}} | Main | {{{Description Summary | }}} | {{{Description Summary}}} }} }}
{{#if: {{{Description Details | }}} | <br /><br /> | <!-- {{#ifeq: {{NAMESPACE}} | Template | <br /><br /> }} -->{{#ifeq: {{FULLPAGENAMEE}} | User:Gorgon/Sandbox/Sandbox_Alpha | <br /><br /> }} }}
{{#ifeq:{{{transcludesection | break 2}}} | break 2 | {{#if: {{{Description Details | }}} | <br /><br />}}}}
{{#ifeq: {{NAMESPACE}} | Main |{{{Description Details | }}} |{{{Description Details}}} }}
{{#ifeq:{{{transcludesection | description details}}} | description details | {{#ifeq: {{NAMESPACE}} | Main | {{{Description Details | }}} | {{{Description Details}}} }} }} }}<!-- {{#ifeq:{{{transcludesection | page categories}}} | page categories | <includeonly>
<includeonly>{{#ifeq: {{NAMESPACE}} | Main |
 
[[Category:Magic |{{{name | {{PAGENAME}} }}}]]
[[Category:Magic |{{{name | {{PAGENAME}} }}}]]
[[Category:{{{School}}}_Spells |{{{name | {{PAGENAME}} }}}]]</includeonly> }} --></onlyinclude><!--
[[Category:{{{School}}}_Spells |{{{name | {{PAGENAME}} }}}]] }}</includeonly>
 
{{#ifeq: {{NAMESPACE}} | Template |
[[Category:Templates |{{PAGENAME}}]] -->
[[Category:Templates |{{PAGENAME}}]] }}<noinclude>


<!-- Add template documentation here, or include a doc subpage (see: http://wikipedia.org/wiki/Wikipedia:Template_documentation#How_to_create_a_documentation_subpage). The <templatedata></templatedata> tags would be simpler. -->
<!-- Add template documentation here, or include a doc subpage (see: http://wikipedia.org/wiki/Wikipedia:Template_documentation#How_to_create_a_documentation_subpage). The <templatedata></templatedata> tags would be simpler. -->
== Non-transcluded template documentation [eventually an included doc subpage or <templatedata>] ==


== Non-transcluded template documentation [eventually an included doc subpage or <templatedata>] ==


[[Magic:Spell_Format]] should be here as documentation, instead of that hard to find page.
[[Magic:Spell_Format]] should be here as documentation, instead of that hard to find page.
Line 179: Line 188:
Add template documentation here, or include a doc subpage (see: [[Wikipedia:Wikipedia:Template_documentation#How_to_create_a_documentation_subpage | How to create a documentation subpage]]).
Add template documentation here, or include a doc subpage (see: [[Wikipedia:Wikipedia:Template_documentation#How_to_create_a_documentation_subpage | How to create a documentation subpage]]).
* A <nowiki>{{</nowiki>[[Wikipedia:Template:Documentation |Documentation]]<nowiki>}}</nowiki> sub-template would be useful for all templates on this wiki, since they need usage documentation (stripped down version, without the dozens of other templates).
* A <nowiki>{{</nowiki>[[Wikipedia:Template:Documentation |Documentation]]<nowiki>}}</nowiki> sub-template would be useful for all templates on this wiki, since they need usage documentation (stripped down version, without the dozens of other templates).
* [http://www.mediawiki.org/wiki/Extension:TemplateData Extension:TemplateData] would work better on its own, keeping things simple.  
* [http://www.mediawiki.org/wiki/Extension:TemplateData Extension:TemplateData] would work better on its own, keeping things simple.
** It should install a "Manage TemplateData" button for the edit gui, but I am not sure what else that needs (probably [http://www.mediawiki.org/wiki/VisualEditor VisualEditor], which is a slow pig, so pass on that). See: [http://www.mediawiki.org/wiki/Help:TemplateData#TemplateData_editor TemplateData editor].  
** It should install a "Manage TemplateData" button for the edit gui, but I am not sure what else that needs (probably [http://www.mediawiki.org/wiki/VisualEditor VisualEditor], which is a slow pig, so pass on that). See: [http://www.mediawiki.org/wiki/Help:TemplateData#TemplateData_editor TemplateData editor].
** Below is what might be the beginning of the spell template documentation as an example (using <nowiki><templatedata></templatedata></nowiki> tags), if it is done manually. ''I have the "Name" as'' '''"required": false''' ''because I may try grabbing it from the page title, if it isn't given.''
** Below is what might be the beginning of the spell template documentation as an example (using <nowiki><templatedata></templatedata></nowiki> tags), if it is done manually. ''I have the "Name" as'' '''"required": false''' ''because I may try grabbing it from the page title, if it isn't given.''
<pre style="white-space: pre-wrap"><nowiki>
 
<pre style="white-space: pre-wrap">


== Usage ==
== Usage ==
Line 283: Line 293:
             "inherits": "Domain Level"
             "inherits": "Domain Level"
         }
         }
     },          
     },
     "paramOrder": [
     "paramOrder": [
         "Name",
         "Name",
Line 302: Line 312:
}
}
</templatedata>
</templatedata>
</nowiki></pre>
</pre>


Obviously I've added more parameters for class and domain spells, similar to the NWN Wiki version of [[NWN:Template:Spell | Template:Spell]]. Their full parameter list is below (they don't use Subschool, and I used proper case with spaces for all parameters):
Obviously I've added more parameters for class and domain spells, similar to the NWN Wiki version of [[NWN:Template:Spell | Template:Spell]]. Their full parameter list is below (they don't use Subschool, and I used proper case with spaces for all parameters):




:'''Spell levels:'''  
:'''Spell levels:'''
:*''bardlevel'' &mdash; The level of this spell when cast by a [[bard]]. ''Optional''
:*''bardlevel'' &mdash; The level of this spell when cast by a [[bard]]. ''Optional''
:*''clericlevel'' &mdash; The level of this spell when cast by a [[cleric]]. ''Optional''
:*''clericlevel'' &mdash; The level of this spell when cast by a [[cleric]]. ''Optional''
Line 349: Line 359:




<!-- End of documentation. -->
<!-- End of documentation. --></noinclude>

Revision as of 23:06, 27 January 2017

Anything up to/including the Template start heading will not be included in transclusion of this template (or any part of the trailing documentation section either, though that will eventually be formalized template documentation, possibly with transcluded categories at the end).

I love to over-comment my code, so why change things here...




Test version of Template:Spell

Extensions that would make this work better [My wish list]

  • Extension:Labeled Section Transclusion - Allows selective transclusion of marked-off sections of text.
  • Extension:DynamicPageList (third-party) - Enhanced version of Extension:DynamicPageList (Wikimedia)
    • DPL:Overview - Generate dynamic reports based on category members and selective included info from each (Extension:Labeled Section Transclusion above would really help there).
    • DPL:Template:Catlist - Picture this totally reformatted as filter/sort options up top of the Spell List page, as a dynamic table. It starts showing all spells, but sortable with one click by level, school, class, or any other useful Template:Spell parameter/category used by them. Then add in the ability to filter results to only certain kinds/combinations (e.g, Show only cleric evocation spells, sorted by level, with the option of showing specific domain ones as well).
    • I doubt anyone else besides me would use this (except maybe the occasional dabbler), but it would really be useful for spells, and maybe a few other things eventually. Revamping all spells via this template is a huge undertaking (and my main goal for wiki updating, now that I can verify/test spells again), so adding this extension for that work alone would make a huge difference.
    • After looking into the more recent version of Extension:DynamicPageList (Wikimedia) (the one used by most Wikimedia projects, not the "enhanced - 3rd party one"), it may be just as useful (or better), since it allows more sort options. Need to see both in practical use before deciding anything.
  • Extension:TemplateData - See the documentation section below.


Revision notes

  • Template:Spell on the NWN Wiki has some ideas, but not quite what I had in mind either.
  • I think Buddha had the right idea with his discussion on the Categories page about reformatting how we categorize spells. The current Spell List page (and its various subversions) all rely on manual updating when any new changes happen to it, like a new spell being added. Revisions to this template will improve how each spell is displayed, and categorized (even without new extensions), so moving to category listings that update dynamically makes a lot of sense.




Can the "Name" template parameter be taken from the page name automatically?

  • Maybe as a default if not given as a parameter?
  • Might need some page renaming, but should work.
  • Keeping the template from categorizing itself as a spell might be annoying, unless namespace checking or other validation is done.




  • Redone using onlyinclude sections with transcludesection tags (See above).
    • Not as simple as Labeled Section Transclusion, and can't do some things with it, but good enough for now.
  • Major School/Subschool/Descriptors redo.
    • Added the Subschool: and Descriptors: prefixes, but they may make the School line too long.
    • Added a bunch of validation checks in switches.
  • Added Spell Name: at the top.
    • Having every spell "Name" be the page name "Magic:Name" was inaccurate and confusing.
    • Uses the Name = parameter, or Sandbox Alpha if not entered (n).
  • All parameters are now Proper Case.
  • Lowercase conversion is used for comparison validation of parameter values (when possible).
    • ifeq: and case entries in a switch are case sensitive, so this is necessary.
  • Proper Case conversion is used (when possible) in output results.
    • If people don't use the right case, this should fix at least some of the issues.
  • Added a bunch of namespace checks as part of the validation,
    • All spells should be in the Main namespace, so anything outside that is a template (or test page in a userspace).
    • Added a hak to make my sandbox spell pages work as if in Main (remember to change it back when publishing this).
  • Started making missing parameter entries (without forced defaults or warnings) not show in Main, instead of the {{{parameter name}}} (like in the Template namespace).
    • Better to add warnings (when defaults aren't possible) for all that should be included. If they see annoying red stuff, they will have to fix it.
  • Split Description Summary and Description Details parameters, so the summary can be trandcluded as a short description elsewhere.
    • Need to make the Description Details optional (and conditionalon the summary) and add a default "No description" blurb to the summary.
  • I don't like all the ifeq: {{NAMESPACE}} | Main checks I added (part of my hiding missing entries above). That can be done a better way.
  • Also need to split up all the level parameters.
  • Just getting started. Too many other things to do, so not gonna try listing them all (lots of trial and error with ideas anyway).


I'm an idiot. I'm trying to use transcludesection directly from the template, instead of passing it on to each spell. Taking a break and I'll come at it fresh later.




  • Added the test Template:Sec (Section Transclusion) by the author of Extension:Labeled Section Transclusion and redid this to be used by it, with other reformatting.
    • Only the name and description use it so far, but easier than redoing it all while testing (something always needs tweaking).
  • Need the sec# tags on the spell pages themselves, so trying some tricks for that.
    • <includeonly>&lt;onlyinclude>{{{sec1 |</includeonly> and <includeonly>}}}&lt;/onlyinclude></includeonly> should be easier than the 3 templates below (might be able to do only 1 with a parameter for sec# too). Trying to avoid more templates that I don't know are even needed, or if they will work right (deletion requests here don't get resolved).
      • If this does work as I hope, and all parameters get separate tags included this way, adding a template makes sense (shouldn't need all 3 below then).
    • Hack for including onlyinclude tags - uses safesubst and 3 simple templates.




More to come...


Template start

Spell Name: {{{Name}}}
School: {{{School}}} ( Subschool: {{{Subschool}}} ) [ Descriptors: {{{Descriptor}}}, {{{Descriptor 2}}}, {{{Descriptor 3}}} ]
Level(s): {{{Level}}}
Innate Level: {{{Innate Level}}}
Component(s): {{{Components}}}
Casting Time: {{{Casting Time}}}
Range: {{{Range}}}
Target: {{{Target}}}
Duration: {{{Duration}}}
Counter(s): {{{Counters}}}
Saving Throw: {{{Saving Throw}}}
Spell Resistance: {{{Spell Resistance}}}
Metamagic: {{{Metamagic}}}
Energy Substitution: {{{Energy Substitution}}}
{{{Description Summary}}}

{{{Description Details}}}


Non-transcluded template documentation [eventually an included doc subpage or <templatedata>]

Magic:Spell_Format should be here as documentation, instead of that hard to find page.

Add template documentation here, or include a doc subpage (see: How to create a documentation subpage).

  • A {{Documentation}} sub-template would be useful for all templates on this wiki, since they need usage documentation (stripped down version, without the dozens of other templates).
  • Extension:TemplateData would work better on its own, keeping things simple.
    • It should install a "Manage TemplateData" button for the edit gui, but I am not sure what else that needs (probably VisualEditor, which is a slow pig, so pass on that). See: TemplateData editor.
    • Below is what might be the beginning of the spell template documentation as an example (using <templatedata></templatedata> tags), if it is done manually. I have the "Name" as "required": false because I may try grabbing it from the page title, if it isn't given.

== Usage ==

<templatedata>
{
    "description": "Spells Template",
    "params": {
        "Name": {
            "label": "Spell Name",
            "description": "Name of the Spell (Uses the page title if not defined)",
            "required": false,
            "suggested": true,
            "default": {{SUBPAGENAME}},
            "type": "string",
            "example": "Name = Freedom of Movement"
        },
        "School": {
            "label": "Spell School",
            "description": "School of magic the spell belongs to. Must be one of: Abjuration, Conjuration, Divination, Enchantment, Evocation, Illusion, Necromancy, Transmutation or Universal.",
            "required": true,
            "type": "string",
            "example": "School = Abjuration"
        },
        "Subschool": {
            "label": "Spell Subschool",
            "description": "Subschool of the spell.",
            "required": false,
            "type": "string",
            "example": "Subschool = "
        },
        "Descriptors": {
            "label": "Spell Descriptors",
            "description": "Descriptors of the spell.",
            "required": false,
            "type": "string",
            "example": "Descriptors = "
        },
        "Bard Level": {
            "label": "Bard Level",
            "description": "Level of spell for Bards (if it is a Bard spell).",
            "required": false,
            "type": "number",
            "example": "Bard Level = "
        },
        "Cleric Level": {
            "label": "Cleric Level",
            "description": "Level of spell for Clerics (if it is a Cleric spell).",
            "example": "Cleric Level = 4",
            "inherits": "Bard Level"
        },
        "Druid Level": {
            "label": "Druid Level",
            "description": "Level of spell for Druids (if it is a Druid spell).",
            "example": "Druid Level = 4",
            "inherits": "Bard Level"
        },
        "Paladin Level": {
            "label": "Paladin Level",
            "description": "Level of spell for Paladins (if it is a Paladin spell).",
            "example": "Paladin Level = 4",
            "inherits": "Bard Level"
        },
        "Ranger Level": {
            "label": "Ranger Level",
            "description": "Level of spell for Rangers (if it is a Ranger spell).",
            "example": "Ranger Level = 4",
            "inherits": "Bard Level"
        },
        "Arcane Level": {
            "label": "Sorcerer/Wizard Level",
            "description": "Level of spell for Sorcerers/Wizards (if it is an Arcane spell).",
            "example": "Arcane Level = 4",
            "inherits": "Bard Level"
        },
        "Domain": {
            "label": "Domain (1) Name",
            "description": "1st Domain name of spell for Clerics (if it is a Domain spell).",
            "required": false,
            "type": "string",
            "example": "Domain = Travel"
        },
        "Domain Level": {
            "label": "Domain (1) Level",
            "description": "1st Domain Level of spell for Clerics (if it is a Domain spell).",
            "required": false,
            "type": "number",
            "example": "Domain Level = 3"
        },
        "Domain 2": {
            "label": "Domain (2) Name",
            "description": "2nd Domain name of spell for Clerics (if it is a Domain spell).",
            "example": "Domain 2 = ",
            "inherits": "Domain"
        },
        "Domain 2 Level": {
            "label": "Domain (2) Level",
            "description": "2nd Domain Level of spell for Clerics (if it is a Domain spell).",
            "example": "Domain 2 Level = ",
            "inherits": "Domain Level"
        }
    },
    "paramOrder": [
        "Name",
        "School",
        "Subschool",
        "Descriptors",
        "Bard Level",
        "Cleric Level",
        "Druid Level",
        "Paladin Level",
        "Ranger Level",
        "Arcane Level",
        "Domain",
        "Domain Level",
        "Domain 2",
        "Domain 2 Level"
    ]
}
</templatedata>

Obviously I've added more parameters for class and domain spells, similar to the NWN Wiki version of Template:Spell. Their full parameter list is below (they don't use Subschool, and I used proper case with spaces for all parameters):


Spell levels:
  • bardlevel — The level of this spell when cast by a bard. Optional
  • clericlevel — The level of this spell when cast by a cleric. Optional
  • druidlevel — The level of this spell when cast by a druid. Optional
  • paladinlevel — The level of this spell when cast by a paladin. Optional
  • rangerlevel — The level of this spell when cast by a ranger. Optional
  • magelevel — The level of this spell when cast by a sorcerer or wizard. Optional
  • domain — The clerical domain that grants access to this spell. Optional
  • domainlevel — The level of this spell when granted by this domain. Required if domain is specified
  • domain2 — A second clerical domain that grants access to this spell. Optional
  • domain2level — The level of this spell when granted by the second domain. Required if domain2 is specified
  • domain3 — A third clerical domain that grants access to this spell. Optional
  • domain3level — The level of this spell when granted by the third domain. Required if domain3 is specified
  • domain4 — A fourth clerical domain that grants access to this spell. Optional
  • domain4level — The level of this spell when granted by the fourth domain. Required if domain4 is specified
  • innatelevel — The innate level of this spell.


Lines of spells:
  • line — a name for the spell line this spell belongs to. Optional, but if not set then line0 through line9 are ignored
  • line0 through line9 — names of spells (not linked) that are considered in the same "line" of spells as the current spell. Use the parameter corresponding to the spell's innate level. Include the current spell. Optional, but some should be used if "line" is set
  • linebreach — set this (to "yes") to get a table for the breach line of spells. (This is a hack to accommodate disjunction having two spell lines.) Optional


Other:
  • area — The area affected by this spell. The values "small", "medium", "large", "huge", "gargantuan", "colossal", and "spellcone" should be used when appropriate.
    • areanote — Additional information about the area of effect (e.g. a limit on the number of targets in a colossal area). Optional
    • conesize — This can override the default length of "10" for spell cones.
  • components — "V", "S", or "VS" indicating the components this spell utilizes. Optional
  • counters — Additional counterspells, preferably linked. Optional
  • duration — The duration of the spell.
  • immunity — The descriptor (immunity type) of this spell. Optional
  • range — "p", "t", "s", "m", or "l" indicating the range of the spell.
  • save — The save allowed for this spell, preferably linked. Optional
  • school — The spell school of this spell, preferably linked.
  • spellcraft — The spellcraft requirement (for epic spells). Optional, epic only
  • spellresistance — Should be "yes" if spell resistance can bock this spell. Should be "yes*" if the BioWare description says spell resistance can block this spell, but it does not actually do so. Optional
  • desc — The spell's in-game description.
  • icon — The name of the image (icon) for this spell. Optional