Difference between revisions of "Template:Fixcaps"

From blackwiki
Jump to navigation Jump to search
imported>Wikid77
(vastly expanded to allow 8 parameters & pass wikilinks as isolated parameters, not inside other parameter text; +examples of multiple parameters & showing wikilinked text.)
imported>Wikid77
(corrected example & fixed doctext to warn "cannot split wikilinks"; +example of "Shri Shivaji Raigad Smarak Mandal".)
Line 563: Line 563:
 
::: &nbsp; {&#123;fixcaps|SHOW|<nowiki>[[wikilink]]ed</nowiki>|+TEXT.}} &rarr; <nowiki>Show [[wikilink]]ed text.</nowiki>
 
::: &nbsp; {&#123;fixcaps|SHOW|<nowiki>[[wikilink]]ed</nowiki>|+TEXT.}} &rarr; <nowiki>Show [[wikilink]]ed text.</nowiki>
 
::: &nbsp; {&#123;subst:fixcaps|"/SAVE/INSIDE/PAGE"}} &rarr; "Save&#32;Inside&#32;Page"&#32;
 
::: &nbsp; {&#123;subst:fixcaps|"/SAVE/INSIDE/PAGE"}} &rarr; "Save&#32;Inside&#32;Page"&#32;
Most words will be displayed with a capital-letter, followed by all lowercase letters, while a [[preposition]] or article (a/an/the) will be shown in lowercase letters. A leading "+" forces lowercase. A leading [[caret]] symbol ("^") will cause the text to display unchanged, so "^woRDs" would show "woRDs". Prepositions include: ''about, above, after, at, before, by, for, in, of, on, with'' and ''without''. Each word to capitalize must be preceded by a slash ("/"), but all spaces could be slashes, and prepositions would still display in lowercase letters. Only 25 slashes are allowed in each parameter, or about 40-45 words (2 lines of text), and a wikilink must be in a separate parameter, not embedded inside other text (see below: [[#Limitations|Limitations]]). A total of 8 parameters are allowed, or about 320-360 words.
+
Most words will be displayed with a capital-letter, followed by all lowercase letters, while a [[preposition]] or article (a/an/the) will be shown in lowercase letters. A leading "+" forces lowercase. A leading [[caret]] symbol ("^") will cause the text to display unchanged, so "^woRDs" would show "woRDs". Prepositions include: ''about, above, after, at, before, by, for, in, of, on, with'' and ''without''. Each word to capitalize must be preceded by a slash ("/"), but all spaces could be slashes, and prepositions would still display in lowercase letters. Only 25 slashes are allowed in each parameter, or about 40-45 words (2 lines of text) per parameter, and a [[Help:Link|wikilink]] must be in a separate parameter, not embedded inside other text (see below: [[#Limitations|Limitations]]). A total of 8 parameters are allowed, or about 320-360 words.
  
 
The resulting text, with mixed capital and lowercase letters, can be [[wp:Subst]]'ed into the page during edit SAVE, or copy-pasted back into the text, using the template as an editing gadget.
 
The resulting text, with mixed capital and lowercase letters, can be [[wp:Subst]]'ed into the page during edit SAVE, or copy-pasted back into the text, using the template as an editing gadget.
Line 578: Line 578:
  
 
A major use for the template would be in reformatting long lists of book titles entered as ALL-CAPS text, while inserting formatting codes for italics, footnotes or bolded volume numbers. Occasionally, entire sections or paragraphs of an article might contain ALL UPPERCASE TEXT, and the template can be used to more easily downcase all the improperly formatted text.
 
A major use for the template would be in reformatting long lists of book titles entered as ALL-CAPS text, while inserting formatting codes for italics, footnotes or bolded volume numbers. Occasionally, entire sections or paragraphs of an article might contain ALL UPPERCASE TEXT, and the template can be used to more easily downcase all the improperly formatted text.
:* <nowiki>{{fixcaps|THE ''/TIMES OF /INDIA'' REPORTED MANY CASES OF UNREST IN BOTH EARLY AND LATE YEARS OF THE |[[|/BRITISH /RAJ|]],|+INTO THE 20TH CENTURY. /EARLY COMPUTERS USED |[[teletype]]s|+ WHICH DISPLAYED TEXT IN/^ALL-CAPS/+UPPERCASE LETTERS, AND/+NO COMPUTER DOCUMENTS HAD LOWERCASE TEXT.}}
+
:* <nowiki>{{fixcaps|THE ''/TIMES OF /INDIA'' REPORTED MANY CASES OF UNREST IN BOTH EARLY AND LATE YEARS OF THE |[[British Raj]],|+INTO THE 20TH CENTURY. /EARLY COMPUTERS USED |[[teletype]]s|+ WHICH DISPLAYED TEXT IN/^ALL-CAPS/+UPPERCASE LETTERS, AND/+NO COMPUTER DOCUMENTS HAD LOWERCASE TEXT.}}
</nowiki> &rarr;<br>{{fixcaps|THE ''/TIMES OF /INDIA'' REPORTED MANY CASES OF UNREST IN BOTH EARLY AND LATE YEARS OF THE |[[|/BRITISH /RAJ|]],|+INTO THE 20TH CENTURY. /EARLY COMPUTERS USED |[[teletype]]s|+WHICH DISPLAYED TEXT IN/^ALL-CAPS/+UPPERCASE LETTERS, AND/+NO COMPUTER DOCUMENTS HAD LOWERCASE TEXT.}}
+
</nowiki> &rarr;<br>{{fixcaps|THE ''/TIMES OF /INDIA'' REPORTED MANY CASES OF UNREST IN BOTH EARLY AND LATE YEARS OF THE |[[British Raj]],|+INTO THE 20TH CENTURY. /EARLY COMPUTERS USED |[[teletype]]s|+WHICH DISPLAYED TEXT IN/^ALL-CAPS/+UPPERCASE LETTERS, AND/+NO COMPUTER DOCUMENTS HAD LOWERCASE TEXT.}}
  
Just inserting a few slashes into the text, such as at the start of sentences and town names, can easily salvage a whole paragraph of caps-only text, within 1 minute. Wikilinks are NOT allowed within the text.
+
:* <nowiki>{{fixcaps|THE/SHRI/SHIVAJI/RAIGAD/SMARAK/MANDAL WAS ESTABLISHED WITH/SENAPATI/KHANDERAO/DABHADE/^II/+of/TALEGAON/DABHADE.}}</nowiki> &rarr;<br>{{fixcaps|THE/SHRI/SHIVAJI/RAIGAD/SMARAK/MANDAL WAS ESTABLISHED WITH/SENAPATI/KHANDERAO/DABHADE/^II/+of/TALEGAON/DABHADE.}}
 +
 
 +
Just inserting a few slashes into the text, such as at the start of sentences and town names, and putting [[Help:Link|wikilinks]] as separate lowercase parameters, can easily salvage a whole paragraph of caps-only text, within 1 minute. Wikilinks are NOT allowed embedded within the text, only as separate parameters (each in [[vertical bar]]s {{nowrap|"&#124;<nowiki>[[link]]</nowiki> &#124;"}}).
  
 
== Limitations ==
 
== Limitations ==
Line 589: Line 591:
 
:* forcing lowercase letters - put "+" after slash ("/+LOWER") to force text as "lower"
 
:* forcing lowercase letters - put "+" after slash ("/+LOWER") to force text as "lower"
 
:* forcing uppercase letters - put "^" after slash ("/^eXacT") to force as exact case "eXacT"
 
:* forcing uppercase letters - put "^" after slash ("/^eXacT") to force as exact case "eXacT"
:* splitting wikilinks - use 5 parameters "text|[[|LINKED TEXT|]]|+more here"
+
:* cannot split wikilinks {{in5}} - invalid: <nowiki>"text|[[|LINKED TEXT|]]|+more"</nowiki>
 
:* 40-word parameters {{in5}} - use multiple parameters for each 40 words
 
:* 40-word parameters {{in5}} - use multiple parameters for each 40 words
 
:* maximum 8 parameters - use multiple {&#123;fixcaps}} for longer text
 
:* maximum 8 parameters - use multiple {&#123;fixcaps}} for longer text
:* using [[wp:Subst]] - use {&#123;subst:fixcaps}} to store results upon SAVE of edit.
+
:* using [[wp:Subst]] &nbsp; - use {&#123;subst:fixcaps}} to store results upon SAVE of edit.
 
Any other character after the slash will cause the text to have all lowercase letters.
 
Any other character after the slash will cause the text to have all lowercase letters.
  
 
== See also ==
 
== See also ==
 +
* [[Help:Parser functions]] - Upcase with {&#123;uc:uppercase here}} &rarr; UPPERCASE HERE
 
* [[Template:Strfind short]] - quickly finds a string in a line of text
 
* [[Template:Strfind short]] - quickly finds a string in a line of text
 
* [[Template:String_templates_see_also_text|String templates see also text]]
 
* [[Template:String_templates_see_also_text|String templates see also text]]
Line 630: Line 633:
 
--17May2012 Rewrote to use {|safesubst:} everywhere, for [[WP:Subst]].
 
--17May2012 Rewrote to use {|safesubst:} everywhere, for [[WP:Subst]].
 
--24May2012 Vastly expanded to allow 8 parameters & pass wikilinks.
 
--24May2012 Vastly expanded to allow 8 parameters & pass wikilinks.
 +
--25May2012 Fixed doctext of passing wikilinks, "cannot split wikilinks"
  
 
[[Category:Wikipedia formatting and function templates|Str case title word]]
 
[[Category:Wikipedia formatting and function templates|Str case title word]]
 
[[Category:Templates with minimum expansion depth]]
 
[[Category:Templates with minimum expansion depth]]
 
</noinclude>
 
</noinclude>

Revision as of 00:43, 25 May 2012

{{{1}}} Template:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title word


The Template:Fixcaps sets the lowercase or capital-letter format of each word (or phrase) in a slash-encoded title, as with a book or film title.

Usage: {{Fixcaps|GOnE wiTH tHE /winD}} → Gone with the Template:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title word
  {{fixcaps|JOHN/DOE,/"/PROPER/PUNCTUATION/OF/TITLES"}} → John Template:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title wordTemplate:Str case title word
  {{fixcaps|SHOW|[[wikilink]]ed|+TEXT.}} → Show [[wikilink]]ed text.
  {{subst:fixcaps|"/SAVE/INSIDE/PAGE"}} → "Save Inside Page"

Most words will be displayed with a capital-letter, followed by all lowercase letters, while a preposition or article (a/an/the) will be shown in lowercase letters. A leading "+" forces lowercase. A leading caret symbol ("^") will cause the text to display unchanged, so "^woRDs" would show "woRDs". Prepositions include: about, above, after, at, before, by, for, in, of, on, with and without. Each word to capitalize must be preceded by a slash ("/"), but all spaces could be slashes, and prepositions would still display in lowercase letters. Only 25 slashes are allowed in each parameter, or about 40-45 words (2 lines of text) per parameter, and a wikilink must be in a separate parameter, not embedded inside other text (see below: Limitations). A total of 8 parameters are allowed, or about 320-360 words.

The resulting text, with mixed capital and lowercase letters, can be wp:Subst'ed into the page during edit SAVE, or copy-pasted back into the text, using the template as an editing gadget.

An extra space is added at the end of each slashed part except after a single quotation mark, left parenthesis, em dash, or apostrophes (''').

Examples

The following are some other examples:

A major use for the template would be in reformatting long lists of book titles entered as ALL-CAPS text, while inserting formatting codes for italics, footnotes or bolded volume numbers. Occasionally, entire sections or paragraphs of an article might contain ALL UPPERCASE TEXT, and the template can be used to more easily downcase all the improperly formatted text.

Just inserting a few slashes into the text, such as at the start of sentences and town names, and putting wikilinks as separate lowercase parameters, can easily salvage a whole paragraph of caps-only text, within 1 minute. Wikilinks are NOT allowed embedded within the text, only as separate parameters (each in vertical bars "|[[link]] |").

Limitations

Fixcaps is limited by restrictions set in the MediaWiki software, version 1.34.2, of about 40-45 words (255 characters, or about 2 lines of text). Wikilinks must be separate parameters, not embedded within the text, or start another {{fixcaps}} after a wikilink. The encoding of the text is limited to 25 slashes in each parameter, and the enclosed text cannot display slashes, except using a slash-backslash ("/\/") to display a forward slash. A total of eight (8) parameters are allowed, to handle 320-360 words or about 16 lines. For larger sections, use multiple {{fixcaps}} to handle 700 or more words, or for each 16 lines of text.

Special conditions:

  • forcing lowercase letters - put "+" after slash ("/+LOWER") to force text as "lower"
  • forcing uppercase letters - put "^" after slash ("/^eXacT") to force as exact case "eXacT"
  • cannot split wikilinks       - invalid: "text|[[|LINKED TEXT|]]|+more"
  • 40-word parameters       - use multiple parameters for each 40 words
  • maximum 8 parameters - use multiple {{fixcaps}} for longer text
  • using wp:Subst   - use {{subst:fixcaps}} to store results upon SAVE of edit.

Any other character after the slash will cause the text to have all lowercase letters.

See also