Skip to content

Commit

Permalink
If you provide an anchors-block, I'll trust the spec you claim it's f…
Browse files Browse the repository at this point in the history
…rom, even if that spec has been marked as obsoleted. Fixes #2230
  • Loading branch information
tabatkins committed Feb 18, 2022
1 parent 152b0b8 commit b1c6bfa
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
12 changes: 9 additions & 3 deletions bikeshed/boilerplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections import OrderedDict, defaultdict
from datetime import datetime

from . import conditional, config, dfnpanels, h, messages as m
from . import biblio, conditional, config, dfnpanels, h, messages as m
from .DefaultOrderedDict import DefaultOrderedDict
from .refs import utils as refUtils

Expand Down Expand Up @@ -532,7 +532,10 @@ def makeLink(*contents):
for spec, refGroups in sorted(doc.externalRefsUsed.items(), key=lambda x: x[0].upper()):
# ref.spec is always lowercase; if the same string shows up in biblio data,
# use its casing instead.
biblioRef = doc.refs.getBiblioRef(spec, quiet=True)
if "_biblio" in refGroups:
biblioRef = refGroups["_biblio"]
else:
biblioRef = doc.refs.getBiblioRef(spec, quiet=True)
if biblioRef:
printableSpec = biblioRef.linkText
else:
Expand All @@ -548,7 +551,10 @@ def makeLink(*contents):
h.E.li(h.E.a(attrs, "[", printableSpec, "]"), " defines the following terms:"),
)
termsUl = h.appendChild(specLi, h.E.ul())
for _, refs in sorted(refGroups.items(), key=lambda x: x[0]):
for tempkey, refs in sorted(refGroups.items(), key=lambda x: x[0]):
if isinstance(refs, biblio.BiblioEntry):
# Not a refGroup, just some metadata
continue
if len(refs) == 1:
ref = list(refs.values())[0]
link = makeLink(ref.text)
Expand Down
10 changes: 9 additions & 1 deletion bikeshed/unsortedJunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,19 +957,27 @@ def processAutolinks(doc):
if ref and ref.spec and doc.refs.spec and ref.spec.lower() != doc.refs.spec.lower():
spec = ref.spec.lower()
key = ref.for_[0] if ref.for_ else ""

if isNormative(el, doc):
biblioStorage = doc.normativeRefs
else:
biblioStorage = doc.informativeRefs

# If the ref is from an anchor block, it knows what it's doing.
# Don't follow obsoletion chains.
allowObsolete = ref.status == "anchor-block"

biblioRef = doc.refs.getBiblioRef(
ref.spec,
status=doc.md.defaultRefStatus,
generateFakeRef=True,
quiet=True,
quiet=False,
allowObsolete=allowObsolete,
)
if biblioRef:
biblioStorage[biblioRef.linkText] = biblioRef
spec = biblioRef.linkText.lower()
doc.externalRefsUsed[spec]["_biblio"] = biblioRef
doc.externalRefsUsed[spec][ref.text][key] = ref

if ref:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6663,7 +6663,7 @@ <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span cla
<li><span class="dfn-paneled" id="term-for-widl-ServiceWorkerGlobalScope-onevicted">onevicted</span>
</ul>
<li>
<a data-link-type="biblio">[RFC5988]</a> defines the following terms:
<a data-link-type="biblio">[rfc5988]</a> defines the following terms:
<ul>
<li><span class="dfn-paneled" id="term-for-section-5.2">context iri</span>
<li><span class="dfn-paneled" id="term-for-section-5.4">target attribute</span>
Expand Down Expand Up @@ -6749,6 +6749,8 @@ <h3 class="no-num no-ref heading settled" id="normative"><span class="content">N
<dd>D. Crocker, Ed.; P. Overell. <a href="https://datatracker.ietf.org/doc/html/rfc5234"><cite>Augmented BNF for Syntax Specifications: ABNF</cite></a>. January 2008. Internet Standard. URL: <a href="https://datatracker.ietf.org/doc/html/rfc5234">https://datatracker.ietf.org/doc/html/rfc5234</a>
<dt id="biblio-rfc5988">[RFC5988]
<dd>M. Nottingham. <a href="https://httpwg.org/specs/rfc8288.html"><cite>Web Linking</cite></a>. October 2017. Proposed Standard. URL: <a href="https://httpwg.org/specs/rfc8288.html">https://httpwg.org/specs/rfc8288.html</a>
<dt id="biblio-rfc5988①">[RFC5988]
<dd>M. Nottingham. <a href="https://datatracker.ietf.org/doc/html/rfc5988"><cite>Web Linking</cite></a>. October 2010. Proposed Standard. URL: <a href="https://datatracker.ietf.org/doc/html/rfc5988">https://datatracker.ietf.org/doc/html/rfc5988</a>
<dt id="biblio-rfc7230">[RFC7230]
<dd>R. Fielding, Ed.; J. Reschke, Ed.. <a href="https://httpwg.org/specs/rfc7230.html"><cite>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</cite></a>. June 2014. Proposed Standard. URL: <a href="https://httpwg.org/specs/rfc7230.html">https://httpwg.org/specs/rfc7230.html</a>
<dt id="biblio-rfc7231">[RFC7231]
Expand Down
2 changes: 1 addition & 1 deletion tests/github/w3c/webrtc-priority/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="c
<h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3>
<ul class="index">
<li>
<a data-link-type="biblio">[WEBRTC]</a> defines the following terms:
<a data-link-type="biblio">[webrtc-1]</a> defines the following terms:
<ul>
<li><span class="dfn-paneled" id="term-for-dom-rtcdatachannel">RTCDataChannel</span>
<li><span class="dfn-paneled" id="term-for-dom-rtcdatachannelinit">RTCDataChannelInit</span>
Expand Down
2 changes: 1 addition & 1 deletion tests/github/whatwg/fetch/fetch.html
Original file line number Diff line number Diff line change
Expand Up @@ -8662,7 +8662,7 @@ <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span cla
<li><span class="dfn-paneled" id="term-for-utf-8-encode">utf-8 encode</span>
</ul>
<li>
<a data-link-type="biblio">[FETCH-METADATA]</a> defines the following terms:
<a data-link-type="biblio">[webappsec-fetch-metadata-1]</a> defines the following terms:
<ul>
<li><span class="dfn-paneled" id="term-for-abstract-opdef-append-the-fetch-metadata-headers-for-a-request">append the Fetch metadata headers for a request</span>
</ul>
Expand Down

0 comments on commit b1c6bfa

Please sign in to comment.