Difference between revisions of "Template:Q"

From Data JW United
Jump to navigation Jump to search
Line 79: Line 79:
  
 
</noinclude>
 
</noinclude>
<includeonly>{{#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>
+
<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>

Revision as of 09:56, 27 November 2020

q - stands for Question
This template is recommended to be used whenever a literature question is needed.

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?}} {{#ifeq:|{{{id}}}|
[[#paragraph1{{{id}}}|1 Isn't this nice?]]
|
{{q|25|Isn't this nice?}} {{#ifeq:|{{{id}}}|
[[#paragraph25{{{id}}}|25 Isn't this nice?]]
|
{{q|105|Isn't this nice?}} {{#ifeq:|{{{id}}}|
[[#paragraph105{{{id}}}|105 Isn't this nice?]]
|

Reverse option

Code Expected Actual
{{q|1|Isn't this nice?|r}} {{#ifeq:|{{{id}}}|
[[#paragraph1{{{id}}}|Isn't this nice? 1]]
|

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?}} {{#ifeq:|{{{id}}}|
[[#paragraph7{{{id}}}|7-9 Isn't this nice?]]
|
{{q|7-10|Isn't this nice?}} {{#ifeq:|{{{id}}}|
[[#paragraph7{{{id}}}|7-10 Isn't this nice?]]
|
{{q|10-12|Isn't this nice?}} {{#ifeq:|{{{id}}}|
[[#paragraph10{{{id}}}|10-12 Isn't this nice?]]
|
{{q|99-101|Isn't this nice?}} {{#ifeq:|{{{id}}}|
[[#paragraph99{{{id}}}|99-101 Isn't this nice?]]
|
{{q|101-105|Isn't this nice?}} {{#ifeq:|{{{id}}}|
[[#paragraph101{{{id}}}|101-105 Isn't this nice?]]
|

Reverse option

Code Expected Actual
{{q|7-9|Isn't this nice?|r}} {{#ifeq:|{{{id}}}|
[[#paragraph7{{{id}}}|Isn't this nice? 7-9]]
|

Continuation of question to another column

Code Expected Actual
{{q|1||c|Isn't this nice?}} {{#ifeq:|{{{id}}}|
[[#paragraph1{{{id}}}|Isn't this nice?]]
|