Difference between revisions of "Template:Fixcaps"

From blackwiki
Jump to navigation Jump to search
imported>Wikid77
(→‎Limitations: clarified; noted embedded "wikilink will repeat 25 times".)
imported>Gadget850
(documentation)
Line 560: Line 560:
 
--></noinclude>{{ {{{|safesubst:}}}Str case title word
 
--></noinclude>{{ {{{|safesubst:}}}Str case title word
 
   |{{ {{{|safesubst:}}}#titleparts:{{{8}}}|1|25}}}}
 
   |{{ {{{|safesubst:}}}#titleparts:{{{8}}}|1|25}}}}
}}<noinclude><!--endswitch {8} passed-->
+
}}<noinclude><!--endswitch {8} passed--><noinclude>
 
+
{{documentation}}</noinclude>
<br>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:''' <nowiki>{{Fixcaps|GOnE wiTH tHE /winD}}</nowiki> &rarr; {{Fixcaps|GOnE wiTH tHE /winD}}
 
::: &nbsp; {&#123;fixcaps|JOHN/DOE,/"/PROPER/PUNCTUATION/OF/TITLES"}} &rarr; {{fixcaps|JOHN/DOE,/"/PROPER/PUNCTUATION/OF/TITLES"}}
 
::: &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;
 
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.
 
 
 
An extra space is added at the end of each slashed part except after a single quotation mark, left parenthesis, [[em dash]], or apostrophes (<nowiki>'''</nowiki>).
 
 
 
== Examples ==
 
The following are some other examples:
 
:* <nowiki>{{fixcaps|A./EINSTEIN. ''/oUT OF/mY/lATEr/YEaRS''}}</nowiki> &rarr; {{fixcaps|A./EINSTEIN. ''/oUT OF/mY/lATEr/YEaRS''}}
 
 
 
:* <nowiki>{{fixcaps|W./MOZART. ''/eiNE KLEINE /nachTMUSIK'' (ORCHESTRAL COMPOSITION)}}</nowiki> &rarr; {{fixcaps|W./MOZART. ''/eiNE KLEINE /nachTMUSIK'' (ORCHESTRAL COMPOSITION)}}
 
 
 
:* <nowiki>{{fixcaps|+WHEN THE/^UN/ORGANIZATION BEGAN IN 1946.}}</nowiki> &rarr; {{fixcaps|+WHEN THE/^UN/ ORGANIZATION BEGAN IN 1946.}}
 
 
 
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> &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>{{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 ==
 
Fixcaps is limited by restrictions set in the [[MediaWiki]] software, version {{CURRENTVERSION}}, of about 40-45 words (255 characters, or about 2 lines of text) in each of the 8 parameters. Wikilinks must be separate parameters in bars(<nowiki>|[[Link]]|</nowiki>), not embedded within the text, or else put between 2 {&#123;fixcaps}} around a wikilink; otherwise, an embedded wikilink will repeat 25 times. 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-slash ("/\/") 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 {&#123;fixcaps}} to handle 700 or more words, or for each 16 lines of text.
 
 
 
Special conditions:
 
:* forcing lowercase letters - put "+" after slash ("/+LOWERS") to force text as "lowers"
 
:* forcing uppercase letters - put "^" after slash ("/^eXacT") to force as exact case "eXacT"
 
:* cannot split wikilinks {{in5}} - invalid: <nowiki>"text|[[|LINKED TEXT|]]|+more"</nowiki>
 
:* 40-word parameters {{in5}} - use multiple parameters for each 40 words
 
:* maximum 8 parameters - use multiple {&#123;fixcaps}} for longer text
 
:* 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.
 
 
 
== 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:String_templates_see_also_text|String templates see also text]]
 
* [[WP:substitution]] and [[Template:Subst]] - explain how to use subst: (<nowiki>{{subst:Fixcaps|(string)}</nowiki>} will permanently fix a block of text)
 
<!--
 
-----------------------------------------------------------------------
 
--NOTES
 
--
 
-- NOTE A1: Each word can be a punctuation mark, as well as a string
 
--      of letters. When separated, apostrophes, quotemarks, left
 
--      parentheses or dashes are repeated without a trailing space.
 
--      Other words or characters are followed by a space.
 
--
 
-- NOTE S2: Every markup function has "{{{|safesubst:}}}" here to
 
--      allow using the template-call prefix "{subst:Fixcaps}" to
 
--      substitute the results of invoking the template, when saving
 
--      a page after editing. Unless "{{{|safesubst:}}}" was put on
 
--      every markup function, then that logic would fail to work
 
--      when "subst:" is used, even though it works in default mode.
 
--      See [[WP:Subst]] for more information on substitutions.
 
--
 
-----------------------------------------------------------------------
 
--HISTORY:
 
--12May2012 Created to support Template:Fixcaps.
 
--13May2012 Changed to ignore an empty word (not append a space).
 
--13May2012 Changed to append a space after words.
 
--13May2012 Prepositions: after/before, into/onto, over/under, without.
 
--16May2012 Added NOTES comments to explain template operation.
 
--16May2012 Added HISTORY comments to log major changes (not typos).
 
--16May2012 Changed to allow lead caret "^" to show text unchanged.
 
--16May2012 Changed to allow lead caret "+" to force lowercase.
 
--16May2012 Added doctext to use "&#32;" to force all lowercase text.
 
--17May2012 Noted limit 40-45 words (255 characters, or 2 text lines).
 
--17May2012 Rewrote to use {|safesubst:} everywhere, for [[WP:Subst]].
 
--24May2012 Vastly expanded to allow 8 parameters & pass wikilinks.
 
--25May2012 Fixed doctext of passing wikilinks, "cannot split wikilinks"
 
--15July2012 Note {ombox} "template is mostly non-transluded" upon TfD.
 
-->
 
 
 
{{DEFAULTSORT:Fixcaps}}
 
[[Category:Wikipedia formatting and function templates]]
 
[[Category:Templates with minimal expansion depth]]
 
</noinclude>
 

Revision as of 00:13, 20 October 2012

Template:Substituted {{{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

50px Template documentation[view] [edit] [history] [purge]

Template:Substituted

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.

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

This template should normally be substituted when used directly in an article. The text that results from this template, with mixed capital and lowercase letters, will be permanently inserted into the page when it is saved, if the template is substituted. This is desirable when repairing things like blocks of ALL-CAPS WRITING. The template can also be used temporarily in edit mode as a tool for generating the corrected text in preview mode, then copy-pasted back into the text being edited, over the improperly capitalized material.

Please familiarize yourself with Wikipedia:Manual of Style/Titles before using this template for titles of published works. There are multiple styles of title capitalization (high academic, mainstream, and journalistic), and Wikipedia uses the middle approach. The short version: use lowercase for a/an/the, for prepositions shorter than 5 letters, for and/but/or/nor, and for the to of infinitives. The preposition rule means "with" is lower case, "About" is mixed case. The preposition rule applies even when the preposition in question is capitalized when it is not used as a preposition.

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) in each of the 8 parameters. Wikilinks must be separate parameters in bars(|[[Link]]|), not embedded within the text, or else put between 2 {{fixcaps}} around a wikilink; otherwise, an embedded wikilink will repeat 25 times. 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-slash ("/\/") 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 ("/+LOWERS") to force text as "lowers"
  • 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.
  • an extra space is added at the end of each slashed part except after a single quotation mark, left parenthesis, em dash, or apostrophes (''').

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

See also

External links

TitleCase.com— Convert text to title case, uppercase and lowercase