User:Aron Manning/Template editor
Pretty-printing templates
editOriginal en:Template:Quote
edit<templatestyles src="Template:Quote/styles.css"/><!--
--><blockquote class="templatequote" {{#if:{{{style|}}}|style="{{{style}}}"}}>{{trim quotes|{{{text|{{{content|{{{quotetext|{{{quote|{{{1|<includeonly>{{error|Error: No text given for quotation (or equals sign used in the actual argument to an unnamed parameter)}}[[Category:Pages incorrectly using the quote template]]</includeonly><noinclude>{{lorem ipsum}}</noinclude>}}}}}}}}}}}}}}}}}{{#if:{{{sign|}}}{{{cite|}}}{{{author|}}}{{{by|}}}{{{personquoted|}}}{{{source|}}}{{{ts|}}}{{{title|}}}{{{publication|}}}{{{quotesource|}}}{{{2|}}}{{{3|}}}{{{4|}}}{{{char|}}}{{{character|}}}|{{#if:{{{multiline|}}}|<nowiki />}}
<div class="templatequotecite">— <cite>{{#if:{{{char|{{{character|}}}}}}|{{{char|{{{character|}}}}}}, in }}{{Comma separated entries
| {{if empty|{{{sign|}}}|{{{cite|}}}|{{{author|}}}|{{{by|}}}|{{{personquoted|}}}|{{{2|}}}}}
| {{if empty|{{{title|}}}|{{{publication|}}}|{{{ts|}}}|{{{quotesource|}}}|{{{3|}}}}}
| {{if empty|{{{source|}}}|{{{4|}}}}}
}}</cite></div>
}}
</blockquote>{{#if:{{{class|}}}{{{id|}}}{{{diff|}}}{{{4|}}}{{{5|}}}|[[Category:Pages incorrectly using the quote template]]}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using quote template with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Quote]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | 3 | 4 | 5 | author | by | char | character | cite | class | content | diff | id | multiline | personquoted | publication | quote | quotesource | quotetext | sign | source | style | text | title | ts }}<noinclude>
{{documentation}}<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
Pretty-printed Template:Quote
edit<templatestyles src="Template:Quote/styles.css"/>
<blockquote class="templatequote" ❮#if: ‹$style|› | style="‹$style›"❯ >
❮trim quotes| «@text| «@content| «@quotetext| «@quote| «@1|
<includeonly>❮error|Error: No text given for quotation (or equals sign used in the actual argument to an unnamed parameter)❯[[Category:Pages incorrectly using the quote template]]</includeonly>
<noinclude>❮lorem ipsum❯</noinclude>
» » » » » »
❮#if: ‹$sign|› ‹$cite|› ‹$author|› ‹$by|› ‹$personquoted|› ‹$source|› ‹$ts|› ‹$title|› ‹$publication|› ‹$quotesource|› ‹$2|› ‹$3|› ‹$4|› ‹$char|› ‹$character|› |
❮#if: ‹$multiline|› | <nowiki /> ❯
<div class="templatequotecite"> —  <cite>
❮#if: «@char|‹$character|›» | «@char|‹$character|›», in ❯ ❮Comma separated entries
| ❮if empty| ‹$sign|› | ‹$cite|› | ‹$author|› | ‹$by|› | ‹$personquoted|› | ‹$2|› ❯
| ❮if empty| ‹$title|› | ‹$publication|› | ‹$ts|› | ‹$quotesource|› | ‹$3|› ❯
| ❮if empty| ‹$source|› | ‹$4|› ❯
❯
</cite></div>
❯
</blockquote>
❮#if: ‹$class|› ‹$id|› ‹$diff|› ‹$4|› ‹$5|› | [[Category:Pages incorrectly using the quote template]] ❯
❮#invoke:Check for unknown parameters |check
|unknown= ❮main other | [[Category:Pages using quote template with unknown parameters|_VALUE_❮PAGENAME❯]]❯
|preview= Page using [[Template:Quote]] with unknown parameter "_VALUE_"
|ignoreblank=y | 1 | 2 | 3 | 4 | 5 | author | by | char | character | cite | class | content | diff | id | multiline | personquoted | publication | quote | quotesource | quotetext | sign | source | style | text | title | ts
❯
<noinclude>
❮documentation❯<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
Method
editRegex replacements:
"{{{([^|]*?\|)}}}" -> "‹$\1›" "{{{([^|]*?)}}}" -> "‹$\1›" "{{{([^{]*?)}}}" -> "«@\1»" "{{([^{]*?)}}" -> "❮\1❯"
Then adding line-breaks and indentation.