Difference between revisions of "User:Alec/BookTemplate/LabBook"

From Maths
Jump to: navigation, search
m
m
Line 1: Line 1:
 
# Tried to create a reference template with an if statement for the name attribute (so as to create an anonymous reference when there is a note provided) however it wasn't interpreted as XML with a {{C|>}} - created [[User:Alec/BookTemplate/EvalTemplate]] to see if that'll help. This template evaluates to whatever it is given.
 
# Tried to create a reference template with an if statement for the name attribute (so as to create an anonymous reference when there is a note provided) however it wasn't interpreted as XML with a {{C|>}} - created [[User:Alec/BookTemplate/EvalTemplate]] to see if that'll help. This template evaluates to whatever it is given.
 
# Discovered it was a missing space between {{C|<nowiki><ref</nowiki>}} and {{C|<nowiki>{{#if:</nowiki>}} that caused the problem. ''EvalTemplate can be removed''
 
# Discovered it was a missing space between {{C|<nowiki><ref</nowiki>}} and {{C|<nowiki>{{#if:</nowiki>}} that caused the problem. ''EvalTemplate can be removed''
 +
# Discovered mediawiki cannot substitute between XML tags, and instead there's the {{C|#tag}} special parser function instead, it's not documented! I had to search the source code, there's a line in {{C|ParserMethodsTest.php}} (in {{C|tests/phpunit/includes/parser}} in the Mediawiki directory) that reads:
 +
#* {{C|<nowiki>{{#tag:pre|foo|style=margin-left: 1.6em}}</nowiki>}}
 +
#** From this I concluded {{C|<nowiki>{{#tag:name|content|attrib=value}}</nowiki>}} works, I think it uses the normal {{C|1=named=thing}} syntax of templates and thus quotes are not needed.

Revision as of 13:59, 30 July 2016

  1. Tried to create a reference template with an if statement for the name attribute (so as to create an anonymous reference when there is a note provided) however it wasn't interpreted as XML with a > - created User:Alec/BookTemplate/EvalTemplate to see if that'll help. This template evaluates to whatever it is given.
  2. Discovered it was a missing space between <ref and {{#if: that caused the problem. EvalTemplate can be removed
  3. Discovered mediawiki cannot substitute between XML tags, and instead there's the #tag special parser function instead, it's not documented! I had to search the source code, there's a line in ParserMethodsTest.php (in tests/phpunit/includes/parser in the Mediawiki directory) that reads:
    • {{#tag:pre|foo|style=margin-left: 1.6em}}
      • From this I concluded {{#tag:name|content|attrib=value}} works, I think it uses the normal named=thing syntax of templates and thus quotes are not needed.