Template:R/ref: Difference between revisions

From Vigyanwiki
< Template:R
Template>Matthiaspaul
(updated from sandbox, optimized logic, allow for combinations of singular/plural page and location to be given, added support for quote-location)
m (85 revisions imported from alpha:Template:R/ref)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<includeonly><!--
<includeonly><!--
### Debug facility: ###  
### Debug facility: ###  
-->{{#if:{{{debug|}}}|DEBUG: 1="{{{1|}}}", 2="{{{2|}}}", (name="{{{name|}}}"), (group="{{{group|}}})", direction="{{{direction|}}}", pages="{{{pages|}}}", page="{{{page|}}}", location="{{{location|}}}", quote-pages="{{{quote-pages|}}}", quote-page="{{{quote-page|}}}", quote-location="{{{quote-location|}}}", quote="{{{quote|}}}", quote-language="{{{quote-language|}}}", trans-quote="{{{trans-quote|}}}", quote-cite="{{{quote-cite|}}}", reference="{{{reference|}}}", annotation="{{{annotation|}}}", leadin="{{{leadin|}}}", postscript="{{{postscript|}}}", section="{{{section|}}}", needed-reason="{{{needed-reason|}}}", needed-date="{{{needed-date|}}}", wrap="{{{wrap|}}}", no-pp="{{{no-pp|}}}", style="{{{style|}}}", content-id="{{{content-id|}}}", link-id="{{{link-id|}}}", debug="{{{debug|}}}". Potential context-section-name:"{{anchorencode:cite_sect-{{trim quotes|s={{{1|}}}}}-{{trim quotes|s={{{2|}}}}}-{{trim quotes|s={{{page|{{#invoke:String2|hyphen2dash|{{{pages|}}}}}}}}}}{{trim quotes|s={{{location|}}}}}}}".}}<!--
-->{{#if:{{{debug|}}}|DEBUG: 1="{{{1|}}}", 2="{{{2|}}}", (name="{{{name|}}}"), (group="{{{group|}}})", direction="{{{direction|}}}", pages="{{{pages|}}}", page="{{{page|}}}", location="{{{location|}}}", quote-pages="{{{quote-pages|}}}", quote-page="{{{quote-page|}}}", quote-location="{{{quote-location|}}}", quote="{{{quote|}}}", language="{{{language|}}}", translation="{{{translation|}}}", quote-cite="{{{quote-cite|}}}", reference="{{{reference|}}}", annotation="{{{annotation|}}}", leadin="{{{leadin|}}}", postscript="{{{postscript|}}}", section="{{{section|}}}", needed-reason="{{{needed-reason|}}}", needed-date="{{{needed-date|}}}", wrap="{{{wrap|}}}", no-pp="{{{no-pp|}}}", style="{{{style|}}}", content-id="{{{content-id|}}}", link-id="{{{link-id|}}}", debug="{{{debug|}}}". Potential context-section-name:"{{anchorencode:cite_sect-{{trim quotes|s={{{1|}}}}}-{{trim quotes|s={{{2|}}}}}-{{trim quotes|s={{{page|{{#invoke:String2|hyphen2dash|{{{pages|}}}}}}}}}}{{trim quotes|s={{{location|}}}}}}}".}}<!--
### Opening "support context" span: ###
### Opening "support context" span: ###
-->{{#if:{{{section|}}}|{{#if:{{#lst:{{FULLPAGENAME}}|{{anchorencode:{{#switch:{{{section|}}}||yes|y=cite_sect-{{trim quotes|s={{{1|}}}}}-{{trim quotes|s={{{2|}}}}}-{{trim quotes|s={{{page|{{#invoke:String2|hyphen2dash|{{{pages|}}}}}}}}}}{{trim quotes|s={{{location|}}}}}|{{{section|}}}}}}}}}|<templatestyles src="Template:Tooltip/styles.css"/><span class="rt-commentedText tooltip tooltip-dotted" title="Context: &quot;<!--{{#invoke:String|replace|source={{#invoke:String|replace|source={{#invoke:String|replace|source=-->{{#invoke:DecodeEncode|encode|s={{#invoke:Plain text|main|1={{#lst:{{FULLPAGENAME}}|{{anchorencode:{{#switch:{{{section|}}}||yes|y=cite_sect-{{trim quotes|s={{{1|}}}}}-{{trim quotes|s={{{2|}}}}}-{{trim quotes|s={{{page|{{#invoke:String2|hyphen2dash|{{{pages|}}}}}}}}}}{{trim quotes|s={{{location|}}}}}|{{{section|}}}}}}}}}|encode=false}}|charset=<>"}}<!--|"|&quot;}}|<|&lt;}}|>|&gt;}}-->&quot;">}}}}<!--
-->{{#if:{{{section|}}}|{{#if:{{#lst:{{FULLPAGENAME}}|{{anchorencode:{{#switch:{{{section|}}}||yes|y=cite_sect-{{trim quotes|s={{{1|}}}}}-{{trim quotes|s={{{2|}}}}}-{{trim quotes|s={{{page|{{#invoke:String2|hyphen2dash|{{{pages|}}}}}}}}}}{{trim quotes|s={{{location|}}}}}|{{{section|}}}}}}}}}|<templatestyles src="Template:Tooltip/styles.css"/><span class="rt-commentedText tooltip tooltip-dotted" title="Context: &quot;<!--{{#invoke:String|replace|source={{#invoke:String|replace|source={{#invoke:String|replace|source=-->{{#invoke:DecodeEncode|encode|s={{#invoke:Plain text|main|1={{#lst:{{FULLPAGENAME}}|{{anchorencode:{{#switch:{{{section|}}}||yes|y=cite_sect-{{trim quotes|s={{{1|}}}}}-{{trim quotes|s={{{2|}}}}}-{{trim quotes|s={{{page|{{#invoke:String2|hyphen2dash|{{{pages|}}}}}}}}}}{{trim quotes|s={{{location|}}}}}|{{{section|}}}}}}}}}|encode=false}}|charset=<>"}}<!--|"|&quot;}}|<|&lt;}}|>|&gt;}}-->&quot;">}}}}<!--
Line 7: Line 7:
-->{{#if:{{{link-id|}}}|<span id="{{anchorencode:{{{link-id|}}}}}" class="citation<!-- wikicite cite-r -->">}}{{#if:{{{direction|}}}|{{#tag:ref|{{#if:{{{annotation|}}}||{{#if:{{{content-id|}}}|<span<!-- or <cite...> --> id="{{anchorencode:{{{content-id|}}}}}" class="citation<!-- wikicite cite-r -->">}}{{{reference|}}}{{#if:{{{content-id|}}}|</span><!-- or </cite> -->}}{{{postscript|}}}}}|name={{{1|}}}|group={{{2|}}}|dir={{{direction|}}}}}|{{#tag:ref|{{#if:{{{annotation|}}}||{{#if:{{{content-id|}}}|<span<!-- or <cite...> --> id="{{anchorencode:{{{content-id|}}}}}" class="citation<!-- wikicite cite-r -->">}}{{{reference|}}}{{#if:{{{content-id|}}}|</span><!-- or </cite> -->}}{{{postscript|}}}}}|name={{{1|}}}|group={{{2|}}}}}}}{{#if:{{{link-id|}}}|</span>}}<!--
-->{{#if:{{{link-id|}}}|<span id="{{anchorencode:{{{link-id|}}}}}" class="citation<!-- wikicite cite-r -->">}}{{#if:{{{direction|}}}|{{#tag:ref|{{#if:{{{annotation|}}}||{{#if:{{{content-id|}}}|<span<!-- or <cite...> --> id="{{anchorencode:{{{content-id|}}}}}" class="citation<!-- wikicite cite-r -->">}}{{{reference|}}}{{#if:{{{content-id|}}}|</span><!-- or </cite> -->}}{{{postscript|}}}}}|name={{{1|}}}|group={{{2|}}}|dir={{{direction|}}}}}|{{#tag:ref|{{#if:{{{annotation|}}}||{{#if:{{{content-id|}}}|<span<!-- or <cite...> --> id="{{anchorencode:{{{content-id|}}}}}" class="citation<!-- wikicite cite-r -->">}}{{{reference|}}}{{#if:{{{content-id|}}}|</span><!-- or </cite> -->}}{{{postscript|}}}}}|name={{{1|}}}|group={{{2|}}}}}}}{{#if:{{{link-id|}}}|</span>}}<!--
### Optional second call to append data to reference (variants identical except for dir): ###
### Optional second call to append data to reference (variants identical except for dir): ###
-->{{#if:{{{annotation|}}}|{{#if:{{{direction|}}}|<!---->{{#tag:ref|{{#switch:{{{annotation|}}}|pages|pp|page|p={{#if:{{{pages|}}}{{{page|}}}{{{location|}}}|&#8204;{{#if:{{{content-id|}}}|<span id="{{anchorencode:{{{content-id|}}}}}">}}{{{leadin|}}}{{R/where|plural={{#invoke:String2|hyphen2dash|{{{pages|}}}}}|singular={{{page|}}}|location={{{location|}}}|spacing=&#32;}}{{#if:{{{content-id|}}}|</span>}}}}|quote|q=&#8204;{{#switch:{{{quote-pages|{{{quote-page|{{{quote-location|}}}}}}}}}|=|pages|pp|page|p={{#if:{{{pages|}}}{{{page|}}}{{{location|}}}|{{{leadin|}}}{{R/where|plural={{#invoke:String2|hyphen2dash|{{{pages|}}}}}|singular={{{page|}}}|location={{{location|}}}|spacing=&#32;}}:&#32;}}|{{{leadin|}}}{{R/where|plural={{#invoke:String2|hyphen2dash|{{{quote-pages|}}}}}|singular={{{quote-page|}}}|location={{{quote-location|}}}|spacing=&#32;}}:&#32;}}<!----><q {{#if:{{{content-id|}}}|id="{{anchorencode:{{{content-id|}}}}}"}} {{#if:{{{quote-cite|{{{link-id|}}}}}}|cite="#{{anchorencode:{{{quote-cite|{{{link-id|}}}}}}}}"}} {{#if:{{{quote-language|}}}|lang="{{{quote-language|}}}"}}><bdi {{#if:{{{quote-language|}}}|lang="{{{quote-language|}}}"}}>{{trim quotes|s={{{quote|}}}}}</bdi></q>{{#if:{{{trans-quote|}}}|&#32;&#91;<bdi {{#if:{{{quote-language|}}}|lang="{{{quote-language|}}}"}}>{{trim quotes|s={{{trans-quote|}}}}}</bdi>&#93;}}|{{#if:{{{content-id|}}}|<span<!-- or <cite...> --> id="{{anchorencode:{{{content-id|}}}}}" class="citation<!-- wikicite cite-r -->">}}{{{leadin|}}}{{{annotation|}}}{{#if:{{{content-id|}}}|</span><!-- or </cite> -->}}}}{{{postscript|}}}|follow={{{1|}}}|group={{{2|}}}|dir={{{direction|}}}}}|<!---->{{#tag:ref|{{#switch:{{{annotation|}}}|pages|pp|page|p={{#if:{{{pages|}}}{{{page|}}}{{{location|}}}|&#8204;{{#if:{{{content-id|}}}|<span id="{{anchorencode:{{{content-id|}}}}}">}}{{{leadin|}}}{{R/where|plural={{#invoke:String2|hyphen2dash|{{{pages|}}}}}|singular={{{page|}}}|location={{{location|}}}|spacing=&#32;}}{{#if:{{{content-id|}}}|</span>}}}}|quote|q=&#8204;{{#switch:{{{quote-pages|{{{quote-page|{{{quote-location|}}}}}}}}}|=|pages|pp|page|p={{#if:{{{pages|}}}{{{page|}}}{{{location|}}}|{{{leadin|}}}{{R/where|plural={{#invoke:String2|hyphen2dash|{{{pages|}}}}}|singular={{{page|}}}|location={{{location|}}}|spacing=&#32;}}:&#32;}}|{{{leadin|}}}{{R/where|plural={{#invoke:String2|hyphen2dash|{{{quote-pages|}}}}}|singular={{{quote-page|}}}|location={{{quote-location|}}}|spacing=&#32;}}:&#32;}}<!----><q {{#if:{{{content-id|}}}|id="{{anchorencode:{{{content-id|}}}}}"}} {{#if:{{{quote-cite|{{{link-id|}}}}}}|cite="#{{anchorencode:{{{quote-cite|{{{link-id|}}}}}}}}"}} {{#if:{{{quote-language|}}}|lang="{{{quote-language|}}}"}}><bdi {{#if:{{{quote-language|}}}|lang="{{{quote-language|}}}"}}>{{trim quotes|s={{{quote|}}}}}</bdi></q>{{#if:{{{trans-quote|}}}|&#32;&#91;<bdi {{#if:{{{quote-language|}}}|lang="{{{quote-language|}}}"}}>{{trim quotes|s={{{trans-quote|}}}}}</bdi>&#93;}}|{{#if:{{{content-id|}}}|<span<!-- or <cite...> --> id="{{anchorencode:{{{content-id|}}}}}" class="citation<!-- wikicite cite-r -->">}}{{{leadin|}}}{{{annotation|}}}{{#if:{{{content-id|}}}|</span><!-- or </cite> -->}}}}{{{postscript|}}}|follow={{{1|}}}|group={{{2|}}}}}}}}}<!--
-->{{#if:{{{annotation|}}}|{{#if:{{{direction|}}}|<!---->{{#tag:ref|{{#switch:{{{annotation|}}}|pages|pp|page|p={{#if:{{{pages|}}}{{{page|}}}{{{location|}}}|&#8204;{{#if:{{{content-id|}}}|<span id="{{anchorencode:{{{content-id|}}}}}">}}{{{leadin|}}}{{R/where|plural={{#invoke:String2|hyphen2dash|{{{pages|}}}}}|singular={{{page|}}}|location={{{location|}}}|spacing=&#32;}}{{#if:{{{content-id|}}}|</span>}}}}|quote|q=&#8204;{{#switch:{{{quote-pages|{{{quote-page|{{{quote-location|}}}}}}}}}|=|pages|pp|page|p={{#if:{{{pages|}}}{{{page|}}}{{{location|}}}|{{{leadin|}}}{{R/where|plural={{#invoke:String2|hyphen2dash|{{{pages|}}}}}|singular={{{page|}}}|location={{{location|}}}|spacing=&#32;}}:&#32;}}|{{{leadin|}}}{{R/where|plural={{#invoke:String2|hyphen2dash|{{{quote-pages|}}}}}|singular={{{quote-page|}}}|location={{{quote-location|}}}|spacing=&#32;}}:&#32;}}<!----><q {{#if:{{{content-id|}}}|id="{{anchorencode:{{{content-id|}}}}}"}} {{#if:{{{quote-cite|{{{link-id|}}}}}}|cite="#{{anchorencode:{{{quote-cite|{{{link-id|}}}}}}}}"}} {{#if:{{{language|}}}|lang="{{R/langcode|{{{language|}}}}}"}}><bdi {{#if:{{{language|}}}|lang="{{R/langcode|{{{language|}}}}}"}}>{{trim quotes|s={{{quote|}}}}}</bdi></q>{{#if:{{{translation|}}}|&#32;&#91;<bdi {{#if:{{{language|}}}|lang="{{R/langcode|{{{language|}}}}}"}}>{{trim quotes|s={{{translation|}}}}}</bdi>&#93;}}|{{#if:{{{content-id|}}}|<span<!-- or <cite...> --> id="{{anchorencode:{{{content-id|}}}}}" class="citation<!-- wikicite cite-r -->">}}{{{leadin|}}}{{{annotation|}}}{{#if:{{{content-id|}}}|</span><!-- or </cite> -->}}}}{{{postscript|}}}|follow={{{1|}}}|group={{{2|}}}|dir={{{direction|}}}}}|<!---->{{#tag:ref|{{#switch:{{{annotation|}}}|pages|pp|page|p={{#if:{{{pages|}}}{{{page|}}}{{{location|}}}|&#8204;{{#if:{{{content-id|}}}|<span id="{{anchorencode:{{{content-id|}}}}}">}}{{{leadin|}}}{{R/where|plural={{#invoke:String2|hyphen2dash|{{{pages|}}}}}|singular={{{page|}}}|location={{{location|}}}|spacing=&#32;}}{{#if:{{{content-id|}}}|</span>}}}}|quote|q=&#8204;{{#switch:{{{quote-pages|{{{quote-page|{{{quote-location|}}}}}}}}}|=|pages|pp|page|p={{#if:{{{pages|}}}{{{page|}}}{{{location|}}}|{{{leadin|}}}{{R/where|plural={{#invoke:String2|hyphen2dash|{{{pages|}}}}}|singular={{{page|}}}|location={{{location|}}}|spacing=&#32;}}:&#32;}}|{{{leadin|}}}{{R/where|plural={{#invoke:String2|hyphen2dash|{{{quote-pages|}}}}}|singular={{{quote-page|}}}|location={{{quote-location|}}}|spacing=&#32;}}:&#32;}}<!----><q {{#if:{{{content-id|}}}|id="{{anchorencode:{{{content-id|}}}}}"}} {{#if:{{{quote-cite|{{{link-id|}}}}}}|cite="#{{anchorencode:{{{quote-cite|{{{link-id|}}}}}}}}"}} {{#if:{{{language|}}}|lang="{{R/langcode|{{{language|}}}}}"}}><bdi {{#if:{{{language|}}}|lang="{{R/langcode|{{{language|}}}}}"}}>{{trim quotes|s={{{quote|}}}}}</bdi></q>{{#if:{{{translation|}}}|&#32;&#91;<bdi {{#if:{{{language|}}}|lang="{{R/langcode|{{{language|}}}}}"}}>{{trim quotes|s={{{translation|}}}}}</bdi>&#93;}}|{{#if:{{{content-id|}}}|<span<!-- or <cite...> --> id="{{anchorencode:{{{content-id|}}}}}" class="citation<!-- wikicite cite-r -->">}}{{{leadin|}}}{{{annotation|}}}{{#if:{{{content-id|}}}|</span><!-- or </cite> -->}}}}{{{postscript|}}}|follow={{{1|}}}|group={{{2|}}}}}}}}}<!--
### Superscript pages and tooltip for help, pages, quotes: ###
### Superscript pages and tooltip for help, pages, quotes: ###
-->{{r/superscript
-->{{r/superscript
|prefix={{#switch:{{{style|}}}|AMA|Ama|ama=(|:&hairsp;}}
|prefix={{#switch:{{{style|}}}|AMA|Ama|ama=(|&#58;&hairsp;}}
|suffix={{#switch:{{{style|}}}|AMA|Ama|ama=)|&hairsp;}}
|suffix={{#switch:{{{style|}}}|AMA|Ama|ama=)|&hairsp;}}
|pp={{#switch:{{{style|}}}|AMA|Ama|ama={{#if:{{{no-pp|}}}||{{#if:{{{pages|}}}|pp|{{#if:{{{page|}}}|p}}}}}}}}<!-- p/pp is only used in superscript label, therefore it does not contain any qp params -->
|pp={{#switch:{{{style|}}}|AMA|Ama|ama={{#if:{{{no-pp|}}}||{{#if:{{{pages|}}}|pp|{{#if:{{{page|}}}|p}}}}}}}}<!-- p/pp is only used in superscript label, therefore it does not contain any qp params -->
Line 18: Line 18:
|quote-where={{#switch:{{{quote-pages|{{{quote-page|{{{quote-location|}}}}}}}}}|pages|pp|page|p={{R/where|plural={{#invoke:String2|hyphen2dash|{{{pages|}}}}}|singular={{{page|}}}|location={{{location|}}}|spacing=&#32;}}|{{R/where|plural={{#invoke:String2|hyphen2dash|{{{quote-pages|}}}}}|singular={{{quote-page|}}}|location={{{quote-location|}}}|spacing=&#32;}}}}<!-- quote-where must not contain normal in-source-location params -->
|quote-where={{#switch:{{{quote-pages|{{{quote-page|{{{quote-location|}}}}}}}}}|pages|pp|page|p={{R/where|plural={{#invoke:String2|hyphen2dash|{{{pages|}}}}}|singular={{{page|}}}|location={{{location|}}}|spacing=&#32;}}|{{R/where|plural={{#invoke:String2|hyphen2dash|{{{quote-pages|}}}}}|singular={{{quote-page|}}}|location={{{quote-location|}}}|spacing=&#32;}}}}<!-- quote-where must not contain normal in-source-location params -->
|quote={{{quote|}}}
|quote={{{quote|}}}
|language={{{quote-language|}}}
|language={{{language|}}}
|translation={{{trans-quote|}}}
|translation={{{translation|}}}
|wrap={{{wrap|}}}
|wrap={{{wrap|}}}
}}<!--
}}<!--

Latest revision as of 17:34, 22 December 2022

Template documentation