Target coverage: a klammer states the targets it serves
kdesc gains --coverage, which reports for every klammer the set of targets it can render to, and — the point of it — which klammers' coverage cannot be derived and must therefore be declared. Three rules: coverage is DERIVED where the definitions determine it (a general body of klammer calls covers the intersection of what those klammers cover, by a greatest fixpoint after loading), DECLARED where the engine cannot interpret what decides it (an @eval body, whose targets are undecidable), and UNKNOWN where nothing is written — which never means "deliberately unavailable". Two new spellings in a definition's name. A comma-separated target list, "@@table.html,tex :: ...", gives one body several targets; it is surface syntax, expanded at registration, and each member goes through the redefinition rules on its own. And "@@date.* :: ..." writes the general target out, asserting that the klammer works for EVERY target including ones not yet defined — a stronger claim than a list of the targets defined today, and the one target declaration that could be mechanically falsified. The Standard Klammer Set was swept accordingly: it now has no general definitions at all, every klammer names the targets it serves, six use ".*", and tex and pdf are at zero undecided. kdesc's flags are reorganised on two rules: a flag reached for often gets a single letter (-k klammers, -t targets, -c characters, -i input), a more specialised topic a multi-letter name (--argtypes, --katoms, --rewrite, --optionsets, --coverage, --klammerset, --font); and -v says how much to show about PROCESSING, never what the RESULT contains — so the katom regex column is "--katoms full" and the coverage detail "--coverage all". NOTE: "-k" now lists klammers (optionally filtered by a name/description search); the katom table moved to "--katoms". Fixes carried along: an option written with no value crashed the command with SIGSEGV instead of reporting the mistake; two required positional arguments never parsed; kdesc and kdiag printed an error and exited 0; and definition diagnostics counted registrations rather than what was written, so one line could be reported as two definitions and then printed twice. Four new test suites: target_list, coverage, command_option, kdesc. (from dev 46f54080bd9a)
This commit is contained in:
@@ -25,11 +25,12 @@ vertical mode is a no-op.
|
||||
@@sp.html :: &^#160; @@
|
||||
@@sp.tex :: ~ @@
|
||||
|
||||
@@footnote.k s : Footnote (TBD) @@
|
||||
@@footnote :: [*s*] @@
|
||||
# TODO: Easy in LaTeX; how to handle in HTML and plain text?
|
||||
# @@footnote.k s : Footnote (TBD) @@
|
||||
# @@footnote :: [*s*] @@
|
||||
|
||||
@@indent.k s :w.int 3 :linebreak.bool false : Indented block @@
|
||||
@@indent :: @eval block.Indent(K) eval@ @@
|
||||
@@indent.html,tex,txt :: @eval block.Indent(K) eval@ @@
|
||||
|
||||
@@quote.k s :w.int 1 :source : Quotation block @@
|
||||
|
||||
@@ -40,18 +41,7 @@ vertical mode is a no-op.
|
||||
@@
|
||||
|
||||
@@quote.tex ::
|
||||
ANDY: QUOTE: *s*
|
||||
#[
|
||||
\hspace*{@{justify.length_mul("|margin|", 1, 'latex')}@}
|
||||
\begin{minipage}{\textwidth- @{justify.length_mul("|margin|", 2, 'latex')}@ }
|
||||
\raggedright
|
||||
|text|
|
||||
@? """|source|""" |?
|
||||
\vspace*{6pt}
|
||||
{\begin{spacing}{1.1}\footnotesize\raggedleft |source| \end{spacing}}
|
||||
?@
|
||||
\end{minipage}
|
||||
]#
|
||||
\quoteblock{*s*}{*source*}
|
||||
@@
|
||||
|
||||
@@quote.txt ::
|
||||
@@ -61,7 +51,7 @@ ANDY: QUOTE: *s*
|
||||
@@note.k s :label Note :color 1.0,1.0,0.9 :bordercolor 0.2,0.2,0.2 :level.int 0 :width
|
||||
: Rectangular block for a special note @@
|
||||
|
||||
@@note :: @eval block.Note(K) eval@ @@
|
||||
@@note.html,tex :: @eval block.Note(K) eval@ @@
|
||||
|
||||
@@center.k s : Center text @@
|
||||
|
||||
@@ -94,11 +84,6 @@ ANDY: QUOTE: *s*
|
||||
@@nl.tex :: \newline @@
|
||||
@@nl.txt :: \n @@
|
||||
|
||||
@@tnl.k : Table newline (deprecated; check) @@
|
||||
@@tnl.html :: <br> @@
|
||||
@@tnl.tex :: \\\\ @@
|
||||
@@tnl.txt :: \n @@
|
||||
|
||||
@@newpage.k : Start new page @@
|
||||
@@newpage.html :: @@
|
||||
@@newpage.tex :: \newpage @@
|
||||
@@ -128,7 +113,7 @@ only makes some vertical space. @@
|
||||
|
||||
|
||||
@@qa.k question | answer : Question and answer formatting @@
|
||||
@@qa ::
|
||||
@@qa.html,tex,txt ::
|
||||
@b Q: @ *question*
|
||||
|
||||
@b A: @ *answer*
|
||||
@@ -139,12 +124,13 @@ only makes some vertical space. @@
|
||||
@@block.k : to.coords | content :width.float .5 :point.coords 0.0 0.0
|
||||
: Absolute positioning of text block @@
|
||||
|
||||
@@block :: @eval block.Block(K) eval@ @@
|
||||
@@block.tex :: @eval block.Block(K) eval@ @@
|
||||
|
||||
@@lines.k s : Maintain line breaks @@
|
||||
@@lines :: @eval block.Lines(K) eval@ @@
|
||||
@@lines.html,tex,txt :: @eval block.Lines(K) eval@ @@
|
||||
|
||||
@@twocolumns.tex s :
|
||||
@@twocolumns.k s : Format *s* in two columns @@
|
||||
@@twocolumns.tex ::
|
||||
\begin{multicols}{2}
|
||||
*s*
|
||||
\end{multicols}
|
||||
|
||||
@@ -76,10 +76,6 @@ COLOR\\setlength{\\fboxsep}{8pt}
|
||||
class Block(klammer_base.Klammer_base):
|
||||
def __init__(self, K):
|
||||
super().__init__(K)
|
||||
#self.show()
|
||||
|
||||
def html(self):
|
||||
return ""
|
||||
|
||||
def tex(self):
|
||||
# NOT latex_util.block(): a textblock is absolutely positioned and
|
||||
@@ -110,10 +106,6 @@ class Lines(klammer_base.Klammer_base):
|
||||
|
||||
def tex(self):
|
||||
return "\\\\\n".join(self.lines) + "\n"
|
||||
result = ""
|
||||
for line in self.lines:
|
||||
if line:
|
||||
line += r" \\"
|
||||
result += line + "\n"
|
||||
result = re.sub(r"\\\\\n\n", "\n\n", result)
|
||||
return result
|
||||
|
||||
def txt(self):
|
||||
return self.lines
|
||||
|
||||
@@ -18,3 +18,10 @@
|
||||
|
||||
% No space if top of page:
|
||||
\newcommand{\topspace}[1]{\ifdim\pagetotal=0pt\else\vspace*{#1}\fi}
|
||||
|
||||
|
||||
% Quote (to be improved)
|
||||
\newcommand{\quoteblock}[2]{
|
||||
{\hspace*{24pt}\begin{minipage}{\textwidth - 48pt}
|
||||
#1
|
||||
\end{minipage}}}
|
||||
|
||||
@@ -6,15 +6,16 @@
|
||||
A source file displayed verbatim
|
||||
@@
|
||||
|
||||
@@code :: @eval code_block.Code(K) @ @@
|
||||
@@code.html,tex :: @eval code_block.Code(K) @ @@
|
||||
|
||||
@@c.k code_text :
|
||||
A word or phrase displayed verbatim in a line
|
||||
@@
|
||||
|
||||
@@c :: @eval code_block.Code_fragment(K) eval@
|
||||
@@c.html,tex :: @eval code_block.Code_fragment(K) eval@
|
||||
@@
|
||||
|
||||
# :cwd makes the filename resolve against the DOCUMENT's directory, not
|
||||
# the directory ktext happens to run in.
|
||||
@@source_file filename : @eval :cwd *K_input_dir* code_block.Source(K) @ @@
|
||||
@@source_file.k filename : Display the contents of the file verbatim. @@
|
||||
@@source_file.html,tex :: @eval :cwd *K_input_dir* code_block.Source(K) @ @@
|
||||
|
||||
@@ -5,4 +5,5 @@
|
||||
@@@
|
||||
|
||||
@@color.k rgb :text : Color description as required by the target from @c <r>,<g>,<b> @ input @@
|
||||
@@color :: @eval color.Color(K) eval@ @@
|
||||
|
||||
@@color.html,tex :: @eval color.Color(K) eval@ @@
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
order, separator, and padding: "6/16/1910" (en, month first),
|
||||
"16.06.1910" (de, day first, zero-padded per DIN 5008)
|
||||
@@
|
||||
@@date.html :: @eval date.date(K) eval@ @@
|
||||
@@date.tex :: @eval date.date(K) eval@ @@
|
||||
@@date.txt :: @eval date.date(K) eval@ @@
|
||||
|
||||
@@date.* :: @eval date.date(K) eval@ @@
|
||||
|
||||
@@datetime.k :days.int 0 :lang.language :number.bool false :
|
||||
Date and time formatted as "16 June 1910, 13:10" (^:lang de:
|
||||
@@ -17,21 +16,14 @@
|
||||
tomorrow, ^:days -1 is yesterday). ^:lang and ^:number select the
|
||||
language and the numeric form as for ^@date
|
||||
@@
|
||||
@@datetime.html :: @eval date.datetime(K) eval@ @@
|
||||
@@datetime.tex :: @eval date.datetime(K) eval@ @@
|
||||
@@datetime.txt :: @eval date.datetime(K) eval@ @@
|
||||
|
||||
@@datetime.* :: @eval date.datetime(K) eval@ @@
|
||||
|
||||
@@timestamp.k : Date and time formatted as "1910.06.16-12:34" @@
|
||||
@@timestamp :: @eval time.strftime("%Y.%m.%d-%H:%M") eval@ @@
|
||||
@@timestamp.* :: @eval time.strftime("%Y.%m.%d-%H:%M") eval@ @@
|
||||
|
||||
@@serialdate.k : Date formatted as "YYMMDD" @@
|
||||
@@serialdate :: @eval time.strftime("%y%m%d") eval@ @@
|
||||
@@serialdate.* :: @eval time.strftime("%y%m%d") eval@ @@
|
||||
|
||||
@@year.k : Current year formatted as "20XX" @@
|
||||
@@year :: @eval time.strftime("%Y") eval@ @@
|
||||
|
||||
#[
|
||||
@@@category date
|
||||
date datetime timestamp serialdate
|
||||
:desc Time and date formatting @@@
|
||||
]#
|
||||
@@year.* :: @eval time.strftime("%Y") eval@ @@
|
||||
|
||||
@@ -62,60 +62,4 @@
|
||||
: Top-level document structure
|
||||
@@
|
||||
|
||||
@@document :: @eval :cpp *KLAMMERTEXT_HOME*/sks/document/document document @ @@
|
||||
|
||||
# @link https://cdn.britannica.com/09/152309-050-5E0B2A42/Sahara-Morocco.jpg :text Niagara @
|
||||
|
||||
@@niagara :
|
||||
@link https://cdn.britannica.com/09/152309-050-5E0B2A42/Sahara-Morocco.jpg :text Niagra @
|
||||
@@
|
||||
|
||||
#[
|
||||
@@niagara.html :
|
||||
<a href="https://cdn.britannica.com/09/152309-050-5E0B2A42/Sahara-Morocco.jpg">Niagara</a>
|
||||
@@
|
||||
|
||||
@@niagara.tex :
|
||||
@link https://cdn.britannica.com/09/152309-050-5E0B2A42/Sahara-Morocco.jpg :text Niagra @
|
||||
@@
|
||||
]#
|
||||
|
||||
|
||||
# @@moby : Moby @@
|
||||
@@moby :
|
||||
But here is an artist. He desires to paint you the dreamiest,
|
||||
shadiest, quietest, most enchanting bit of romantic landscape in all
|
||||
the valley of the Saco. What is the chief element he employs? There
|
||||
stand his trees, each with a hollow trunk, as if a hermit and a
|
||||
crucifix were within; and here sleeps his meadow, and there sleep his
|
||||
cattle; and up from yonder cottage goes a sleepy smoke. Deep into
|
||||
distant woodlands winds a mazy way, reaching to overlapping spurs of
|
||||
mountains bathed in their hill-side blue. But though the picture lies
|
||||
thus tranced, and though this pine-tree shakes down its sighs like
|
||||
leaves upon this shepherd's head, yet all were vain, unless the
|
||||
shepherd's eye were fixed upon the magic stream before him. Go visit
|
||||
the Prairies in June, when for scores on scores of miles you wade
|
||||
knee-deep among Tiger-lilies---what is the one charm wanting? Water
|
||||
---there is not a drop of water there! Were @niagara@ but a cataract of
|
||||
sand, would you travel your thousand miles to see it?
|
||||
@@
|
||||
|
||||
@@smoby.html :
|
||||
Go visit the Prairies in June, when for scores on scores of miles you
|
||||
wade knee-deep among Tiger-lilies---what is the one charm wanting?
|
||||
Water --- there is not a drop of water there! Were @niagara@ but a
|
||||
cataract of sand, would you travel your thousand miles to see it?
|
||||
@@
|
||||
|
||||
@@smoby.tex :
|
||||
Go visit the Prairies in June, when for scores on scores of miles you
|
||||
wade knee-deep among Tiger-lilies---what is the one charm wanting?
|
||||
Water --- there is not a drop of water there! Were @niagara@ but a
|
||||
cataract of sand, would you travel your thousand miles to see it?
|
||||
@@
|
||||
|
||||
@@ssmoby :
|
||||
Go visit the Prairies in June, when for scores on scores of miles you
|
||||
wade knee-deep among Tiger-lilies---what is the one charm wanting?
|
||||
Water---there is not a drop of water there!
|
||||
@@
|
||||
@@document.html,tex :: @eval :cpp *KLAMMERTEXT_HOME*/sks/document/document document @ @@
|
||||
|
||||
@@ -58,35 +58,6 @@
|
||||
@@ri.tex :: \textrm{\textit{*text*}} @@
|
||||
@@ri.txt :: *text* @@
|
||||
|
||||
|
||||
#[
|
||||
@@small.k s :mode span : Smaller font size @@
|
||||
@@small.html :: < #- *mode* class="small"> #- *s* #- </ #- *mode* #- > @@
|
||||
@@small.tex :: {\small *s*} @@
|
||||
|
||||
@@large.k s :mode span : Larger font size @@
|
||||
@@large.html :: <*mode* class="large">*s*</*mode*> @@
|
||||
@@large.tex :: {\Large *s*} @@
|
||||
|
||||
@@rfont.k size | leading | text : Scaled roman font @@
|
||||
|
||||
@@rfont.tex ::
|
||||
%{\fontsize{*size*\basefontsize}{*leading* \basefontsize * \real{1.4}}\rmfamily
|
||||
{\fontsize{ *size* }{ *leading* * \real{1.4}}\rmfamily
|
||||
|
||||
*text*
|
||||
|
||||
}
|
||||
@@
|
||||
|
||||
@@sfont.k size | leading | text : Scaled sans-serif font @@
|
||||
@@sfont.tex ::
|
||||
{\fontsize{ *size* \basefontsize}{ *leading* \basefontsize * \real{1.4}}\sffamily
|
||||
*text*}
|
||||
@@
|
||||
]#
|
||||
|
||||
|
||||
@@ts.k scale.float | text : Resize *text* by *scale* @@
|
||||
# @@ts.tex :: {\scalefont{*scale*}\em *text*} @@
|
||||
@@ts.tex :: \scalefont{*scale*}{*text*} @@
|
||||
@@ -97,37 +68,32 @@
|
||||
#@@leading.tex :: \renewcommand{\baselinestretch}{*n*} @@
|
||||
@@leading.tex :: \setstretch{*n*} @@
|
||||
|
||||
# @@default_font : @font EB Garamond @ @@
|
||||
# @@default_font : @font Bitstream Charter @ @@
|
||||
@@default_font :
|
||||
@@default_font.k : Default font for documents @@
|
||||
@@default_font.tex ::
|
||||
# \setmainfont[Ligatures=TeX,Numbers=Lining]{Garamond Libre}
|
||||
\setmainfont{Garamond Libre}
|
||||
@@
|
||||
#[
|
||||
@font
|
||||
# Bitstream Charter
|
||||
# Liberation Serif
|
||||
EB Garamond
|
||||
@
|
||||
]#
|
||||
|
||||
@@cjk.k text : Switch to font that supports CJK for *text* @@
|
||||
@@cjk.html :: *cjk* @@
|
||||
@@cjk.tex :: { #- @font Noto Sans CJK SC @ *cjk* #- } @@
|
||||
@@cjk.txt :: *cjk* @@
|
||||
|
||||
@@fraktur.tex s : \textfrak{*s*} @@
|
||||
@@fraktur.k s : Set text *s* in Fraktur @@
|
||||
@@fraktur.tex :: \textfrak{*s*} @@
|
||||
|
||||
@@euro.html s : &^#x20AC;*s* @@
|
||||
@@euro.tex s : €\,*s* @@
|
||||
@@euro.k f : The Euro symbol, followed by the amount *f* @@
|
||||
@@euro.html :: &^#x20AC;*f* @@
|
||||
@@euro.tex,txt :: €\,*f* @@
|
||||
|
||||
@@math s :center.bool false : @i *s* @ @@ # xxx
|
||||
# TODO: This needs to use MathJax.
|
||||
# @@math s :center.bool false : @i *s* @ @@
|
||||
|
||||
@@sub.k base | script : Subscript: @sub x 2 @ @@
|
||||
@@sub :: @eval font.Subsuper(K, "sub") eval@ @@
|
||||
@@sub.html,tex :: @eval font.Subsuper(K, "sub") eval@ @@
|
||||
|
||||
@@sup.k base | script : Superscript: @sup x 2 @ @@
|
||||
@@sup :: @eval font.Subsuper(K, "sup") eval@ @@
|
||||
@@sup.html,tex :: @eval font.Subsuper(K, "sup") eval@ @@
|
||||
|
||||
@@copyright.k : Copyright symbol: © @@
|
||||
@@copyright.html :: © @@
|
||||
|
||||
@@ -39,7 +39,7 @@ for in the image search path and converted to a format the target can use.
|
||||
it there, and the caption arguments caption it.
|
||||
@@
|
||||
|
||||
@@image :: @eval image.Image(K) eval@ @@
|
||||
@@image.html,tex :: @eval image.Image(K) eval@ @@
|
||||
|
||||
@@image_grid.k
|
||||
image_specs.rest(2)
|
||||
@@ -56,6 +56,7 @@ it there, and the caption arguments caption it.
|
||||
: A grid of images
|
||||
@@
|
||||
|
||||
@@image_grid :: @eval image_grid.Image_grid(K) eval@ @@
|
||||
@@image_grid.html,tex :: @eval image_grid.Image_grid(K) eval@ @@
|
||||
|
||||
@@fig spec.figure_id : @reference *spec* | Figure @ @@
|
||||
@@fig.k spec.figure_id : The caption title for a figure @@
|
||||
@@fig.html,tex :: @reference *spec* | Figure @ @@
|
||||
|
||||
@@ -147,5 +147,6 @@ class Image(klammer_base.Klammer_base):
|
||||
return latex_util.block(result)
|
||||
|
||||
|
||||
def txt(self):
|
||||
return f"[Image: {self.basename}\nCaption: {self.caption}]"
|
||||
# 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}]"
|
||||
|
||||
@@ -172,9 +172,7 @@ other structures. The ^:offset is used only if the ^:hpos value is "left" or
|
||||
# Klammers
|
||||
|
||||
@@reference.k spec | name : Reference marker for captioned elements @@
|
||||
@@reference ::
|
||||
__REF__*spec*__*name*__
|
||||
@@
|
||||
@@reference.* :: __REF__*spec*__*name*__ @@
|
||||
|
||||
@@show.k s : Show the raw Klammertext and the result @@
|
||||
@@show :: @eval :cpp show show @ @@
|
||||
@@show.html,tex,txt :: @eval :cpp show show @ @@
|
||||
|
||||
@@ -1,79 +1,23 @@
|
||||
@@link target
|
||||
@@link.k target
|
||||
:text
|
||||
:footnote.bool false
|
||||
:section.bool false
|
||||
:nq.bool false
|
||||
:basename # xxx
|
||||
:basename # xxx -- Deprecated?
|
||||
:code # xxx
|
||||
:phrase # xxx
|
||||
:dox # xxx
|
||||
:doxanchor # xxx
|
||||
:id # xxx
|
||||
:
|
||||
@eval link.Link(K) eval@
|
||||
: Links within documents and to external URLs.
|
||||
@@
|
||||
|
||||
@@target id :text :
|
||||
@eval link.Target(K) eval@
|
||||
@@
|
||||
@@link.html,tex,txt :: @eval link.Link(K) eval@ @@
|
||||
|
||||
@@email name | domain :subject :body :
|
||||
@eval link.Email(K) eval@
|
||||
@@
|
||||
@@target.k id :text : A link target within a document @@
|
||||
|
||||
#[
|
||||
@@@category link
|
||||
target link
|
||||
:desc Links @@@
|
||||
@@target.html,tex :: @eval link.Target(K) eval@ @@
|
||||
|
||||
@@target.doc id :text :
|
||||
Link target in page is @i-name, with optional @i-text for target @@
|
||||
@@email.k name | domain :subject :body : An email with an mangled address for HTML @@
|
||||
|
||||
@@target : @eval link.target(K) eval@ @@
|
||||
|
||||
@@link.doc url
|
||||
:text
|
||||
:download.bool false
|
||||
:mail.bool false
|
||||
:nopage.bool false
|
||||
:section.bool false
|
||||
:pageonly.bool false
|
||||
:footnote.bool true
|
||||
:in_footnote.bool false
|
||||
:dox.bool false
|
||||
:abs.bool false
|
||||
:add_number.bool false
|
||||
:
|
||||
Link to @i-url using @i-text for display, or @i-url if @i-text is not
|
||||
specified. If :section is true, the @i-url is the text of a section
|
||||
title.
|
||||
@@
|
||||
|
||||
@@link : @eval link.link(K) eval@ @@
|
||||
|
||||
@@subpage kt_basename
|
||||
:pagetitle
|
||||
:sectiontitle
|
||||
:linktext
|
||||
:index
|
||||
:toc.bool true
|
||||
:logo
|
||||
:include
|
||||
:prevlink
|
||||
:nextlink
|
||||
:uplink
|
||||
:logo
|
||||
:top_level.int
|
||||
:href_base
|
||||
:search.bool false
|
||||
:
|
||||
@eval link.subpage(K) eval@ @@
|
||||
|
||||
@@subpages.html s :
|
||||
<!--toc-->
|
||||
*s*
|
||||
<!--toc-->
|
||||
@@
|
||||
|
||||
@@subpages.latex s : *s* @@
|
||||
]#
|
||||
@@email.html,tex :: @eval link.Email(K) eval@ @@
|
||||
|
||||
@@ -88,8 +88,9 @@ class Target(klammer_base.Klammer_base):
|
||||
#result += '\\label{{{}-label}}'.format(id)
|
||||
return result
|
||||
|
||||
def txt(self):
|
||||
return ""
|
||||
# Better to fail than return nothing; not possible to have a target in a text file.
|
||||
# def txt(self):
|
||||
# return ""
|
||||
|
||||
|
||||
class Email(klammer_base.Klammer_base):
|
||||
|
||||
@@ -4,62 +4,13 @@
|
||||
@@@
|
||||
|
||||
@@ul.k list_items.rest :cmp.bool false :bullet : Unordered list, with list elements preceeded by the *bullet* character. @@
|
||||
@@ul :: @eval list.List(K, "ul") eval@ @@
|
||||
@@ul.html,tex,txt :: @eval list.List(K, "ul") eval@ @@
|
||||
|
||||
@@ol.k list_items.rest :cmp.bool false :initial.int 1 : Ordered list, with numbered list elements. @@
|
||||
@@ol :: @eval list.List(K, "ol") eval@ @@
|
||||
@@ol.html,tex,txt :: @eval list.List(K, "ol") eval@ @@
|
||||
|
||||
@@define descriptions.rest(2) :font i : @eval list.Define(K) eval@ @@
|
||||
@@define.k descriptions.rest(2) :font i : A list of words or phrases and their definitions or descriptions @@
|
||||
@@define.html,tex :: @eval list.Define(K) eval@ @@
|
||||
|
||||
@@columns items :n.int 2 : @eval list.columns(K) eval@ @@
|
||||
##
|
||||
|
||||
#[
|
||||
@@@category list ul ulc ol li define item
|
||||
:desc Ordered and unordered lists; definitions of terms @@@
|
||||
]#
|
||||
|
||||
|
||||
#[
|
||||
@@describe descriptions.rest : @eval list.describe(K) eval@ @@
|
||||
@@entry item | description : @eval list.entry(K) eval@ @@
|
||||
]#
|
||||
|
||||
#[
|
||||
@@ul.doc list_items.rest :cmp.bool false :bullet square :itemsep :uncover.bool :indent.bool true :parsep 6pt :margin 8pt :in_define.bool : Unordered list @@
|
||||
@@ul : @eval list.ul(K) @ @@
|
||||
|
||||
@@ol.doc list_items.rest :cmp.bool false :itemsep :uncover.bool :parsep 6pt :margin 8pt :in_define.bool : Ordered list @@
|
||||
@@ol : @eval list.ol(K) @ @@
|
||||
|
||||
@@li.doc s :keep.bool : List item @@
|
||||
@@li : @eval list.li(K) @ @@
|
||||
|
||||
@@dfont :s : @eval list.dfont(K) @ @@
|
||||
|
||||
@@define.doc s :font r :uncover.bool : List of definitions @@
|
||||
|
||||
@@define : @eval list.define(K) @ @@
|
||||
|
||||
@@item.doc term desc :c.bool false :inlist.bool false : Definition of @i-term is @i-desc @@
|
||||
|
||||
@@item term desc :
|
||||
@eval list.definition_item(K) @
|
||||
@@
|
||||
|
||||
@@mli args.rest : @eval list.mli(K) @ @@
|
||||
|
||||
@@ncircle.latex n : \circled{*n*} @@
|
||||
|
||||
@@dblitem.latex a | b | desc :
|
||||
\item[\parbox{\linewidth}{*a* \\ *b*}]
|
||||
\leavevmode \\[-5pt]
|
||||
*desc*
|
||||
@@
|
||||
|
||||
@@dblitem.html a | b | desc :
|
||||
<dt>*a*<br>
|
||||
*b*</dt>
|
||||
<dd>*desc*</dd>
|
||||
@@
|
||||
]#
|
||||
@@columns.k items :n.int 2 : Create two or more columns from the text @@
|
||||
@@columns.tex :: @eval list.columns(K) eval@ @@
|
||||
|
||||
@@ -49,7 +49,6 @@ class List(klammer_base.Klammer_base):
|
||||
if not self.compressed:
|
||||
result += "\n"
|
||||
n += 1
|
||||
print(result)
|
||||
return result
|
||||
|
||||
|
||||
@@ -87,8 +86,9 @@ class Define(klammer_base.Klammer_base):
|
||||
result = f"\\begin{{description}}[labelindent=12pt,nosep,itemsep=6pt]\n{result}\n\\end{{description}}"
|
||||
return result
|
||||
|
||||
def txt(self):
|
||||
return "TXT DEFINITIONS"
|
||||
# Needs to be implemented:
|
||||
# def txt(self):
|
||||
# return "TXT DEFINITIONS"
|
||||
|
||||
|
||||
class Lines(klammer_base.Klammer_base):
|
||||
|
||||
@@ -2,53 +2,53 @@
|
||||
# the front and back matter of a book):
|
||||
|
||||
@@preface.k :id :name Preface : Preface text @@
|
||||
@@preface :: @eval section.Section(K, "preface") eval@ @@
|
||||
@@preface.html,tex :: @eval section.Section(K, "preface") eval@ @@
|
||||
|
||||
# Numbered section headings:
|
||||
|
||||
@@part.k title :id :name Part : Part heading @@
|
||||
@@part :: @eval section.Section(K, 0) eval@ @@
|
||||
@@part.html,tex :: @eval section.Section(K, 0) eval@ @@
|
||||
|
||||
@@s1.k title :id :n : Top level division, numbered @@
|
||||
@@s1 :: @eval section.Section(K, 1) eval@ @@
|
||||
@@s1.html,tex :: @eval section.Section(K, 1) eval@ @@
|
||||
|
||||
@@s2.k title :id :n : Second level division, numbered @@
|
||||
@@s2 :: @eval section.Section(K, 2) eval@ @@
|
||||
@@s2.html,tex :: @eval section.Section(K, 2) eval@ @@
|
||||
|
||||
@@s3.k title :id :n : Third level division, numbered @@
|
||||
@@s3 :: @eval section.Section(K, 3) eval@ @@
|
||||
@@s3.html,tex :: @eval section.Section(K, 3) eval@ @@
|
||||
|
||||
@@s4.k title :id :n : Fourth level division, numbered @@
|
||||
@@s4 :: @eval section.Section(K, 4) eval@ @@
|
||||
@@s4.html,tex :: @eval section.Section(K, 4) eval@ @@
|
||||
|
||||
@@s5.k title :id :n : Fifth level division, numbered @@
|
||||
@@s5 :: @eval section.Section(K, 5) eval@ @@
|
||||
@@s5.html,tex :: @eval section.Section(K, 5) eval@ @@
|
||||
|
||||
@@s6.k title :id :n : Sixth level division, numbered @@
|
||||
@@s6 :: @eval section.Section(K, 6) eval@ @@
|
||||
@@s6.html,tex :: @eval section.Section(K, 6) eval@ @@
|
||||
|
||||
@@s7.k title :id :n : Seventh level division, numbered @@
|
||||
@@s7 :: @eval section.Section(K, 7) eval@ @@
|
||||
@@s7.html,tex :: @eval section.Section(K, 7) eval@ @@
|
||||
|
||||
# Unnumbered section headings:
|
||||
|
||||
@@h1.k title :id :n : Top level division, unnumbered @@
|
||||
@@h1 :: @eval section.Section(K, 1, numbered=False) eval@ @@
|
||||
@@h1.html,tex :: @eval section.Section(K, 1, numbered=False) eval@ @@
|
||||
|
||||
@@h2.k title :id : Second level division, unnumbered @@
|
||||
@@h2 :: @eval section.Section(K, 2, numbered=False) eval@ @@
|
||||
@@h2.html,tex :: @eval section.Section(K, 2, numbered=False) eval@ @@
|
||||
|
||||
@@h3.k title :id : Third level division, unnumbered @@
|
||||
@@h3 :: @eval section.Section(K, 3, numbered=False) eval@ @@
|
||||
@@h3.html,tex :: @eval section.Section(K, 3, numbered=False) eval@ @@
|
||||
|
||||
@@h4.k title :id : Fourth level division, unnumbered @@
|
||||
@@h4 :: @eval section.Section(K, 4, numbered=False) eval@ @@
|
||||
@@h4.html,tex :: @eval section.Section(K, 4, numbered=False) eval@ @@
|
||||
|
||||
@@h5.k title :id : Fifth level division, unnumbered @@
|
||||
@@h5 :: @eval section.Section(K, 5, numbered=False) eval@ @@
|
||||
@@h5.html,tex :: @eval section.Section(K, 5, numbered=False) eval@ @@
|
||||
|
||||
@@h6.k title :id : Sixth level division, unnumbered @@
|
||||
@@h6 :: @eval section.Section(K, 6, numbered=False) eval@ @@
|
||||
@@h6.html,tex :: @eval section.Section(K, 6, numbered=False) eval@ @@
|
||||
|
||||
@@h7.k title :id : Seventh level division, unnumbered @@
|
||||
@@h7 :: @eval section.Section(K, 7, numbered=False) eval@ @@
|
||||
@@h7.html,tex :: @eval section.Section(K, 7, numbered=False) eval@ @@
|
||||
|
||||
@@ -72,5 +72,6 @@ class Section(klammer_base.Klammer_base):
|
||||
result = f"%__sectionlink__{id}__{self.title}__" + "\n" + result
|
||||
return result
|
||||
|
||||
def txt(self):
|
||||
return self.title
|
||||
# Need to implement the procedural numbering for the txt target
|
||||
# def txt(self):
|
||||
# return self.title
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
:files kutil/kutil.k target/target.k font/font.k section/section.k
|
||||
image/image.k code/code.k list/list.k link/link.k
|
||||
table/table.k date/date.k block/block.k color/color.k
|
||||
document/document.k book/book.k
|
||||
document/document.k
|
||||
@@@
|
||||
|
||||
@@ -191,7 +191,8 @@
|
||||
:pattern \s*([^^\s;]+\s+[^^\s;]+\s*(;\s*^|\s*$))+
|
||||
@@@
|
||||
|
||||
@@rowcolor.tex s : \colorrow{*s*} @@
|
||||
@@rowcolor.k c : Change the color of a table row to color *c* @@
|
||||
@@rowcolor.tex :: \colorrow{*s*} @@
|
||||
|
||||
@@table.k rows.rest(2)
|
||||
:id
|
||||
@@ -227,8 +228,7 @@ formats them, and ^:hpos and ^:offset place the whole table in the text
|
||||
column.
|
||||
@@
|
||||
|
||||
@@table :: @eval table.Table(K) eval@ @@
|
||||
@@table.html,tex :: @eval table.Table(K) eval@ @@
|
||||
|
||||
@@tbl spec.figure_id :
|
||||
@reference *spec* | Table @
|
||||
@@
|
||||
@@tbl.k spec.figure_id : The caption title for a table @@
|
||||
@@tbl.html,tex,txt :: @reference *spec* | Table @ @@
|
||||
|
||||
@@ -864,6 +864,7 @@ class Table(klammer_base.Klammer_base):
|
||||
# there, so the rule stays unconditional.)
|
||||
return latex_util.block(result)
|
||||
|
||||
def txt(self):
|
||||
return "Table in .txt format not implemented"
|
||||
# This should signal that it has not be implemented by not being defined.
|
||||
# def txt(self):
|
||||
# return "Table in .txt format not implemented"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user