|
|
| !"confirmed" in user_groups | | !"confirmed" in user_groups |
| & page_namespace == 0 | | & page_namespace == 0 |
| /* narrow down edits to just those dealing with refs */ | | /* narrow down edits to just those dealing with refs/reflike templates */ |
| & removed_lines irlike "</?ref\b" | | & removed_lines irlike "</?ref\b|{{\s*(?:hrf|[es]fn)\b" |
| /* this edit_delta ignores large blankings treated by another filter */ | | /* this edit_delta ignores large blankings treated by another filter */ |
| & edit_delta >= -3000 | | & edit_delta >= -3000 |
| /* no added lines usually means a blanking which is dealt with by other filters */ | | /* no added lines usually means a blanking which is dealt with by other filters */ |
| & length(added_lines) > 0 | | & length(added_lines) > 0 |
| & !added_lines irlike "^#(?:виж|пренасочване|redirect)\s*\[\[" | | & !added_lines irlike "^#(?:виж|пренасочване|redirect)\s*\[\[" |
| & ( | | & ( |
| /* matches normal or self-closing refs, excluding self-referencing ones */ | | /* matches normal or self-closing refs, excluding self-referencing ones; also matches specific reflike templates */ |
| rx_match := "(?i)<ref\b[^>]*+(?<!/)>(?:[^<.]++|\.(?!wikipedia\.org\b)|<(?!/?ref\b))*+</ref\b|<ref\b[^>]*/>"; | | rx_match := "(?i)<ref\b[^>]*+(?<!/)>(?:[^<.]++|\.(?!wikipedia\.org\b)|<(?!/?ref\b))*+</ref\b|<ref\b[^>]*/>|{{\s*(?:hrf|[es]fn)\b(?:[^{}]++|({(?:[^{}]++|(?1))*}))+}}"; |
| /* removes comments and empty refs */ | | /* removes comments and empty refs/reflike templates */ |
| rx_clean := "(?i)<!--(?:[^-]++|-(?!->))*+-->|<ref\s*>\s*</ref\s*>|<ref\s*/>(?:\s*</ref\s*>)?"; | | rx_clean := "(?i)<!--(?:[^-]++|-(?!->))*+-->|<ref\s*>\s*</ref\s*>|<ref\s*/>(?:\s*</ref\s*>)?|{{\s*(?:hrf|[es]fn)(?:\s*\|(?:[^=\|]*=)?)*\s*}}"; |
| /* compare match counts of removed and added */ | | /* compare match counts of removed and added */ |
| rcount(rx_match, str_replace_regexp(removed_lines, rx_clean, "")) > rcount(rx_match, str_replace_regexp(added_lines, rx_clean, "")) | | rcount(rx_match, str_replace_regexp(removed_lines, rx_clean, "")) > rcount(rx_match, str_replace_regexp(added_lines, rx_clean, "")) |
| ) | | ) |