Difference between revisions of "Template:P"

From Data JW United
Jump to navigation Jump to search
Line 8: Line 8:
 
<code>second</code> - the actual text of the paragraph<br>
 
<code>second</code> - the actual text of the paragraph<br>
 
== Usage ==
 
== Usage ==
<code><nowiki>{{p|7|This is the actual paragraph text.}}</nowiki></code>
+
<code><nowiki>{{p|7|This is the actual paragraph text.}}</nowiki></code><br>
=== Example action ===
 
 
It will automatically link paragraph 7 to a question that links itself only paragraph 7.
 
It will automatically link paragraph 7 to a question that links itself only paragraph 7.
 +
== Tests ==
 +
{| class="wikitable"
 +
|-
 +
! Code !! Expected !! Actual
 +
|-
 +
| <code><nowiki>{{p|7|This is the actual paragraph text.}}</nowiki></code> || <div style="text-align:justify;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[[#question7|<sup id="paragraph7">7</sup>]] This is the actual paragraph text.</div> || {{p|7|This is the actual paragraph text.}}
 +
|}
  
 
= Paragraph points to a complex question =
 
= Paragraph points to a complex question =
Line 18: Line 24:
 
<code>third</code> - the actual text of the paragraph<br>
 
<code>third</code> - the actual text of the paragraph<br>
 
== Usage ==
 
== Usage ==
<code><nowiki>{{p|7|7-8|This is the actual paragraph text.}}</nowiki></code>
+
<code><nowiki>{{p|7|7-8|This is the actual paragraph text.}}</nowiki></code><br>
=== Example action ===
 
 
It will automatically link paragraph 7 to a question that links itself to paragraphs 7 and 8.
 
It will automatically link paragraph 7 to a question that links itself to paragraphs 7 and 8.
 
+
== Tests ==
= Tests =
+
{| class="wikitable"
== Paragraph points to a simple question ==
+
|-
Code:<br>
+
! Code !! Expected !! Actual
<code><nowiki>{{p|7|This is the actual paragraph text.}}</nowiki></code>
+
|-
 
+
| <code><nowiki>{{p|7|7-8|This is the actual paragraph text.}}</nowiki></code>
Expected:
+
|| <div style="text-align:justify;">[[#question7-8|<sup id="paragraph7">7</sup>]] This is the actual paragraph text.</div> || {{p|7|7-8|This is the actual paragraph text.}}
<div style="text-align:justify;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[[#question7|<sup id="paragraph7">7</sup>]] This is the actual paragraph text.</div>
+
|}
Actual:
 
{{p|7|This is the actual paragraph text.}}<br>
 
 
 
== Paragraph points to a complex question ==
 
Code:<br>
 
<code><nowiki>{{p|7|7-8|This is the actual paragraph text.}}
 
</nowiki></code>
 
 
 
Expected:
 
<div style="text-align:justify;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[[#question7-8|<sup id="paragraph7">7</sup>]] This is the actual paragraph text.</div>
 
Actual:
 
{{p|7|7-8|This is the actual paragraph text.}}
 
 
 
 
</noinclude>
 
</noinclude>
<includeonly>{{#if: {{{3|}}}|<div style="text-align:justify;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[[#question{{{2}}}|<sup id="paragraph{{{1}}}">{{{1}}}</sup>]] {{{3}}}</div>|<div style="text-align:justify;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[[#question{{{1}}}|<sup id="paragraph{{{1}}}">{{{1}}}</sup>]] {{{2}}}</div>}}</includeonly>
+
<includeonly>
 +
{{#if: {{{3|}}}|<div style="text-align:justify;text-indent: 40px;">[[#question{{{2}}}|<sup id="paragraph{{{1}}}">{{{1}}}</sup>]] {{{3}}}</div>|<div style="text-align:justify;text-indent: 40px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[[#question{{{1}}}|<sup id="paragraph{{{1}}}">{{{1}}}</sup>]] {{{2}}}</div>}}</includeonly>

Revision as of 05:02, 15 April 2020

p - stands for Paragraph
This template is recommended to be used whenever a literature paragraph is needed.

Paragraph points to a simple question

Parameters

first - number of the paragraph
second - the actual text of the paragraph

Usage

{{p|7|This is the actual paragraph text.}}
It will automatically link paragraph 7 to a question that links itself only paragraph 7.

Tests

Code Expected Actual
{{p|7|This is the actual paragraph text.}}
        7 This is the actual paragraph text.
        7 This is the actual paragraph text.

Paragraph points to a complex question

Parameters

first - number of the paragraph
second - number of paragraphs related to the question that is linked to this paragraph. An example would be 7-8 or 10-13
third - the actual text of the paragraph

Usage

{{p|7|7-8|This is the actual paragraph text.}}
It will automatically link paragraph 7 to a question that links itself to paragraphs 7 and 8.

Tests

Code Expected Actual
{{p|7|7-8|This is the actual paragraph text.}}
7 This is the actual paragraph text.
7 This is the actual paragraph text.