Skip to content

Commit

Permalink
Merge pull request #1011 from googlefonts/push-desc-fix
Browse files Browse the repository at this point in the history
push: allow description files to be optional
  • Loading branch information
m4rc1e authored Aug 2, 2024
2 parents b1aa951 + 3bda2d7 commit 3ce7b4d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Lib/gftools/push/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ class FamilyMeta(Itemer):
def from_fp(cls, fp: Path):
meta_fp = fp / "METADATA.pb"
data = ReadProto(FamilyProto(), meta_fp)
description = open(fp / "DESCRIPTION.en_us.html", encoding="utf8").read()
stroke = (
data.category[0]
if not data.stroke
Expand All @@ -168,6 +167,12 @@ def from_fp(cls, fp: Path):
article = parse_html(open(article_fp, encoding="utf-8").read())
else:
article = None

description_fp = fp / "DESCRIPTION.en_us.html"
if description_fp.exists():
description = parse_html(open(description_fp, encoding="utf8").read())
else:
description = None
return cls(
name=data.name,
designer=data.designer.split(", "),
Expand All @@ -176,7 +181,7 @@ def from_fp(cls, fp: Path):
subsets=sorted([s for s in data.subsets if s != "menu"]),
stroke=stroke,
classifications=[c.lower() for c in data.classifications],
description=None if article else parse_html(description),
description=description,
primary_script=None if data.primary_script == "" else data.primary_script,
article=article,
minisite_url=None if data.minisite_url == "" else data.minisite_url,
Expand Down

0 comments on commit 3ce7b4d

Please sign in to comment.