Template:Autofix
Use it on the talk page of a property, and User:KrBot will come along and do replacements.
Parameters:
- pattern — Q-key for Item properties or PCRE compatible regular expression for other types
- replacement — new value, Q-key for Item properties or string containing the pattern. \1, \2 and etc. mean text matching corresponding parenthesized group from the pattern
- move_to — optional, new value will be moved to this property (is effective in main values only, not qualifiers and references)
- copy_to — optional, new value will be copied to this property. Original property will not be changed. References and qualifiers will be copied from original value. This autofix is effective in main values only, not qualifiers and references.
- create_property and create_item — specifies claim that is to be created if property value is matched to pattern. It is not compatible with the replacement and move_to properties.
- operation — one of the following values: lower_case, upper_case. It is not compatible with all other parameters.
Usage
[edit]Remove leading zeros:
{{Autofix|pattern=<nowiki>0+([1-9]\d*)</nowiki>|replacement=\1}}
Move video files to video (P10):
{{Autofix|pattern=<nowiki>((?i).+\.(webm|ogv))</nowiki>|replacement=\1|move_to=P10}}
Copy enterprise number (Belgium) (P3376) to European Unique Identifier (P13790) with changing format:
{{Autofix|pattern=<nowiki>([01]\d{3})(\d{3})(\d{3})</nowiki>|replacement=BEKBOBCE.\1.\2.\3|copy_to=P13790}}
Add claim category contains (P4224) = film (Q11424) if property value equals to film, by year of publication only (Q38078930), applicable for category combines topics (P971):
{{Autofix|pattern=Q38078930|create_property=P4224|create_item=Q11424}}
Transform the property values to lower case:
{{Autofix|operation=lower_case}}
More examples can be found on property talk pages.
TemplateData
[edit]Use it on the talk page of a property, and a bot will come along and do replacements.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| pattern | pattern | QID for item properties or PCRE compatible regular expression for other types
| String | optional |
| replacement | replacement | new value, QID for item properties or string containing the pattern. \1, \2 and etc. mean text matching corresponding parenthesized group from the pattern
| String | optional |
| move_to | move_to | optional, new value will be moved to this property (is effective in main values only, not qualifiers and references)
| String | optional |
| copy_to | copy_to | optional, new value will be copied to this property (is effective in main values only, not qualifiers and references)
| String | optional |
| operation | operation | one of the following values: lower_case, upper_case. It is not compatible with all other parameters.
| String | optional |
| create_property | create_property | specifies claim that is to be created if property value is matched to pattern. It is not compatible with the replacement and move_to properties.
| Unknown | optional |
| create_item | create_item | specifies claim that is to be created if property value is matched to pattern. It is not compatible with the replacement and move_to properties.
| Unknown | optional |
| The above documentation is transcluded from Template:Autofix/doc (edit | history). Editors can experiment in this template's sandbox (create | mirror) and testcases (create) page. Please add categories to the /doc subpage. Subpages of this template. |