Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions template/CONTRIBUTING.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ shows it. The product card, the banners and the listing photos are copied from
upload. When it has expired, run the Build workflow on the tag again from the
Actions tab.

While `description.md` still has `FACTS-STRIP-URL` for the facts strip,
`description.html` leaves the strip out and the build prints a warning. Upload
`banners/facts-strip-2400x136.png` through DriverCentral's description editor
and put the URL it gives in its place.

Step 1 rewrites tracked files in place. Formatting covers `tools/*.py`, all Lua
under `drivers/`, `src/`, `test/`, `tools/` and `vendor/`, and every Markdown
file at the repo root, under `documentation/`, and under
Expand Down
3 changes: 3 additions & 0 deletions template/Makefile.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ docs-drivercentral: preprocess $(VENV_STAMP)
$(VENV_PY) tools/docs.py description \
resources/drivercentral/description.md dist/drivercentral/listing/description.html; \
fi
@if grep -q FACTS-STRIP-URL resources/drivercentral/description.md 2>/dev/null; then \
echo "::warning file=resources/drivercentral/description.md::The facts strip isn't uploaded to DriverCentral yet, so description.html has no facts strip. Upload banners/facts-strip-2400x136.png through the description editor and put its URL in place of FACTS-STRIP-URL."; \
fi
@cd resources/drivercentral 2>/dev/null || exit 0; \
for f in product-card-300x300.png banners/*.png photos/*.png; do \
[ -f "$$f" ] || continue; \
Expand Down
9 changes: 8 additions & 1 deletion template/tools/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,16 @@ def revisions(input_path: Path, output_path: Path) -> None:
output_path.write_text(html, encoding="utf-8")


_STRIP_PLACEHOLDER_RE = re.compile(
r'(?:<p>)?<img[^>]*src="FACTS-STRIP-URL"[^>]*>(?:</p>)?\n?'
)


def description(input_path: Path, output_path: Path) -> None:
md = input_path.read_text(encoding="utf-8")
output_path.write_text(_drivercentral_html(md), encoding="utf-8")
# Until the strip is uploaded, a paste shows no image rather than a broken one.
html = _STRIP_PLACEHOLDER_RE.sub("", _drivercentral_html(md))
output_path.write_text(html, encoding="utf-8")


def fmt(args: list[str]) -> int:
Expand Down
Loading