Skip to content

Commit

Permalink
Only set the LOGO macro if 'Logo' metadata is used, and correctly sea…
Browse files Browse the repository at this point in the history
…rch *all* macros for inclusion, not just custom ones.
  • Loading branch information
tabatkins committed Dec 1, 2021
1 parent 6cf9175 commit 31a2f03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions bikeshed/conditional.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import itertools
import re

from . import config
Expand Down Expand Up @@ -63,8 +64,8 @@ def evalConditions(doc, el, conditionString):
if cond["type"] == "status":
yield config.looselyMatch(cond["value"], doc.md.status)
elif cond["type"] == "text macro":
for k, _ in doc.md.customTextMacros:
if k == cond["value"]:
for k in doc.macros.keys():
if k.upper() == cond["value"]:
yield True
break
else:
Expand Down
5 changes: 3 additions & 2 deletions bikeshed/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def __init__(self):
self.lineNumbers = False
self.linkDefaults = defaultdict(list)
self.localBoilerplate = config.BoolSet(default=False)
self.logo = ""
self.logo = None
self.mailingList = None
self.mailingListArchives = None
self.markupShorthands = config.BoolSet(["css", "dfn", "biblio", "markup", "idl", "algorithm"])
Expand Down Expand Up @@ -323,7 +323,8 @@ def fillTextMacros(self, macros, doc):
macros["snapshotid"] = self.warning[2]
if self.warning and len(self.warning) >= 4:
macros["snapshoturl"] = self.warning[3]
macros["logo"] = self.logo
if self.logo:
macros["logo"] = self.logo
if self.repository:
macros["repository"] = self.repository.name
macros["repositoryurl"] = self.repository.url
Expand Down

0 comments on commit 31a2f03

Please sign in to comment.