https://bugzilla.wikimedia.org/show_bug.cgi?id=15352
Happy-melon <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #3 from Happy-melon <[email protected]> 2009-04-30 16:36:10 UTC --- This doesn't strike me as semantically a ParserFunction, which are more concerned with logical and mathematical operations. It would probably make more sense as a string function, or (as suggested) a core function. In fact, the function could almost certainly be constructed from the string functions already present in [[mw:Extension:StringFunctions]]; something like {{#iferror: {{#ifexpr: {{#expr: 0+{{#explode: {{{ip|}}} |.|0}} >= 0 and 0+{{#explode: {{{ip|}}} |.|0}} < 256 }} and {{#expr: 0+{{#explode: {{{ip|}}} |.|1}} >= 0 and 0+{{#explode: {{{ip|}}} |.|1}} < 256 }} and {{#expr: 0+{{#explode: {{{ip|}}} |.|2}} >= 0 and 0+{{#explode: {{{ip|}}} |.|2}} < 256 }} and {{#expr: 0+{{#explode: {{{ip|}}} |.|3}} >= 0 and 0+{{#explode: {{{ip|}}} |.|3}} < 256 }} and {{#if: {{#explode: {{{ip|}}} |.|4}} | <span class="error"></span> | 1 }} |yes |no |no }} This (should) match strings that have exactly four nonempty substrings separated by periods; where each substring is an integer between 0 and 255. Extension to IPv6 would be possible, I expect. This is a very easy pattern to match. Your patch does not implement the functionality I would expect from your initial comment: it returns "1" when a valid IP is given and "" otherwise. It would then be necessary to wrap this in an #ifexpr: to obtain usable output in the same format as you say is used currently. Much better to follow the same syntax as #ifexpr: or #iferror - that is, {{#ifip: <string> | <then> | <else> }}. -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
