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 Oct 30, 2020
1 parent adf8655 commit a8be542
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions bikeshed/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,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 @@ -1068,6 +1069,7 @@ def parseLiteralList(key, val, lineNum):
"Default Biblio Status": Metadata("Default Biblio Status", "defaultRefStatus", joinValue, parseRefStatus), #synonym of "Default Ref Status"
"Default Highlight": Metadata("Default Highlight", "defaultHighlight", joinValue, parseLiteral),
"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
6 changes: 5 additions & 1 deletion bikeshed/refs/ReferenceManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ReferenceManager(object):

__slots__ = ["dataFile", "specs", "defaultSpecs", "ignoredSpecs", "replacedSpecs", "biblios", "loadedBiblioGroups",
"biblioKeys", "biblioNumericSuffixes", "preferredBiblioNames", "headings", "defaultStatus", "localRefs", "anchorBlockRefs", "foreignRefs",
"shortname", "specLevel", "spec", "testing"]
"shortname", "specLevel", "spec", "testing", "isDelta"]

def __init__(self, defaultStatus=None, fileRequester=None, testing=False):
if fileRequester is None:
Expand Down Expand Up @@ -176,6 +176,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 @@ -364,6 +365,9 @@ def getRef(self, linkType, text, spec=None, status=None, statusHint=None, linkFo
export = None
refs, failure = self.foreignRefs.queryRefs(text=text, linkType=linkType, spec=spec, status=status, statusHint=statusHint, linkFor=linkFor, linkForHint=linkForHint, explicitFor=explicitFor, export=export, 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") and linkFor is not None and any(x.endswith("()") for x in linkFor):
# foo()/bar failed, because foo() is technically the wrong signature
# let's see if we can find the right signature, and it's unambiguous
Expand Down

0 comments on commit a8be542

Please sign in to comment.