Skip to content

Commit

Permalink
Allow linking to lower level in delta specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
fantasai committed Mar 26, 2021
1 parent 21986e3 commit 2054fbe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bikeshed/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def __init__(self):
self.defaultHighlight = None
self.defaultBiblioDisplay = "index"
self.defaultRefStatus = None
self.deltaSpec = False
self.displayShortname = None
self.editors = []
self.editorTerm = {"singular": "Editor", "plural": "Editors"}
Expand Down Expand Up @@ -1320,6 +1321,7 @@ def parseLiteralList(key, val, lineNum): # pylint: disable=unused-argument
"Default Ref Status": Metadata(
"Default Ref Status", "defaultRefStatus", joinValue, parseRefStatus
),
"Delta Spec": Metadata("Delta Spec", "deltaSpec", joinValue, parseBoolean),
"ED": Metadata("ED", "ED", joinValue, parseLiteral),
"Editor": Metadata("Editor", "editors", joinList, parseEditor),
"Editor Term": Metadata("Editor Term", "editorTerm", joinValue, parseEditorTerm),
Expand Down
18 changes: 18 additions & 0 deletions bikeshed/refs/ReferenceManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class ReferenceManager:
"foreignRefs",
"shortname",
"specLevel",
"isDelta",
"spec",
"testing",
]
Expand Down Expand Up @@ -236,6 +237,7 @@ def setSpecData(self, md):
self.shortname = md.shortname
self.specLevel = md.level
self.spec = md.vshortname
self.isDelta = md.deltaSpec

for term, defaults in md.linkDefaults.items():
for default in defaults:
Expand Down Expand Up @@ -506,6 +508,7 @@ def getRef(
export = True
else:
export = None

refs, failure = self.foreignRefs.queryRefs(
text=text,
linkType=linkType,
Expand All @@ -519,6 +522,21 @@ def getRef(
ignoreObsoletes=True,
)

if failure and self.isDelta:
refs, failure = self.foreignRefs.queryRefs(
text=text,
linkType=linkType,
spec=self.shortname,
status=status,
statusHint=statusHint,
linkFor=linkFor,
linkForHint=linkForHint,
explicitFor=explicitFor,
export=False,
ignoreObsoletes=True,
latestOnly=False,
)

if (
failure
and linkType in ("argument", "idl")
Expand Down

0 comments on commit 2054fbe

Please sign in to comment.