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:
1 parent
0ead40f272
commit
63956c00e5
26 files changed
+437
-173
No files matched your search
+13
-8
@@ -1,6 +1,11 @@
|
||||
# Book-specific component headings (others possible to correspond to
|
||||
# the front and back matter of a book):
|
||||
|
||||
@@section_args.o :id :n.int -1 :
|
||||
Common arguments for section headings. If *n* is not the default, it is used
|
||||
as the section number.
|
||||
@@
|
||||
|
||||
@@preface.k :id :name Preface : Preface text @@
|
||||
@@preface.html,tex,txt :: @eval section.Section(K, "preface") eval@ @@
|
||||
|
||||
@@ -9,30 +14,30 @@
|
||||
@@part.k title :id :name Part : Part heading @@
|
||||
@@part.html,tex,txt :: @eval section.Section(K, 0) eval@ @@
|
||||
|
||||
@@s1.k title :id :n : Top level division, numbered @@
|
||||
@@s1.k title @section_args@ : Top level division, numbered @@
|
||||
@@s1.html,tex,txt :: @eval section.Section(K, 1) eval@ @@
|
||||
|
||||
@@s2.k title :id :n : Second level division, numbered @@
|
||||
@@s2.k title @section_args@ : Second level division, numbered @@
|
||||
@@s2.html,tex,txt :: @eval section.Section(K, 2) eval@ @@
|
||||
|
||||
@@s3.k title :id :n : Third level division, numbered @@
|
||||
@@s3.k title @section_args@ : Third level division, numbered @@
|
||||
@@s3.html,tex,txt :: @eval section.Section(K, 3) eval@ @@
|
||||
|
||||
@@s4.k title :id :n : Fourth level division, numbered @@
|
||||
@@s4.k title @section_args@ : Fourth level division, numbered @@
|
||||
@@s4.html,tex,txt :: @eval section.Section(K, 4) eval@ @@
|
||||
|
||||
@@s5.k title :id :n : Fifth level division, numbered @@
|
||||
@@s5.k title @section_args@ : Fifth level division, numbered @@
|
||||
@@s5.html,tex,txt :: @eval section.Section(K, 5) eval@ @@
|
||||
|
||||
@@s6.k title :id :n : Sixth level division, numbered @@
|
||||
@@s6.k title @section_args@ : Sixth level division, numbered @@
|
||||
@@s6.html,tex,txt :: @eval section.Section(K, 6) eval@ @@
|
||||
|
||||
@@s7.k title :id :n : Seventh level division, numbered @@
|
||||
@@s7.k title @section_args@ : Seventh level division, numbered @@
|
||||
@@s7.html,tex,txt :: @eval section.Section(K, 7) eval@ @@
|
||||
|
||||
# Unnumbered section headings:
|
||||
|
||||
@@h1.k title :id :n : Top level division, unnumbered @@
|
||||
@@h1.k title :id : Top level division, unnumbered @@
|
||||
@@h1.html,tex,txt :: @eval section.Section(K, 1, numbered=False) eval@ @@
|
||||
|
||||
@@h2.k title :id : Second level division, unnumbered @@
|
||||
|
||||
+17
-8
@@ -1,5 +1,6 @@
|
||||
import kutil
|
||||
import klammer_base
|
||||
import phases
|
||||
|
||||
NUMBER_VAR = "___NUM___"
|
||||
|
||||
@@ -48,7 +49,6 @@ class Section(klammer_base.Klammer_base):
|
||||
# names = "part chapter section subsection subsubsection paragraph subparagraph subsubparagraph subsubsubparagraph".split()
|
||||
names = "part sA sB sC sD sE".split()
|
||||
|
||||
#self.show()
|
||||
if self.id:
|
||||
id = self.id
|
||||
else:
|
||||
@@ -56,13 +56,8 @@ class Section(klammer_base.Klammer_base):
|
||||
Section.label_number += 1
|
||||
|
||||
result = ''
|
||||
if self.__dict__.get("n") and self.n:
|
||||
if getattr(self, "n", -1) > -1: # absent for @part and @h1..@h7
|
||||
result += f'\\setcounter{{chapter}}{{{int(self.n)-1}}}\n'
|
||||
#if self.id:
|
||||
# result +=
|
||||
#if self.level == 1:
|
||||
#result += '\\newpage\n\n'
|
||||
# result += '\\vspace*{24pt}'
|
||||
suffix = "" if self.numbered else "*"
|
||||
result += f'\\{names[self.level]}{suffix}{{{self.title}}}'
|
||||
result += f'\n\\hypertarget{{{id}}}{{}}'
|
||||
@@ -73,4 +68,18 @@ class Section(klammer_base.Klammer_base):
|
||||
return result
|
||||
|
||||
def txt(self):
|
||||
return f"@b {self.title} @"
|
||||
# The number is a marker phases.txt_insert_section_numbers resolves
|
||||
# -- to a number inside a @document, to nothing outside one -- so
|
||||
# the space after it is the marker's, not the title's. A preface
|
||||
# and an unnumbered heading carry no marker at all; a part carries
|
||||
# a level-0 marker and its name, as the html "Part" prefix.
|
||||
if self.preface:
|
||||
return f"@b {self.name} @"
|
||||
if not self.numbered:
|
||||
return f"@b {self.title} @"
|
||||
# :n comes from section_args, which @part and the @h headings do
|
||||
# not declare, so it is absent there rather than -1.
|
||||
marker = phases.txt_section_marker(self.level, getattr(self, "n", -1))
|
||||
if self.level == 0:
|
||||
return f"@b {marker} {self.name} {self.title} @"
|
||||
return f"@b {marker} {self.title} @"
|
||||
Reference in new issue
Block a user