ws.checkers.ExtlinkReplacements module

class ws.checkers.ExtlinkReplacements.ExtlinkReplacements(api, db, **kwargs)

Bases: ws.checkers.ExtlinkStatusChecker.ExtlinkStatusChecker

https_everywhere_rules_path = '/home/klinkovsky/Bbox/pg/python3/wiki-scripts/ws/checkers/https_everywhere/default.rulesets.json'
url_replacements = [('update old archweb people URLs to archlinux.org/people/', 'https?\\:\\/\\/(?:www\\.)?archlinux\\.org\\/(?P<group>developers|fellows|trustedusers)\\/(?P<person>#.+)?', "https://archlinux.org/people/{{group | replace ('fellows', 'developer-fellows') | replace('trustedusers', 'trusted-users')}}/{% if person is not none %}{{person}}{% endif %}"), ('update old mailman URLs from archlinux.org/mailman/listinfo/ to lists.archlinux.org/listinfo/', 'https?\\:\\/\\/(?:www\\.)?archlinux\\.org\\/mailman\\/listinfo\\/(?P<mailinglist>.+)?', 'https://lists.archlinux.org/listinfo/{% if mailinglist is not none %}{{mailinglist}}{% endif %}'), ('update old mailman URLs from archlinux.org/pipermail/ to lists.archlinux.org/pipermail/', 'https?\\:\\/\\/(?:www\\.)?archlinux\\.org\\/pipermail\\/(?P<mail>.+)?', 'https://lists.archlinux.org/pipermail/{% if mail is not none %}{{mail}}{% endif %}'), ('update ancient archweb URLs from archlinux.org/*.php to archlinux.org/*/', 'https?\\:\\/\\/(?:www\\.)?archlinux\\.org\\/(?P<page>.+?)\\.php', 'https://archlinux.org/{{page}}/'), ('update archweb URLs from www.archlinux.org to archlinux.org', 'https?\\:\\/\\/www\\.archlinux\\.org(?P<path>\\/.*)?', 'https://archlinux.org{% if path is not none %}{{path}}{% endif %}'), ('update svntogit URLs from (projects|git).archlinux.org to github.com', 'https?\\:\\/\\/(?:projects|git)\\.archlinux\\.org\\/svntogit\\/(?P<repo>packages|community)\\.git\\/commit\\/(?P<path>[^?]+?)?(?:\\?h=[^&#?]+?)?(?:[&?]id=(?P<commit>[0-9A-Fa-f]+))', "https://github.com/archlinux/svntogit-{{repo}}/commit/{{commit}}{% if (path is not none) and ('/' in path) %}/{{path}}{% endif %}"), ('update svntogit URLs from (projects|git).archlinux.org to github.com', 'https?\\:\\/\\/(?:projects|git)\\.archlinux\\.org\\/svntogit\\/(?P<repo>packages|community)\\.git\\/(?P<type>tree|plain|log)\\/(?P<path>[^?]+?)(?:\\?h=(?P<branch>[^&#?]+?))?(?:[&?]id=(?P<commit>[0-9A-Fa-f]+))?(?:#n(?P<linenum>\\d+))?', "https://github.com/archlinux/svntogit-{{repo}}/{{type | replace('tree', 'blob') | replace('plain', 'raw') | replace('log', 'commits')}}/{% if commit is not none %}{{commit}}/{% elif branch is not none %}{{branch}}/{% elif (path is not none) and (not path.startswith('packages')) %}packages/{% endif %}{{path}}{% if linenum is not none %}#L{{linenum}}{% endif %}"), ('update svntogit URLs from (projects|git).archlinux.org to github.com', 'https?\\:\\/\\/(?:projects|git)\\.archlinux\\.org\\/svntogit\\/(?P<repo>packages|community)\\.git(\\/tree)?\\/?', 'https://github.com/archlinux/svntogit-{{repo}}'), ('update old links to (projects|git).archlinux.org', 'https?\\:\\/\\/(?:projects|git)\\.archlinux\\.org\\/(?P<project>archboot|archiso|aurweb|infrastructure).git(?:\\/(?P<type>commit|tree|plain|log))?(?P<path>[^?]+?)?(?:\\?h=(?P<branch>[^&#?]+?))?(?:[&?]id=(?P<commit>[0-9A-Fa-f]+))?(?:#n(?P<linenum>\\d+))?', "https://gitlab.archlinux.org/{% if project == 'archboot' %}tpowa{% else %}archlinux{% endif %}/{{project}}{% if type is not none %}/{{type | replace('plain', 'raw') | replace('log', 'commits')}}{% if commit is not none %}/{{commit}}{% elif branch is not none %}/{{branch}}{% elif path is not none %}/master{% endif %}{% if (path is not none) and (path != '/') %}{{path}}{% endif %}{% if linenum is not none %}#L{{linenum}}{% endif %}{% endif %}"), ('remove language codes from addons.mozilla.org and addons.thunderbird.net links', 'https?\\:\\/\\/addons\\.(?:mozilla\\.org|thunderbird\\.net)/[^/]+?\\/(?P<application>firefox|android|thunderbird|seamonkey)(?P<path>.+)?', "https://addons.{% if application in [ 'thunderbird', 'seamonkey' ] %}thunderbird.net{% else %}mozilla.org{% endif %}/{{application}}{% if path is not none %}{{path}}{% endif %}"), ('update links from addons.mozilla.org to addons.thunderbird.net', 'https?\\:\\/\\/addons\\.mozilla\\.org/(?P<application>thunderbird|seamonkey)(?P<path>.+)?', 'https://addons.thunderbird.net/{{application}}{% if path is not none %}{{path}}{% endif %}'), (None, 'https://www.kernel.org/doc/Documentation/filesystems/', 'https://www.kernel.org/doc/Documentation/filesystems/'), ('link to HTML version of kernel documentation', 'https?\\:\\/\\/(?:www\\.)?kernel.org/doc/Documentation(?P<path>\\/.+?)(?P<extension>\\.txt|\\.rst)?', 'https://www.kernel.org/doc/html/latest{{path}}{% if extension is not none %}.html{% endif %}'), ('update linuxwireless.org/wireless.kernel.org links', 'https?\\:\\/\\/(?:(?:www\\.)?linuxwireless|wireless\\.kernel)\\.org/(?P<path>[^#]*)(?P<fragment>#.+)?', 'https://wireless.wiki.kernel.org/{{path | lower}}{% if fragment is not none %}{{fragment | lower}}{% endif %}'), ('remove user IDs from short links to Stack Exchange posts', 'https?\\:\\/\\/(?P<domain>(?:\\w+\\.)?stackexchange\\.com|stackoverflow\\.com|askubuntu\\.com|serverfault\\.com|superuser\\.com|mathoverflow\\.net)\\/a\\/(?P<answer>\\d+)\\/\\d+', 'https://{{domain}}/a/{{answer}}'), ('update links for IRC channels that left Freenode (if a particular channel is not on Libera, please fix it manually)', 'ircs?\\:\\/\\/\\w+\\.freenode\\.net(\\/#|\\/|#)(?P<channel>archlinux.*|bash)', 'ircs://irc.libera.chat/{{channel}}'), ('replace irc:// with ircs:// for networks that support it', 'ircs?\\:\\/\\/(?P<domain>\\w+\\.freenode\\.net|irc\\.libera\\.chat|irc\\.oftc\\.net|irc\\.rizon\\.net|irc\\.azzurra\\.org)(?P<path>\\/.*)?', 'ircs://{{domain}}{% if (path is not none) %}{{path}}{% endif %}')]
static strip_extra_brackets(wikicode, extlink)

Strip extra brackets around an external link, for example:

check_url_replacements(wikicode, extlink, url)
check_http_to_https(wikicode, extlink, url)
handle_node(src_title, wikicode, node, summary_parts)