1.0.2: converter searches no subfolders, safer filters, forms, links and watermark

A document at the root of a checkout of 68377 folders needed 56 minutes,
because the converter named the suite, the document folder and the build folder
with `//` in TEXINPUTS; it now names them without recursion and the same
document converts in 11.5 seconds. A file below the document no longer replaces
a package of TeX Live.

The security review of the pending changes found four defects, each fixed with
a test proven red against the old files and green against the new ones twice:
an HTML table read in an empty sandbox, so an iframe opens no address; form
labels written through the LaTeX writer, so they are set as text; the form
pattern scans a line once instead of quadratically; a kept build folder no
longer lays the links of an earlier drawing over a new one. The form tests
remove the PDF of an earlier run before each conversion.

Also carried: forms out of Markdown, link colours from the company, clickable
links in prose, HTML tables and SVG drawings, the watermark, and the further
changes of 1.0.1 and 1.0.2 in the CHANGELOG.

npm test: 1232 of 1232 checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Marc WäckerlinandClaude Opus 5.5 committed 2026-11-14 12:14:55 +01:00
1 parent adc58e19d7
commit d7aac52ac7
28 files changed
+3918 -137

No files matched your search

+23 -4
View File
@@ -23,6 +23,18 @@ def run(command, cwd=ROOT, environment=None):
encoding="utf-8", errors="replace")
def name_example_company():
"""The directory of the example company in the TEXINPUTS of every call.
The example company lies in examples/, outside the TeX tree, and the
converter searches no subfolder of this repository: a test of the converter
names that directory the way every company outside the TeX tree names its
own.
"""
os.environ["TEXINPUTS"] = os.pathsep.join(
[os.path.join(ROOT, "examples"), os.environ.get("TEXINPUTS", "")])
def searchpath(*directories):
return os.pathsep.join([directory + "//" for directory in
(ROOT,) + directories] + [""])
@@ -79,12 +91,19 @@ class Page:
"""One rendered page, as pixels, with the questions a layout test asks."""
def __init__(self, pdf, page=1, dpi=150):
# One file under one name, written fresh for every page. pdftoppm names
# a page after the number of digits of the LAST page of the document, so
# page 1 of a document of ten pages is `page-01` and of one of nine
# `page-1`; the name was guessed in that order, and the guess found the
# `page-1` an earlier test had left behind. Measured on 2026-10-05, when
# three pages of a fifteen-page fixture were read as the pixels of a
# document of two pages built before it.
stem = os.path.join(BUILD, "page")
name = stem + ".pgm"
if os.path.exists(name):
os.remove(name)
run(["pdftoppm", "-r", str(dpi), "-f", str(page), "-l", str(page),
"-gray", pdf, stem])
name = f"{stem}-{page}.pgm"
if not os.path.exists(name):
name = f"{stem}-{page:02d}.pgm"
"-gray", "-singlefile", pdf, stem])
with open(name, "rb") as handle:
data = handle.read()
fields, offset = [], 0