txt section numbering, @typeface :middle/:lift and html scale, NewGardinerOmni, html :leading (from dev 9fa469dd74ed)

Section headings under txt are numbered inside a @document only; @typeface
gains :middle and :lift and its :scale now means the same in html and
pdf; NewGardinerOmni ships (OFL 1.1, Mark-Jan Nederhof) and @egyptian /
@chinese replace @cjk; @table :leading and :colsep reach html; kdesc
--typeface help names the flag; @document.txt is a Python class.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
ackandClaude Fable 5.1 committed 2026-09-18 20:02:44 +02:00
1 parent 0ead40f272
commit 63956c00e5
26 files changed
+437 -173

No files matched your search

+7 -2
View File
@@ -12,8 +12,13 @@ tr:first-child {
td {
/* padding-left: 1rem; */
padding: .1rem .5rem .2rem .5rem;
/* Vertical space is the table's line-height (:leading, set on the
<table> by table.py -- the html equivalent of \arraystretch), so no
vertical padding here: it was an html-only extra that kept rows
looser than the pdf's. Horizontal padding is :colsep, the same
value that becomes \tabcolsep; the fallback is for a table that
reaches this rule without the property. */
padding: 0 var(--colsep, 4pt);
vertical-align: top;
}
+20 -2
View File
@@ -575,6 +575,24 @@ class Table(klammer_base.Klammer_base):
# would wrap it as a stray <p> inside the table.
return E("colgroup").body(cols.strip(), newline=False).str(), layout, table_width
def html_style(self):
# :leading and :colsep under html (2026-09-18; both were tex-only).
# \arraystretch multiplies the row strut, which is \baselineskip,
# 1.2 times the font size -- so :leading L is a 1.2 L em row, and
# the html equivalent is that line-height on the table, inherited
# by every cell. The cells' vertical padding went with it
# (table.css): an html-only extra with no tex counterpart, which
# kept a :leading 1 table 0.3rem looser per row than its pdf.
# :colsep is a custom property the td rule reads for its horizontal
# padding (padding does not inherit); the flush-edge classes still
# zero the outer ones. Measured 2026-09-18: rows of :leading 1 and
# :leading 2 in the ratio 1:2 in both targets.
line_height = f"{1.2 * float(self.leading):.4g}"
# Hidden: the result is re-read and the html target's transforms
# would turn the property's "--" into an en dash (font.py's trap).
return klammer_base.hide_typographic(
f"line-height: {line_height}; --colsep: {self.colsep}")
def html(self):
result = ""
for row_i, row in enumerate(self.cells):
@@ -592,7 +610,7 @@ class Table(klammer_base.Klammer_base):
# algorithm), matching the tex \ratio division. The max-width
# cap goes on the caption wrapper when there is one (the table's
# own percentage would be circular in a shrink-to-fit wrapper).
result = E("table").body(result)
result = E("table").body(result).attr("style", self.html_style())
if self.number or self.caption:
result = html_util.add_caption(
result, "Table", self.number, self.caption,
@@ -605,7 +623,7 @@ class Table(klammer_base.Klammer_base):
result = html_util.hpos_container(result, self.hpos, self.offset).str()
return result
colgroup, layout, table_width = self.html_colgroup()
result = E("table").body(colgroup + result)
result = E("table").body(colgroup + result).attr("style", self.html_style())
if self.number or self.caption:
# The caption wrapper carries the width (a percentage on the
# shrink-to-fit wrapper itself would be circular) and the table