Difference between revisions of "Template:P"

From Data JW United
Jump to navigation Jump to search
(Parameters)
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
 
<code>p</code> - stands for '''Paragraph'''<br>
 
<code>p</code> - stands for '''Paragraph'''<br>
This template is recommended to be used whenever a literature paragraph is needed.
+
This template is recommended to be used whenever a literature paragraph is needed.<br>
 +
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 question in order the jump from paragraph to question (and vice verse) to function properly.
  
 
= Paragraph points to a simple question =
 
= Paragraph points to a simple question =
Line 8: Line 9:
 
<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><br>
+
<code><nowiki>{{raw:data:p|7|This is the actual paragraph text.}}</nowiki></code><br>
 
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 ==
 
== Tests ==
 
{| class="wikitable"
 
{| class="wikitable"
Line 15: Line 17:
 
! Code !! Expected !! Actual
 
! Code !! Expected !! Actual
 
|-
 
|-
| <code><nowiki>{{p|7|This is the actual paragraph text.}}</nowiki></code> || <div style="text-align:justify;text-indent: 40px;">[[#question7|<sup id="paragraph7">7</sup>]] This is the actual paragraph text.</div> || {{p|7|This is the actual paragraph text.}}
+
| <code><nowiki>{{raw:data:p|7|This is the actual paragraph text.}}</nowiki></code> || <div style="text-align:justify;text-indent: 40px;">[[#question7|<sup id="paragraph7">7</sup>]] This is the actual paragraph text.</div> || {{p|7|This is the actual paragraph text.}}
 +
|-
 +
| <code><nowiki>{{raw:data:p|7|id=second|This is the actual paragraph text.}}</nowiki></code> || <div style="text-align:justify;text-indent: 40px;">[[#question7|<sup id="paragraph7">7</sup>]] This is the actual paragraph text.</div> || {{p|7|id=second|This is the actual paragraph text.}}
 
|}
 
|}
  
Line 24: Line 28:
 
<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><br>
+
<code><nowiki>{{raw:data:p|7|7-8|This is the actual paragraph text.}}</nowiki></code><br>
 
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 ==
Line 31: Line 35:
 
! Code !! Expected !! Actual
 
! Code !! Expected !! Actual
 
|-
 
|-
| <code><nowiki>{{p|7|7-8|This is the actual paragraph text.}}</nowiki></code>
+
| <code><nowiki>{{raw:data:p|7|7-8|This is the actual paragraph text.}}</nowiki></code>
 
  || <div style="text-align:justify;text-indent: 40px;">[[#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;text-indent: 40px;">[[#question7-8|<sup id="paragraph7">7</sup>]] This is the actual paragraph text.</div> || {{p|7|7-8|This is the actual paragraph text.}}
 +
|-
 +
| <code><nowiki>{{raw:data:p|7|7-8|id=second|This is the actual paragraph text.}}</nowiki></code>
 +
|| <div style="text-align:justify;text-indent: 40px;">[[#question7-8|<sup id="paragraph7">7</sup>]] This is the actual paragraph text.</div> || {{p|7|7-8|id=second|This is the actual paragraph text.}}
 
|}
 
|}
 +
 
= Paragraph with no question =
 
= Paragraph with no question =
 
== Parameters ==
 
== Parameters ==
Line 39: Line 47:
 
<code>second</code> - actual paragraph<br>
 
<code>second</code> - actual paragraph<br>
 
== Usage ==
 
== Usage ==
<code><nowiki>{{p|nq|This is the actual paragraph text.}}</nowiki></code><br>
+
<code><nowiki>{{raw:data:p|nq|This is the actual paragraph text.}}</nowiki></code><br>
 
It will create a paragraph without the indent showing the number of the question and without any link to any question.
 
It will create a paragraph without the indent showing the number of the question and without any link to any question.
 
== Tests ==
 
== Tests ==
Line 47: Line 55:
 
! Code !! Expected !! Actual
 
! Code !! Expected !! Actual
 
|-
 
|-
|<code><nowiki>{{p|nq|This is the actual paragraph text.}}</nowiki></code><br>
+
|<code><nowiki>{{raw:data:p|nq|This is the actual paragraph text.}}</nowiki></code><br>
 
  || <div style="text-align:justify;text-indent:40px;">This is the actual paragraph text.</div> || {{p|nq|This is the actual paragraph text.}}
 
  || <div style="text-align:justify;text-indent:40px;">This is the actual paragraph text.</div> || {{p|nq|This is the actual paragraph text.}}
 
|}
 
|}
Line 56: Line 64:
  
 
== Usage ==
 
== Usage ==
<code><nowiki>{{p|c|this is the continuation of the paragraph text.}}</nowiki></code><br>
+
<code><nowiki>{{raw:data:p|c|this is the continuation of the paragraph text.}}</nowiki></code><br>
 
It will create a continuation of the paragraph from the previous page. This continuation will not be indented.
 
It will create a continuation of the paragraph from the previous page. This continuation will not be indented.
 
== Tests ==
 
== Tests ==
Line 64: Line 72:
 
! Code !! Expected !! Actual
 
! Code !! Expected !! Actual
 
|-
 
|-
|<code><nowiki>{{p|c|This is the continuation of the paragraph text.}}</nowiki></code><br>
+
|<code><nowiki>{{raw:data:p|c|This is the continuation of the paragraph text.}}</nowiki></code><br>
 
  || <div style="text-align:justify;">This is the continuation of the paragraph text.</div> || {{p|c|This is the continuation of the paragraph text.}}
 
  || <div style="text-align:justify;">This is the continuation of the paragraph text.</div> || {{p|c|This is the continuation of the paragraph text.}}
 
|}
 
|}
  
</noinclude><includeonly>{{#ifeq: {{{1}}}|c|<div style="text-align:justify;">{{{2}}}</div>|{{#ifeq: {{{1}}} | nq | <div style="text-align:justify;text-indent:40px;">{{{2}}}</div> | {{#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;">[[#question{{{1}}}|<sup id="paragraph{{{1}}}">{{{1}}}</sup>]] {{{2}}}</div>}} }}|}} </includeonly>
+
</noinclude><includeonly>{{#ifeq:{{{id|}}}|{{{id}}}| {{#ifeq: {{{1}}}|c|<div style="text-align:justify;">{{{2}}}</div>|{{#ifeq: {{{1}}} | nq | <div style="text-align:justify;text-indent:40px;">{{{2}}}</div> | {{#if: {{{3|}}}|<div style="text-align:justify;text-indent:40px;">[[#question{{{2}}}{{{id}}}|<sup id="paragraph{{{1}}}">{{{1}}}</sup>]] {{{3}}}</div>|<div style="text-align:justify;text-indent:40px;">[[#question{{{1}}}{{{id}}}|<sup id="paragraph{{{1}}}">{{{1}}}</sup>]] {{{2}}}</div>}} }}|}} | {{#ifeq: {{{1}}}|c|<div style="text-align:justify;">{{{2}}}</div>|{{#ifeq: {{{1}}} | nq | <div style="text-align:justify;text-indent:40px;">{{{2}}}</div> | {{#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;">[[#question{{{1}}}|<sup id="paragraph{{{1}}}">{{{1}}}</sup>]] {{{2}}}</div>}} }}|}}}} </includeonly>

Latest revision as of 10:09, 27 November 2020

p - stands for Paragraph
This template is recommended to be used whenever a literature paragraph 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 question in order the jump from paragraph to question (and vice verse) to function properly.

Paragraph points to a simple question

Parameters

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

Usage

{{raw:data: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
{{raw:data:p|7|This is the actual paragraph text.}}
7 This is the actual paragraph text.
7 This is the actual paragraph text.
{{raw:data:p|7|id=second|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

{{raw:data: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
{{raw:data:p|7|7-8|This is the actual paragraph text.}}
7 This is the actual paragraph text.
7 This is the actual paragraph text.
{{raw:data:p|7|7-8|id=second|This is the actual paragraph text.}}
7 This is the actual paragraph text.
7 This is the actual paragraph text.

Paragraph with no question

Parameters

nq - no question
second - actual paragraph

Usage

{{raw:data:p|nq|This is the actual paragraph text.}}
It will create a paragraph without the indent showing the number of the question and without any link to any question.

Tests

Code Expected Actual
{{raw:data:p|nq|This is the actual paragraph text.}}
This is the actual paragraph text.
This is the actual paragraph text.

Continuation of a paragraph to the next page

Parameters

c - continuation
second - paragraph continuation

Usage

{{raw:data:p|c|this is the continuation of the paragraph text.}}
It will create a continuation of the paragraph from the previous page. This continuation will not be indented.

Tests

Code Expected Actual
{{raw:data:p|c|This is the continuation of the paragraph text.}}
This is the continuation of the paragraph text.
This is the continuation of the paragraph text.