Difference between revisions of "Template:Q"

From Data JW United
Jump to navigation Jump to search
(Tests)
Line 29: Line 29:
 
! Code !! Expected !! Actual
 
! Code !! Expected !! Actual
 
|-
 
|-
| <code><nowiki>{{q|1|Isn't this nice?}}</nowiki></code> || <div id="question1">[[#paragraph1|Isn't this nice? 1]]</div>
+
| <code><nowiki>{{q|Isn't this nice?|r}}</nowiki></code> || <div id="question1">[[#paragraph1|Isn't this nice? 1]]</div>
  || {{q|r|1|Isn't this nice?}}
+
  || {{q|1|Isn't this nice?|r}}
 
|}
 
|}
  
Line 59: Line 59:
 
  || {{q|101-105|Isn't this nice?}}
 
  || {{q|101-105|Isn't this nice?}}
 
|}
 
|}
</noinclude><includeonly><div id="question{{{1}}}">[[#paragraph{{#invoke:stringHelpers|getParagraphFromQuestion|{{{1}}}}}|{{{1}}} {{{2}}}]]</div></includeonly>
+
=== Number at the end ===
 +
{| 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}}
 +
|}
 +
</noinclude>
 +
<includeonly>
 +
{{#ifeq:{{{3|}}}|r|
 +
<div id="question{{{1}}}">[[#paragraph{{#invoke:stringHelpers|getParagraphFromQuestion|{{{1}}}}}|{{{2}}} {{{1}}}]]</div>|
 +
<div id="question{{{1}}}">[[#paragraph{{#invoke:stringHelpers|getParagraphFromQuestion|{{{1}}}}}|{{{1}}} {{{2}}}]]</div>}}</includeonly>

Revision as of 04:38, 15 April 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.

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|25|Isn't this nice?}}
{{q|105|Isn't this nice?}}

Number at the end

Code Expected Actual
{{q|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-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?}}

Number at the end

Code Expected Actual
{{q|7-9|Isn't this nice?|r}}