Template:LAuto/doc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with "* <nowiki>{{subst:LAuto|Category:test}}</nowiki> = {{subst:LAuto|Category:test}} * <nowiki>{{subst:LAuto|:Category:test}}</nowiki> = {{subst:LAuto|:Category:test}} * <nowiki>{...")
 
No edit summary
 
(23 intermediate revisions by the same user not shown)
Line 1: Line 1:
* <nowiki>{{subst:LAuto|Category:test}}</nowiki> = {{ACategory|Test}}
{{doc/subpage}}
* <nowiki>{{subst:LAuto|:Category:test}}</nowiki> = {{LCategory|Test}}
After page is saved what you see on the left will be replaced by what's shown on the right:
* <nowiki>{{subst:LAuto|Help:test}}</nowiki> = {{LHelp|Test}}
* <nowiki>{{subst:LAuto|Category:test}}</nowiki> = <nowiki>{{ACategory|Test}}</nowiki>
* <nowiki>{{subst:LAuto|Valve Developer Community:test}}</nowiki> = {{LProject|Test}}
* <nowiki>{{subst:LAuto|:Category:test}}</nowiki> = <nowiki>{{LCategory|Test}}</nowiki>
* <nowiki>{{subst:LAuto|test}}</nowiki> = {{L|Test}}
* <nowiki>{{subst:LAuto|Help:test}}</nowiki> = <nowiki>{{LHelp|Test}}</nowiki>
* <nowiki>{{subst:LAuto|Valve Developer Community:test}}</nowiki> = <nowiki>{{LProject|Test}}</nowiki>
* <nowiki>{{subst:LAuto|test}}</nowiki> = <nowiki>{{L|Test}}</nowiki>
* <nowiki>{{subst:LAuto|Template:test}}</nowiki> =  <nowiki>[[Template:test]]</nowiki>
 
== Needed regex to filter out outside links ==
This regex will replace wikilinks on the current page with subst:LAuto template which after page save will become L* templates (see above, what the substitution does is also visible using the '{{int:Showdiff}}' button).
 
This method is usable right in the [[Help:Editing Toolbar]] under
#go to {{int:wikieditor-toolbar-section-advanced}} -> on the right side '{{int:wikieditor-toolbar-tool-replace-title}}' (magnifying glass icon) -> check '{{int:wikieditor-toolbar-tool-replace-regex}}' checkbox
#enter the search/replace text shown lower
#press '{{int:wikieditor-toolbar-tool-replace-button-replaceall}}'
#check with '{{int:showdiff}}' to see what was changed
#save the page
 
*{{int:wikieditor-toolbar-tool-replace-search}}
<pre>\[\[(?!#|File(?:[ _]talk)?:|Image(?:[ _]talk)?:|Media:|Template(?:[ _]talk)?:|MediaWiki(?:[ _]talk)?:|Talk:|Category[ _]talk:|Project[ _]talk:|Valve[ _]Developer[ _]Community[ _]talk:|Help[ _]talk:|User(?:[ _]talk)?:|c:|commons:|Dictionary:|Google:|GoogleGroups:|IMDB:|M:|Meta:|Metawikipedia:|MW:|SdkBug:|SourceForge:|Steampowered:|W:|Wiki:|WikiBooks:|Wikipedia:|Wikiquote:|Wiktionary:|WP:)(:?(?:Category|Category|Help|Project|Valve[ _]Developer[ _]Community|Special|)(?:[^\|\]]+))(\|?.*?)\]\]</pre>
 
*{{int:wikieditor-toolbar-tool-replace-replace}}
<pre>{{subst:LAuto|$1$2}}</pre>
 
== Current limitations ==
* makes the link upper case but is not an issue if it has altname or the altname translation is being added anyway
* if link that should have {{code|_}} is used {{code|_}} will be replaced with spaces. Usually commands or entities will face this but those should use {{T|ent}} and {{T|cmd}} anyway so shouldn't be too much of an issue
 
== See Also ==
* [[Project:Alternative Languages]]
* {{T|L}}
* {{T|LCategory}}
* {{T|LProject}}
* {{T|LHelp}}
* {{T|LSpecial}}
* {{T|ACategory}}
* {{T|LanguageBar}}
* {{T|Language}}

Latest revision as of 11:38, 15 September 2024

Edit-copy.png
This is a documentation subpage for Template:LAuto.
Don't forget to purge the contents of the base page upon creating or editing this subpage.

After page is saved what you see on the left will be replaced by what's shown on the right:

  • {{subst:LAuto|Category:test}} = {{ACategory|Test}}
  • {{subst:LAuto|:Category:test}} = {{LCategory|Test}}
  • {{subst:LAuto|Help:test}} = {{LHelp|Test}}
  • {{subst:LAuto|Valve Developer Community:test}} = {{LProject|Test}}
  • {{subst:LAuto|test}} = {{L|Test}}
  • {{subst:LAuto|Template:test}} = [[Template:test]]

Needed regex to filter out outside links

This regex will replace wikilinks on the current page with subst:LAuto template which after page save will become L* templates (see above, what the substitution does is also visible using the 'Show changes' button).

This method is usable right in the Help:Editing Toolbar under

  1. go to Advanced -> on the right side 'Search and replace' (magnifying glass icon) -> check 'Treat search string as a regular expression' checkbox
  2. enter the search/replace text shown lower
  3. press 'Replace all'
  4. check with 'Show changes' to see what was changed
  5. save the page
  • Search for:
\[\[(?!#|File(?:[ _]talk)?:|Image(?:[ _]talk)?:|Media:|Template(?:[ _]talk)?:|MediaWiki(?:[ _]talk)?:|Talk:|Category[ _]talk:|Project[ _]talk:|Valve[ _]Developer[ _]Community[ _]talk:|Help[ _]talk:|User(?:[ _]talk)?:|c:|commons:|Dictionary:|Google:|GoogleGroups:|IMDB:|M:|Meta:|Metawikipedia:|MW:|SdkBug:|SourceForge:|Steampowered:|W:|Wiki:|WikiBooks:|Wikipedia:|Wikiquote:|Wiktionary:|WP:)(:?(?:Category|Category|Help|Project|Valve[ _]Developer[ _]Community|Special|)(?:[^\|\]]+))(\|?.*?)\]\]
  • Replace with:
{{subst:LAuto|$1$2}}

Current limitations

  • makes the link upper case but is not an issue if it has altname or the altname translation is being added anyway
  • if link that should have _ is used _ will be replaced with spaces. Usually commands or entities will face this but those should use {{ent}} and {{cmd}} anyway so shouldn't be too much of an issue

See Also