User:松/Drafts/Extension:AbuseFilter/Rules format: Difference between revisions

Translation code removal
m (459 revisions imported: Per request at the community portal.)
(Translation code removal)
Line 1:
<languages/>
<translate>
<!--T:1-->
The rules are formatted much as conditionals in a C/Java/Perl-like language.
 
== Strings == <!--T:2-->
 
You can specify a literal by placing it in single or double quotes (for strings), or by typing it in as-is (for numbers, both floating-point and integer).</translate>
<!--T:3-->
You can specify a literal by placing it in single or double quotes (for strings), or by typing it in as-is (for numbers, both floating-point and integer).</translate>
<translate>
<!--T:4-->
You can get linebreaks with <tvar|1><code>\n</code></>, tab characters with <tvar|2><code>\t</code></>, and you can also escape the quote character with a backslash.
 
You can get linebreaks with <tvar|1><code>\n</code></>, tab characters with <tvar|2><code>\t</code></>, and you can also escape the quote character with a backslash.
<!--T:5-->
Use the <tvar|1><code>+</code></> (plus) symbol to [[w:concatenation|concatenate]] two [[w:string literal|literal strings]] or the values of two [[w:Variable (computer science)|vars]] with a string value.
</translate>
 
 
; <translate><!--T:6--> Examples</translate>:
Use the <tvar|1><code>+</code></> (plus) symbol to [[w:concatenation|concatenate]] two [[w:string literal|literal strings]] or the values of two [[w:Variable (computer science)|vars]] with a string value.
 
 
; Examples:
<syntaxhighlight lang="perl">
"<translate><!--T:7--> This is a string</translate>"
'<translate><!--T:8--> This is also a string</translate>'
'<translate><!--T:9--> This string shouldn\'t fail</translate>'
"<translate><!--T:10--> This string\nHas a linebreak</translate>"
1234
1.234
Line 27 ⟶ 22:
</syntaxhighlight>
 
==User-defined variables== <!--T:11-->
<translate>
 
==User-defined variables== <!--T:11-->
You can define custom variables for ease of understanding with the assign symbol <tvar|1><code>:=</code></> in a line (closed by <tvar|2><code>;</code></>) within a condition.</translate>
 
Such variables may use letters, underscores, and numbers (apart from the first character) and are case-insensitive.</translate>
 
Example (from <tvar|1>[[w:Special:AbuseFilter/79]]</>):
 
<!--T:12-->
You can define custom variables for ease of understanding with the assign symbol <tvar|1><code>:=</code></> in a line (closed by <tvar|2><code>;</code></>) within a condition.</translate>
<translate>
<!--T:13-->
Such variables may use letters, underscores, and numbers (apart from the first character) and are case-insensitive.</translate>
<translate>
<!--T:14-->
Example (from <tvar|1>[[w:Special:AbuseFilter/79]]</>):
</translate>
 
<syntaxhighlight lang="c">
Line 49 ⟶ 40:
</syntaxhighlight>
 
 
<translate>
==Arrays== <!--T:15-->
 
</translate>
<!--Note: these examples are also used in https://phabricator.wikimedia.org/diffusion/EABF/browse/master/tests/parserTests/mwexamples-arrays.t -->
 
<translate>
AbuseFilter has support for non-associative arrays, which can be used like in the following examples.</translate>
<!--T:16-->
AbuseFilter has support for non-associative arrays, which can be used like in the following examples.</translate>
 
{{Caution|1=<translate><!--T:460--> Expressions like <tvar|1><code>page_namespace in [14, 15]</code></> may not work as expected.</translate> <translate><!--T:440--> This one will evaluate to <tvar|1><samp>true</samp></> also if <tvar|2><code>page_namespace</code></> is <tvar|3><samp>1</samp></>, <tvar|4><samp>4</samp></>, or <tvar|5><samp>5</samp></>.</translate> <translate><!--T:441--> For more information and possible workarounds, please see <tvar|1>[[:phab:T181024|T181024]]</>.</translate>}}
222

edits