Template:LAuto

来自Valve Developer Community
跳转到导航 跳转到搜索
English (en)Deutsch (de)Esperanto (eo)Español (es)Français (fr)Suomi (fi)Hrvatski (hr)Magyar (hu)Italiano (it)日本語 (ja)한국어 (ko)Nederlands (nl)Polski (pl)Português (pt)Português do Brasil (pt-br)Русский (ru)Slovenčina (sk)Svenska (sv)Türkçe (tr)Українська (uk)Tiếng Việt (vi)中文 (zh)中文(臺灣) (zh-tw)
Icon-translate.png Available doc translations
Info.png
文档页面 Template:LAuto/doc/zh 不存在。
模板将改为显示英文文档。如果此消息后没有任何内容,则很可能该文档甚至不存在英文版本。

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 '显示更改' button).

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

  1. go to 高级 -> on the right side '查找和替换' (magnifying glass icon) -> check '使用正则表达式' checkbox
  2. enter the search/replace text shown lower
  3. press '替换所有'
  4. check with '显示更改' to see what was changed
  5. save the page
  • 查找:
\[\[(?!#|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|)(?:[^\|\]]+))(\|?.*?)\]\]
  • 替换为:
{{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