The ansi target, txt table styles, kdesc reference from ref/, typeface and table-width fixes (from dev fcec5e2e77ac)
Since the previous release: Machine::read_string() (the fs::path/std::string overload pair split); kdesc -c and -u rendered from the ref/ reflection klammerset; a fit column's tex width measured in TeX over every entry; @typeface resolving to the family its css declares (a store directory name now works in html) and hieroglyphs in @unicode_examples set in their typeface; the ansi target -- plain text with the type styles a terminal can show, identical to txt once the escape sequences are stripped -- with the txt @table carrying :header_style, :style and :hline; @block anchoring, @table spacing and the Image_quality state variable; and the rewritten doc/klammertext_for_llm.md.
This commit is contained in:
1 parent
760fda5470
commit
9b0d0d7897
34 files changed
+895
-394
No files matched your search
+8
-3
@@ -49,12 +49,16 @@ unchanged.
|
||||
@@b.k text : Use a bold weight of the current font for *text* @@
|
||||
@@b.html :: <b>*text*</b> @@
|
||||
@@b.tex :: \textbf{*text*} @@
|
||||
@@b.txt :: *text* @@
|
||||
# The txt bodies of @b, @i, @u and @ri emit STYLE MARKERS around the text
|
||||
# (phases.txt_style_marker), which the txt target strips and the ansi
|
||||
# target turns into escape sequences -- see the ansi target in
|
||||
# sks/target/target.k. "#-" glues the marker to the text.
|
||||
@@b.txt :: @eval phases.txt_style_marker("bold") @ #- *text* #- @eval phases.txt_style_marker("bold", False) @ @@
|
||||
|
||||
@@i.k text : Use an italic style of the current font for *text* @@
|
||||
@@i.html :: <i>*text*</i> @@
|
||||
@@i.tex :: \emph{*text*} @@ # \begin{emph}{*text*}\end{emph} @@
|
||||
@@i.txt :: *text* @@
|
||||
@@i.txt :: @eval phases.txt_style_marker("italic") @ #- *text* #- @eval phases.txt_style_marker("italic", False) @ @@
|
||||
|
||||
@@t.k text : Use the currently defined monospace font for *text* @@
|
||||
@@t.html :: <span class="tt">*text*</span> @@
|
||||
@@ -68,11 +72,12 @@ unchanged.
|
||||
|
||||
@@u.k text : Underline *text* in the current font @@
|
||||
@@u.tex :: \underline{\botstrut{2pt}*text*} @@
|
||||
@@u.txt :: @eval phases.txt_style_marker("underline") @ #- *text* #- @eval phases.txt_style_marker("underline", False) @ @@
|
||||
|
||||
@@ri.k text : Use a roman italic font for *text* (to override monospace environment) @@
|
||||
@@ri.html :: <span class="ritalic">*text*</span> @@
|
||||
@@ri.tex :: \textrm{\textit{*text*}} @@
|
||||
@@ri.txt :: *text* @@
|
||||
@@ri.txt :: @eval phases.txt_style_marker("italic") @ #- *text* #- @eval phases.txt_style_marker("italic", False) @ @@
|
||||
|
||||
@@ts.k scale.float | text : Resize *text* by *scale* @@
|
||||
# @@ts.tex :: {\scalefont{*scale*}\em *text*} @@
|
||||
|
||||
+19
-10
@@ -31,8 +31,12 @@ class Subsuper(klammer_base.Klammer_base):
|
||||
# this marker where the typeface is needed, and @document collects the
|
||||
# markers, resolves and localizes each typeface, declares it, and replaces
|
||||
# the marker with whatever inline switch the target needs (a font-switch
|
||||
# command for tex, nothing for html, which carries the family name in the
|
||||
# span's own style). Same shape as the __CAPTION__ markers.
|
||||
# command for tex; for html the marker sits IN the span's font-family value
|
||||
# and becomes the family name the store resolved the typeface to, which
|
||||
# is what the localized css declares -- the name as WRITTEN may be the
|
||||
# store's directory name, "noto-sans-egyptian-hieroglyphs", and a span
|
||||
# carrying that matched no @font-face until 2026-09-12). Same shape as
|
||||
# the __CAPTION__ markers.
|
||||
#
|
||||
# SYNC: typeface_marker_rgx in sks/document/document_class.h -- a C++/Python
|
||||
# pair, so the constant cannot be single-sourced the way a .k/.py pair can
|
||||
@@ -53,18 +57,23 @@ class Typeface(klammer_base.Klammer_base):
|
||||
# hieroglyphs, cuneiform -- and would resize them unpredictably.
|
||||
# The family name is quoted -- an unquoted digit-initial word
|
||||
# ("Source Sans 3") is invalid CSS -- with SINGLE quotes, because
|
||||
# this sits inside a double-quoted html attribute.
|
||||
style = (f"font-family: '{self.name}', serif; "
|
||||
f"font-size-adjust: none")
|
||||
# this sits inside a double-quoted html attribute. What is quoted
|
||||
# here is the MARKER: @document replaces it with the resolved
|
||||
# family name (see the marker note above).
|
||||
style = "', serif; font-size-adjust: none"
|
||||
if float(self.scale) != 1.0:
|
||||
style += f"; font-size: {float(self.scale)}em"
|
||||
# The STYLE is markup, so its typographically active characters are
|
||||
# hidden: the html target's transforms turn a single quote into a
|
||||
# curly one, which broke the css font-family value. The TEXT is
|
||||
# writer content and is deliberately left alone -- its quotes and
|
||||
# dashes should be transformed.
|
||||
return (typeface_marker(self.name, self.scale)
|
||||
+ f'<span style="{klammer_base.hide_typographic(style)}">'
|
||||
# curly one, which broke the css font-family value. The MARKER is
|
||||
# not hidden: a hyphen in the typeface name would become a KTESC
|
||||
# sequence, which on the :files path is still there when @document
|
||||
# looks for the marker. The TEXT is writer content and is
|
||||
# deliberately left alone -- its quotes and dashes should be
|
||||
# transformed.
|
||||
hide = klammer_base.hide_typographic
|
||||
return (f'<span style="{hide("font-family: " + chr(39))}'
|
||||
+ typeface_marker(self.name, self.scale) + hide(style) + '">'
|
||||
+ f'{self.text}</span>')
|
||||
|
||||
def tex(self):
|
||||
|
||||
Reference in new issue
Block a user