Jump to content

Template:SB-page: Difference between revisions

+ability to pass v:p and page range
(Created page with "<noinclude> {{Style P-No indent|This template provides the link to the page in "H. P. Blavatsky's Scrapbooks".}} '''To copy''': <pre>{{SB-page|v=|p=|text=}}</pre>...")
 
(+ability to pass v:p and page range)
Line 1: Line 1:
<noinclude> {{Style P-No indent|This template provides the link to the page in "[[HPB-SB|H. P. Blavatsky's Scrapbooks]]".}}
<noinclude> {{Style P-No indent|This template provides the link to the page in "[[HPB-SB|H. P. Blavatsky's Scrapbooks]]".}}


'''To copy''':
'''To copy''':
<pre>{{SB-page|v=|p=|text=}}</pre>
<pre>
{{SB-page|}}
{{SB-page||text=}}
{{SB-page|v=|p=}}
{{SB-page|v=|p=|text=}}
</pre>
 
* '''unnamed parameter''' should be in format: '''Volume:Page''' or '''Volume:FirstPage-LastPage'''
* If parameter '''text''' omitted then shown text will be created as such: '''SB 3:192'''.
 


If parameter '''text''' omitted then shown text will be created as such: '''SB 3:192'''.
'''Examples''':
{| class="wikitable" style="margin: 2em auto; border-spacing: 1em 0;"
|-
! Wiki text
! Result
|-
| <nowiki>{{SB-page|3:258-61}}</nowiki>
| '''{{SB-page|3:258-61}}'''
|-
| <nowiki>{{SB-page|3:258-61|text=SB, vol.3, pp.258-61}}</nowiki>
| '''{{SB-page|3:258-61|text=SB, vol. 3, pp. 258-61}}'''
|-
| <nowiki>{{SB-page|v=7|p=15}}</nowiki>
| '''{{SB-page|v=7|p=15}}'''
|-
| <nowiki>{{SB-page|v=7|p=15|text=on page 15 of seventh volume}}</nowiki>
| '''{{SB-page|v=7|p=15|text=on page 15 of seventh volume}}'''
|-
| <nowiki>{{SB-page|5:45-7|v=7|p=22}}</nowiki>
| '''{{SB-page|5:45-7|v=7|p=22}}'''
{{Style P-No indent|(unnamed parameter has higher priority)}}
|}


[[Category:Templates for SD]]
[[Category:Templates for SD]]
[[Category:Templates for references]]
[[Category:Templates for references]]
</noinclude><includeonly>{{#if: {{{text|}}}
</noinclude><includeonly>{{#vardefine:volume|{{{v|}}}}}{{#vardefine:pages|{{{p|}}}}}<!--
|[[HPB-SB-{{{v|}}}-{{{p|}}}|{{{text}}}]]
  redefine variables if unnamed parameter is not empty; split string '3:258-61'
|[[HPB-SB-{{{v|}}}-{{{p|}}}|SB {{{v|}}}:{{{p|}}}]]
-->{{#if: {{{1|}}}|{{#vardefine:volume|{{#explode:{{{1}}}|:|0}}}}{{#vardefine:pages|{{#explode:{{{1}}}|:|1}}}}|}}<!--
}}</includeonly>
  take only first page for the link (in case if passed a range: 258-61)
-->{{#vardefine:page|{{#explode:{{#var:pages}}|-|0}}}}<!--
  define text to display: either the one that passed, or SB v:p
-->{{#if: {{{text|}}}|{{#vardefine:text|{{{text}}}}}|{{#vardefine:text|SB {{#var:volume}}:{{#var:pages}}}}}}<!--
  final output
-->[[HPB-SB-{{#var:volume}}-{{#var:page}}|{{#var:text}}]]</includeonly>