Difference between revisions of "Template:PrintFirstParagraph"
Jump to navigation
Jump to search
(2 intermediate revisions by the same user not shown) | |||
Line 15: | Line 15: | ||
-->{{#vardefine: varPos|{{#pos_e: {{#var: varTextShort}}|\n}}|}}<!-- | -->{{#vardefine: varPos|{{#pos_e: {{#var: varTextShort}}|\n}}|}}<!-- | ||
--><!-- | --><!-- | ||
− | -->{{#if:{{#var: varPos}}<!-- | + | -->{{#if: {{#var: varPos}}<!-- |
-->|<!-- if there are two or more paragraphs | -->|<!-- if there are two or more paragraphs | ||
− | -->{{#explode_e:{{#var:varTextShort}}|\n|0}}<!-- | + | -->{{#explode_e: {{#var: varTextShort}}|\n|0}}<!-- |
-->|<!-- if there is one paragraph or less | -->|<!-- if there is one paragraph or less | ||
-->{{#vardefine: varLen|{{#len: {{#var: varTextShort}} }}|}}<!-- | -->{{#vardefine: varLen|{{#len: {{#var: varTextShort}} }}|}}<!-- |
Latest revision as of 17:46, 31 May 2020
This template is used to extract the first paragraph from a given text. If the first paragraph of the text is longer than 1000 characters, only the first 997 characters are returned, and an ellipsis (…) is added.
NOTE: As any "printing" template, it doesn't store any values anywhere, but merely returns them.
Parameters:
|vartext=
- the text to extract the first paragraph from.