Difference between revisions of "Template:Fixcaps"

From blackwiki
Jump to navigation Jump to search
imported>Wikid77
(put more {|safesubst:} as needed)
imported>Wikid77
(updated doctext at "Usage" to note the results can be wp:Subst'ed into a page during edit SAVE.)
Line 71: Line 71:
 
: '''Usage:''' <nowiki>{{Fixcaps|GOnE wiTH tHE /winD}}</nowiki> &rarr; {{Fixcaps|GOnE wiTH tHE /winD}}
 
: '''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|JOHN/DOE,/"/PROPER/PUNCTUATION/OF/TITLES"}} &rarr; {{fixcaps|JOHN/DOE,/"/PROPER/PUNCTUATION/OF/TITLES"}}
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, or about 40-45 words (2 lines of text), and no wikilinks inside (see below: [[#Limitations|Limitations]]). The resulting title, with capital letters, can be copy-pasted back into the text, using the template as an editing gadget.
+
::: &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, or about 40-45 words (2 lines of text), and no wikilinks inside (see below: [[#Limitations|Limitations]]).
 +
 
 +
The resulting title, with capital 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>).
 
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>).
Line 94: Line 97:
 
:* 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"
Any other character after the slash will cause the words to be all lowercase letters.
+
Any other character after the slash will cause the text to have all lowercase letters.
  
 
== See also ==
 
== See also ==
Line 108: Line 111:
 
--      parentheses or dashes are repeated without a trailing space.
 
--      parentheses or dashes are repeated without a trailing space.
 
--      Other words or characters are followed by a 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.
 
--
 
--
 
-----------------------------------------------------------------------
 
-----------------------------------------------------------------------

Revision as of 04:28, 18 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
  {{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, or about 40-45 words (2 lines of text), and no wikilinks inside (see below: Limitations).

The resulting title, with capital 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, can easily salvage a whole paragraph of caps-only text, within 1 minute. Wikilinks are NOT allowed within the text.

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 are NOT allowed within the text, so start another {{fixcaps}} after a wikilink. The encoding of the text is limited to 25 slashes, and the enclosed text cannot display slashes, except using a slash-backslash ("/\/") to display a forward slash. For larger sections, use multiple {{fixcaps}} to handle 26 to 50 or more slashes, or for each 2 lines to 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"

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

See also