Template:LAuto/doc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 9: Line 9:


== Needed regex to filter out outside links ==
== 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 Preview' button).
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  
This method is usable right in the [[Help:Editing Toolbar]] under  
Line 15: Line 15:
#enter the search/replace text shown lower
#enter the search/replace text shown lower
#press 'Replace All'
#press 'Replace All'
#check with 'Show Preview' to see what was changed
#check with '{{int:Showdiff}}' to see what was changed
#save the page
#save the page



Revision as of 11:26, 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}}

See Also