Difference between revisions of "Template:Q"

From Data JW United
Jump to navigation Jump to search
Line 10: Line 10:
 
<code><nowiki>{{q|25|Isn't this nice?}}</nowiki></code><br>
 
<code><nowiki>{{q|25|Isn't this nice?}}</nowiki></code><br>
 
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|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?}}
 +
|}
 
= One question - multiple paragraphs =
 
= One question - multiple paragraphs =
 
<code><nowiki>{{q|25-27|Isn't this nice?}}</nowiki></code><br>
 
<code><nowiki>{{q|25-27|Isn't this nice?}}</nowiki></code><br>
 
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|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?}}
  
= Tests =
+
|-
== One question - one paragraph ==
+
| <code><nowiki>{{q|7-10|Isn't this nice?}}</nowiki></code> || <div id="question7-10">[[#paragraph7|7-10 Isn't this nice?]]</div>
Code:<br>
+
|| {{q|7-10|Isn't this nice?}}
<code><nowiki>{{q|25|Isn't this nice?}}</nowiki></code>
 
  
Expected:
+
|-
<div id="question25">
+
| <code><nowiki>{{q|10-12|Isn't this nice?}}</nowiki></code> || <div id="question10-12">[[#paragraph10|10-12 Isn't this nice?]]</div>
[[#paragraph25|25 Isn't this nice?]]</div>
+
|| {{q|10-12|Isn't this nice?}}
Actual:
 
{{q|25|Isn't this nice?}}
 
== One question - multiple paragraphs ==
 
=== Number of first paragraph of one digit ===
 
Code:<br>
 
<code><nowiki>{{q|7-10|Isn't this nice?}}</nowiki></code>
 
  
Expected:
+
|-
<div id="question7-10">[[#paragraph7|7-10 Isn't this nice?]]</div>
+
| <code><nowiki>{{q|99-101|Isn't this nice?}}</nowiki></code> || <div id="question99-101">[[#paragraph99|99-101 Isn't this nice?]]</div>
Actual:
+
|| {{q|99-101|Isn't this nice?}}
{{q|7-10|Isn't this nice?}}
+
 
</noinclude><includeonly><div id="question{{{1}}}">[[#paragraph{{#invoke:stringHelpers|getParagraphFromQuestion|{{{1}}} }}|{{{1}}} {{{2}}}]]</div></includeonly>
+
|-
 +
| <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?}}
 +
|}
 +
</noinclude><includeonly><div id="question{{{1}}}">[[#paragraph{{#invoke:stringHelpers|getParagraphFromQuestion|{{{1}}}}}|{{{1}}} {{{2}}}]]</div></includeonly>

Revision as of 03:57, 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?}}

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?}}