Template:PAGENAMEBASE: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(A trimmed-down version of Template:Italic title) |
m (10 revisions imported from wikipedia:Template:PAGENAMEBASE) |
||
(9 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{{{{|safesubst:}}}#Invoke:String|replace|{{{1|{{{{{|safesubst:}}}PAGENAME}}}}}|%s+%b()$||1|false}}<noinclude> |
|||
{{ |
|||
#switch: |
|||
{{#ifexpr: {{str find|{{PAGENAME}}|(}} != -1 |
|||
| 1 |
|||
| 0 |
|||
}}{{str ≤ len | {{PAGENAME}} | 49 |
|||
<!-- The max {{str find}} can handle is 50 --> |
|||
| 1 |
|||
| 0 }}<!-- |
|||
-->| 10 = {{PAGENAME}}<!-- |
|||
-->| 11 = {{ |
|||
''{{str left| {{PAGENAME}} | {{#expr:{{str find|{{PAGENAME}}|(}}-2}} }}'' {{str sub| {{PAGENAME}} | {{#expr: {{str find|{{PAGENAME}}|(}} - 1}} | {{#expr: {{str len|{{PAGENAME}}}} - {{str find|{{PAGENAME}}|(}} }} + 1 }}<!-- |
|||
-->| 01 = ''{{PAGENAME}}''<!-- |
|||
-->| 00 = {{FULLPAGENAME}}<!-- |
|||
-->}}<noinclude> |
|||
{{documentation}} |
{{documentation}} |
||
<!-- Add categories and interwikis to the /doc subpage, not here! --> |
|||
</noinclude> |
</noinclude> |
Latest revision as of 22:20, February 11, 2022
PAGENAMEBASE
This template is used on 725,000+ pages, or roughly 13411% of all pages. To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This template uses Lua: |
Usage
This template returns the current {{PAGENAME}}
minus (text in parentheses) or the final set of parentheses where more than one set exist.
e.g. {{PAGENAMEBASE}}
on page Chiton (genus) returns Chiton
- on Sweet Dreams (Are Made of This) (album) returns Sweet Dreams (Are Made of This)
- on Sweet Dreams (Are Made of This) returns Sweet Dreams
- on Stadion der Freundschaft (Frankfurt (Oder)) returns Stadion der Freundschaft
Can also pass an optional page parameter:
{{PAGENAMEBASE|foo (bar)}}
→ "foo"{{PAGENAMEBASE|foo bar}}
→ "foo bar"
It is not to be confused with {{BASEPAGENAME}}
, which is a magic word that strips subpages, not parentheses.