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

+1 -42
View File
@@ -19,8 +19,7 @@ class Image(klammer_base.Klammer_base):
id = 0
def __init__(self, K, as_string=True, width=None):
super().__init__(K)
# pprint.pprint(self.__dict__)
# self.show()
# /dev/shm is a fast RAM-backed tmpfs on Linux; on macOS it does not
# exist, so fall back to the platform temp directory.
cache_dir = "/dev/shm"
@@ -47,22 +46,12 @@ class Image(klammer_base.Klammer_base):
def html(self):
img_dir = f"{self.K_output_dir}/{self.K_output_basename}/{self.Image_output_dir}"
# output_dir = self.K_output_dir or "."
# input_basename = self.__dict__.get("K_input_name", "")
# input_basename = "/" + input_basename if input_basename else ""
# img_dir = f"{output_dir}/{self.image_output_dir}{input_basename}"
#print("img_dir:", img_dir)
if not os.path.exists(img_dir):
os.makedirs(img_dir)
if not os.path.exists(f"{img_dir}/{os.path.basename(self.source)}"):
shutil.copy2(self.source, img_dir)
# width, scale_x, scale_y = kutil.parse_length(
# "html",
# self.width if self.width != "none" else self.image_default_width)
scale_x, scale_y = 1, 1 # Old
result = E("img")
@@ -72,9 +61,6 @@ class Image(klammer_base.Klammer_base):
filename = f"{self.Image_output_dir}/{os.path.basename(self.source)}"
result.attr("src", filename).attr("alt", os.path.basename(filename))
#if self.width:
# kutil.msg("rel: " + str(self.rel_fraction))
length, value, ltype = kutil.parse_width("html", self.width, self.rel_fraction)
if ltype == "w":
@@ -90,19 +76,6 @@ class Image(klammer_base.Klammer_base):
if self.border:
result.cls("image_border")
# print(result)
#result.attr("style", f"width: {width}")
# if width and width != "none":
# result.attr("style", f"width: {width}")
# if width == "none":
# if scale_x:
# result.attr("style", "width: 0px;")
# result.attr("scale-x", scale_x)
# elif scale_y:
# result.attr("style", "height: 0px;")
# result.attr("scale-y", scale_y)
if self.file_error:
self.caption += self.file_error_message
@@ -120,14 +93,7 @@ class Image(klammer_base.Klammer_base):
def tex(self):
# kutil.msg(f"number: {self.number}")
#selfsource, width, height = self.cache.get(self.K_target, self.basename)
source = os.path.abspath(self.source)
#if self.abswidth != 0:
# width = f"{self.abswidth}\\paperwidth"
#if self.caption or self.number:
# width = "\\textwidth"
#else:
width = kutil.parse_width("tex", self.width, self.rel_fraction)[0]
width = re.sub("px", "pt", width)
#result = f'\\includegraphics[width={width}]{{{source}}}'
@@ -138,8 +104,6 @@ class Image(klammer_base.Klammer_base):
result = latex_util.add_caption(
result, "Figure", self.number, self.caption, width,
self.hpos, self.caption_side, offset=self.offset)
#result, "Figure", self.number, self.caption, self.hpos, self.caption_side,
#self.width, self.caption_side_center, self.vmargin, self.caption_margin)
else:
result = f'\\includegraphics[width={width}]{{{source}}}'
result = latex_util.caption_wrapper(result, self.hpos, offset=self.offset)
@@ -150,8 +114,3 @@ class Image(klammer_base.Klammer_base):
# box material: it must sit in vertical mode or it is typeset beside
# any text it follows.
return latex_util.block(result)
# Better to cause an error; there's no good text substitute for an image
# def txt(self):
# return f"[Image: {self.basename}\nCaption: {self.caption}]"