Difference between revisions of "User:Alec/BookTemplate/LabBook"
From Maths
< User:Alec | BookTemplate
m |
m |
||
(4 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
#* {{C|<nowiki>{{#tag:pre|foo|style=margin-left: 1.6em}}</nowiki>}} | #* {{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. | #** 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. | ||
+ | # I can't put like: {{C|<nowiki>{{#tag:name|content|{{if statement}}</nowiki>}} where the if statement might evaluate to {{C|1=a=b}} or nothing, and have both work, so I need to do: | ||
+ | #* {{C|<nowiki>{{#if:whatever|{{#tag:a|b|c=d}}|{{#tag:a|b}}}}</nowiki>}} instead | ||
+ | # Created page {{C|rBA}} (reference for book A) with {{C|1=<nowiki>{{:User:Alec/BookTemplate/ReferenceTemplate|RefName=BA|Content=[[User:Alec/BookTemplate/BookA|BookA]]{{#if:{{{Content|}}}|<nowiki> </nowiki>{{{Content}}}|}}}}</nowiki>}} | ||
+ | #* There are a few things, like passing groups or different names to the reference, but this is a good start | ||
+ | #* Will also start signing the log entries [[User:Alec|Alec]] ([[User talk:Alec|talk]]) 14:27, 30 July 2016 (UTC) | ||
+ | # There seems to be no way to do this, I cannot have something that is not {{C|<nowiki>{{{Content}}}</nowiki>}} expand to {{C|<nowiki>{{{Content}}}</nowiki>}} | ||
+ | #* I shall have to manually pass parameters to the template, however if I make a change to the style I shall need error reporting, so I shall add a version tag which will categorise pages which have invalid/missing/need-work tags [[User:Alec|Alec]] ([[User talk:Alec|talk]]) 21:12, 30 July 2016 (UTC) | ||
+ | # Adding book reference template, which will be the thing that renders a book [[User:Alec|Alec]] ([[User talk:Alec|talk]]) 21:16, 30 July 2016 (UTC) | ||
+ | # The example page is functional. All I need now is a versioning system that'll make obsolete changes known! [[User:Alec|Alec]] ([[User talk:Alec|talk]]) 21:45, 30 July 2016 (UTC) |
Latest revision as of 21:45, 30 July 2016
- 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.
- Discovered it was a missing space between <ref and {{#if: that caused the problem. EvalTemplate can be removed
- 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.
- {{#tag:pre|foo|style=margin-left: 1.6em}}
- I can't put like: {{#tag:name|content|{{if statement}} where the if statement might evaluate to a=b or nothing, and have both work, so I need to do:
- {{#if:whatever|{{#tag:a|b|c=d}}|{{#tag:a|b}}}} instead
- Created page rBA (reference for book A) with {{:User:Alec/BookTemplate/ReferenceTemplate|RefName=BA|Content=[[User:Alec/BookTemplate/BookA|BookA]]{{#if:{{{Content|}}}|<nowiki> </nowiki>{{{Content}}}|}}}}
- There seems to be no way to do this, I cannot have something that is not {{{Content}}} expand to {{{Content}}}
- Adding book reference template, which will be the thing that renders a book Alec (talk) 21:16, 30 July 2016 (UTC)
- The example page is functional. All I need now is a versioning system that'll make obsolete changes known! Alec (talk) 21:45, 30 July 2016 (UTC)