docs(sphinx): define the wikipedia and iana extlinks roles ahead of first use - #1001
Conversation
|
NEEDS CHANGES at 1. The comment's mechanism claim is false. It says a role nobody writes is never invoked, so 2. "28 distinct Wikipedia articles, all of that shape" is two errors. The unit is URLs, not 3. "20 of 108 distinct URLs" mislabels its unit. 20 of 108 holds over fragment-stripped paths; Unmoved: both templates render correctly, and the 61-warning / 2-error baseline — which it checked by |
69571a5 to
cb1160f
Compare
…irst use Adds two entries alongside the three added in #998, so that the citations these pages already carry as bare URLs have a role to convert to when that sweep reaches them. - `:wikipedia:` expands `https://en.wikipedia.org/wiki/%s`. 28 of the 31 distinct `wikipedia.org`/`wikimedia.org` URLs cited today are that shape, over 23 distinct articles -- `IPv6_packet` appears four times, differing only by fragment. The other three must stay hardcoded: a `/w/index.php?...&oldid=...` permalink, a `foundation.wikimedia.org` policy page in `pcapkit/vendor/default.py`, and an `http://` ARP link that a role would silently upgrade to `https`. - `:iana:` expands `https://www.iana.org/assignments/%s`, the argument being the path after `/assignments/`. All 179 distinct IANA URLs are that shape across 21 registries, so both a registry index and a specific table resolve through one role. A two-`%s` IANA template would be wrong: over the 108 distinct fragment-stripped paths, the file stem equals the registry name in only 20 -- the rest are per-table `.csv` files the vendor crawlers read -- and Python's `%` takes one argument, so the second placeholder raises at role-expansion time rather than degrading. Both captions are `%s`, not `#%s`, because the argument is a slug or path rather than a number; prose should use the explicit-title form, since a bare caption renders the raw path as visible text. Neither role is cited yet, by design, per the ruling on #989. Verified: both roles render to the expected hrefs with the fragment and both IANA shapes intact; docs build exit 0 with 61 warnings / 2 errors, unchanged from the baseline, and 0 unknown-role errors; `tests/project` 258 passed, 1 skipped, 859 subtests.
cb1160f to
50fc4b3
Compare
|
Delta round: NEEDS CHANGES at 1. My One correction to the review's reasoning, though its number is right. It attributed my 34 to a 2. " It also withdrew its earlier suggestion about the Re-verified at A fresh delta review on this head is next; not ready to merge until it lands. |
|
GOOD TO GO at The Re-verified by me at this head: 31 distinct Confirmed per claim: the setup-time wording is precise in both directions — One nit it raised and I am not acting on: the reworded line is 90 characters against the block's 87. CI: 62 ok / 3 skipped / 0 failed / 6 running. Not ready to merge until those finish; I will say so |
|
Ready to merge at Three review rounds, all of them on prose: the two Unpublished and nothing merged by me: this is yours to merge. |
Description
Defines
:wikipedia:and:iana:inextlinks, alongside the three roles #998 added. Per the rulingon #989: create them now rather than at first use. Neither is cited yet, deliberately.
Both templates come from measuring the tree:
:wikipedia:→https://en.wikipedia.org/wiki/%s— 28 of the 31 distinctwikipedia.org/wikimedia.orgURLs cited today are that shape, over 23 distinct articles (
IPv6_packetappears four times,differing only by fragment). The other three must stay hardcoded through the conversion: a
/w/index.php?…&oldid=…permalink, afoundation.wikimedia.orgpolicy page in
pcapkit/vendor/default.py, and anhttp://ARP link a role would silently upgrade.:iana:→https://www.iana.org/assignments/%s, argument = the path after/assignments/. All179 distinct IANA URLs are that shape across 21 registries, so a registry index and a specific
table both resolve through one role.
A two-
%sIANA template would be wrong twice: over the 108 distinct fragment-stripped paths thefile stem equals the registry name in only 20 (the rest are per-table
.csvfiles the vendorcrawlers read), and Python's
%takes one argument, so the second placeholder raises at role-expansiontime rather than degrading. Captions are
%s, not#%s, since the argument is a slug or path; proseshould use the explicit-title form, because a bare caption renders the raw path as visible text.
Why defining an uncited role is safe here
Not because an uncited role is inert — it is not.
extlinksdoes not check the template at setup time,but it registers
ExternalLinksCheckerunconditionally, and itscheck_uriloops everyextlinksentry for every external reference with norole usage involved. It returns early only because
extlinks_detect_hardcoded_linksis absent from thistree and defaults to
False. Measured: with that flag on, a page of hardcoded links and zero roleusages goes from 0 warnings to 1 purely by adding these entries. The comment in the diff says this
rather than the general claim an earlier revision made.
Verification
…/assignments/<registry>and…/assignments/<registry>/<file>.csvresolve. 0unknown interpreted text role.tests/project— 258 passed, 1 skipped, 859 subtests, 0 failed.Checklist