Difference between revisions of "Template:Ansreq"
(23 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | <noinclude | + | <noinclude> |
This template is used to create the header and the answerbox of a requirement. The answerbox needs to be closed by using the [[Template:CloseReq|CloseReq]]-Template.<br> | This template is used to create the header and the answerbox of a requirement. The answerbox needs to be closed by using the [[Template:CloseReq|CloseReq]]-Template.<br> | ||
For example like that:<br> | For example like that:<br> | ||
Line 7: | Line 7: | ||
:<nowiki>{{CloseReq}}</nowiki> | :<nowiki>{{CloseReq}}</nowiki> | ||
</div> | </div> | ||
− | The <nowiki><nowiki /></nowiki> | + | The <nowiki><nowiki /></nowiki> tag is needed so there is no unnecessary line break at the begining of the answer. |
For the Example the <nowiki>{{PAGENAME}}</nowiki> was replaced with a fixed name, but at an honor page the template will get the needed information out of the pagename. | For the Example the <nowiki>{{PAGENAME}}</nowiki> was replaced with a fixed name, but at an honor page the template will get the needed information out of the pagename. | ||
+ | |||
+ | If the page argument contains the word "Requirement" then the requirements are fetched directly from that page. If it doesn't, then we construct the requirements page by extracting the first two elements of the page (assumed to be "AY Honors/''honor''") and appending "/Requirements" to it. We need this to support variant requirements, as it allows us to specify | ||
+ | <pre>page=AY Honors/''honor''/Requirements_2</pre> | ||
+ | in the honor landing template. | ||
+ | |||
{{Ansreq|num=1|page=AY Honors/Aboriginal Lore}}<nowiki /> | {{Ansreq|num=1|page=AY Honors/Aboriginal Lore}}<nowiki /> | ||
This is the example answer. Any MediaWiki-Content is possible (Tables, Templates, ...). | This is the example answer. Any MediaWiki-Content is possible (Tables, Templates, ...). | ||
− | {{CloseReq}}</noinclude> | + | {{CloseReq}} |
− | <includeonly>< | + | </noinclude><includeonly><div class="req-container"><div class="req-head"><p class="req-num"> |
− | + | {{#if:{{#pos:{{{page|}}} | |
− | + | |Requirements}} | |
− | + | |{{#vardefine:reqpage|{{{page}}}}} | |
− | + | |{{#vardefine:reqpage|{{#titleparts:{{{page}}}|2|1}}/Requirements}} | |
− | + | }}{{{dispreq|{{{num}}}}}}</p><div class="req-text">{{#lst:{{#var:reqpage}}{{GetLangSuffix}}|req{{{num}}} }}</div></div></div><div class="req-answer"></includeonly> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | </ | ||
− | </ | ||
− | </ | ||
− | |||
− | <div class=" | ||
− | |||
<noinclude>[[Category:Requirements Template]]</noinclude> | <noinclude>[[Category:Requirements Template]]</noinclude> |
Latest revision as of 03:48, 15 July 2021
This template is used to create the header and the answerbox of a requirement. The answerbox needs to be closed by using the CloseReq-Template.
For example like that:
- {{Ansreq|num=1|page={{PAGENAME}}}}<nowiki />
- Here you can write your answer. Any MediaWiki-Content is possible.
- {{CloseReq}}
The <nowiki /> tag is needed so there is no unnecessary line break at the begining of the answer. For the Example the {{PAGENAME}} was replaced with a fixed name, but at an honor page the template will get the needed information out of the pagename.
If the page argument contains the word "Requirement" then the requirements are fetched directly from that page. If it doesn't, then we construct the requirements page by extracting the first two elements of the page (assumed to be "AY Honors/honor") and appending "/Requirements" to it. We need this to support variant requirements, as it allows us to specify
page=AY Honors/''honor''/Requirements_2
in the honor landing template.
1
This is the example answer. Any MediaWiki-Content is possible (Tables, Templates, ...).