Difference between revisions of "Template:Q"
(→Continuation of question to another column) |
|||
(16 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
<code>q</code> - stands for '''Question'''<br> | <code>q</code> - stands for '''Question'''<br> | ||
This template is recommended to be used whenever a literature question is needed. | This template is recommended to be used whenever a literature question is needed. | ||
+ | In order to have the possibility to differentiate between multiple paragraphs with the same number, an "id" variable can be introduced as shown in the bellow examples. Note that the same id must be used also for the linked paragraph in order the jump from paragraph to question (and vice verse) to function properly. | ||
== Parameters == | == Parameters == | ||
<code>first</code> - number of the question.<br> | <code>first</code> - number of the question.<br> | ||
<code>second</code> - the actual text of the question.<br> | <code>second</code> - the actual text of the question.<br> | ||
+ | <code>third</code> - optional option. | ||
+ | === Options === | ||
+ | <code>r</code> - reverse. Puts number of question at the end of the question. | ||
= One question - one paragraph = | = One question - one paragraph = | ||
− | + | <code><nowiki>{{q|25|Isn't this nice?}}</nowiki></code><br> | |
− | <code><nowiki>{{q|25|Isn't this nice?}}</nowiki></code> | ||
− | |||
It will automatically link the question to the 25 paragraph. | It will automatically link the question to the 25 paragraph. | ||
+ | == Tests == | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Code !! Expected !! Actual | ||
+ | |- | ||
+ | | <code><nowiki>{{q|1|Isn't this nice?}}</nowiki></code> || <div id="question1">[[#paragraph1|1 Isn't this nice?]]</div> | ||
+ | || {{q|1|Isn't this nice?}} | ||
+ | |- | ||
+ | | <code><nowiki>{{q|1|id=something|Isn't this nice?}}</nowiki></code> || <div id="question1">[[#paragraph1|1 Isn't this nice?]]</div> | ||
+ | || {{q|1|id=something|Isn't this nice?}} | ||
+ | |- | ||
+ | | <code><nowiki>{{q|25|Isn't this nice?}}</nowiki></code> || <div id="question25">[[#paragraph25|25 Isn't this nice?]]</div> | ||
+ | || {{q|25|Isn't this nice?}} | ||
+ | |- | ||
+ | | <code><nowiki>{{q|105|Isn't this nice?}}</nowiki></code> || <div id="question105">[[#paragraph105|105 Isn't this nice?]]</div> | ||
+ | || {{q|105|Isn't this nice?}} | ||
+ | |} | ||
+ | === Reverse option === | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Code !! Expected !! Actual | ||
+ | |- | ||
+ | | <code><nowiki>{{q|1|Isn't this nice?|r}}</nowiki></code> || <div id="question1">[[#paragraph1|Isn't this nice? 1]]</div> | ||
+ | || {{q|1|Isn't this nice?|r}} | ||
+ | |} | ||
+ | |||
= One question - multiple paragraphs = | = One question - multiple paragraphs = | ||
− | + | <code><nowiki>{{q|25-27|Isn't this nice?}}</nowiki></code><br> | |
− | + | It will automatically link the question to the 25 paragraph. | |
− | = Tests = | + | == Tests == |
− | == | + | {| class="wikitable" |
− | + | |- | |
− | <code><nowiki>{{q| | + | ! Code !! Expected !! Actual |
+ | |- | ||
+ | | <code><nowiki>{{q|7-9|Isn't this nice?}}</nowiki></code> || <div id="question7-9">[[#paragraph7|7-9 Isn't this nice?]]</div> || {{q|7-9|Isn't this nice?}} | ||
+ | |- | ||
+ | | <code><nowiki>{{q|7-9|id=something|Isn't this nice?}}</nowiki></code> || <div id="question7-9">[[#paragraph7|7-9 Isn't this nice?]]</div> || {{q|7-9|id=something|Isn't this nice?}} | ||
+ | |- | ||
+ | | <code><nowiki>{{q|7-10|Isn't this nice?}}</nowiki></code> || <div id="question7-10">[[#paragraph7|7-10 Isn't this nice?]]</div> | ||
+ | || {{q|7-10|Isn't this nice?}} | ||
− | + | |- | |
− | <div id=" | + | | <code><nowiki>{{q|10-12|Isn't this nice?}}</nowiki></code> || <div id="question10-12">[[#paragraph10|10-12 Isn't this nice?]]</div> |
− | [[# | + | || {{q|10-12|Isn't this nice?}} |
− | </div | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | |- | |
− | <div id=" | + | | <code><nowiki>{{q|99-101|Isn't this nice?}}</nowiki></code> || <div id="question99-101">[[#paragraph99|99-101 Isn't this nice?]]</div> |
− | [[# | + | || {{q|99-101|Isn't this nice?}} |
− | </div | ||
− | |||
− | {{q| | ||
− | |||
− | + | |- | |
+ | | <code><nowiki>{{q|101-105|Isn't this nice?}}</nowiki></code> || <div id="question101-105">[[#paragraph101|101-105 Isn't this nice?]]</div> | ||
+ | || {{q|101-105|Isn't this nice?}} | ||
+ | |} | ||
+ | === Reverse option === | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Code !! Expected !! Actual | ||
+ | |- | ||
+ | | <code><nowiki>{{q|7-9|Isn't this nice?|r}}</nowiki></code> || <div id="question7-9">[[#paragraph7|Isn't this nice? 7-9]]</div> || {{q|7-9|Isn't this nice?|r}} | ||
+ | |} | ||
+ | = Continuation of question to another column = | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Code !! Expected !! Actual | ||
+ | |- | ||
+ | | <code><nowiki>{{q|1|c|Isn't this nice?}}</nowiki></code> || <div id="question1">[[#paragraph1|Isn't this nice?]]</div> | ||
+ | || {{q|1|c|Isn't this nice?}} | ||
+ | |} | ||
</noinclude> | </noinclude> | ||
− | <includeonly> | + | <includeonly>{{#ifeq:{{{id|}}}|{{{id}}}|{{#ifeq:{{{2|}}}|c|<div id="question{{{1}}}{{{id}}}" style="text-align:justify">[[#paragraph{{#invoke:stringHelpers|getParagraphFromQuestion|{{{1}}}}}{{{id}}}|{{{3}}}]]</div>|{{#ifeq:{{{3|}}}|r|<div id="question{{{1}}}{{{id}}}" style="text-align:justify">[[#paragraph{{#invoke:stringHelpers|getParagraphFromQuestion|{{{1}}}}}{{{id}}}|{{{2}}} {{{1}}}]]</div>|<div id="question{{{1}}}{{{id}}}" style="text-align:justify">[[#paragraph{{#invoke:stringHelpers|getParagraphFromQuestion|{{{1}}}}}{{{id}}}|{{{1}}} {{{2}}}]]</div>}}}}|{{#ifeq:{{{2|}}}|c|<div id="question{{{1}}}" style="text-align:justify">[[#paragraph{{#invoke:stringHelpers|getParagraphFromQuestion|{{{1}}}}}|{{{3}}}]]</div>|{{#ifeq:{{{3|}}}|r|<div id="question{{{1}}}" style="text-align:justify">[[#paragraph{{#invoke:stringHelpers|getParagraphFromQuestion|{{{1}}}}}|{{{2}}} {{{1}}}]]</div>|<div id="question{{{1}}}" style="text-align:justify">[[#paragraph{{#invoke:stringHelpers|getParagraphFromQuestion|{{{1}}}}}|{{{1}}} {{{2}}}]]</div>}}}}}}</includeonly> |
− | <div id="question{{{1}}}"> | ||
− | [[#paragraph{{{1}}}|{{{1}}} {{{2}}}]] | ||
− | </div> | ||
− | </includeonly> |
Latest revision as of 11:13, 26 February 2021
q
- stands for Question
This template is recommended to be used whenever a literature question is needed.
In order to have the possibility to differentiate between multiple paragraphs with the same number, an "id" variable can be introduced as shown in the bellow examples. Note that the same id must be used also for the linked paragraph in order the jump from paragraph to question (and vice verse) to function properly.
Contents
Parameters
first
- number of the question.
second
- the actual text of the question.
third
- optional option.
Options
r
- reverse. Puts number of question at the end of the question.
One question - one paragraph
{{q|25|Isn't this nice?}}
It will automatically link the question to the 25 paragraph.
Tests
Code | Expected | Actual |
---|---|---|
{{q|1|Isn't this nice?}} |
||
{{q|1|id=something|Isn't this nice?}} |
||
{{q|25|Isn't this nice?}} |
||
{{q|105|Isn't this nice?}} |
Reverse option
Code | Expected | Actual |
---|---|---|
{{q|1|Isn't this nice?|r}} |
One question - multiple paragraphs
{{q|25-27|Isn't this nice?}}
It will automatically link the question to the 25 paragraph.
Tests
Code | Expected | Actual |
---|---|---|
{{q|7-9|Isn't this nice?}} |
||
{{q|7-9|id=something|Isn't this nice?}} |
||
{{q|7-10|Isn't this nice?}} |
||
{{q|10-12|Isn't this nice?}} |
||
{{q|99-101|Isn't this nice?}} |
||
{{q|101-105|Isn't this nice?}} |
Reverse option
Code | Expected | Actual |
---|---|---|
{{q|7-9|Isn't this nice?|r}} |
Continuation of question to another column
Code | Expected | Actual |
---|---|---|
{{q|1|c|Isn't this nice?}} |