Klammerset: the @@@klammerset construct, its search path, and const correctness

The @@@klammerset system command formally declares a klammerset — a
named, logically related group of klammer definitions — with an
operative, idempotent declaration (:requires and :files load in order
at the declaration point, relative to the declaring file). A bare
symbol given to ktext -k, kdesc --input, or :requires resolves to
x/x.k on the search path: the document's directory, then
KLAMMERTEXT_KLAMMERSETS, then KLAMMERTEXT_HOME; kdesc --klammerset
lists the available sets. sks/sks.k is the first declared klammerset,
so `-k sks` loads the SKS by name. The engine's lookup classes were
renamed *_set → *_registry to keep the two concepts apart, and the
whole C++ tree now follows standard const-correctness conventions.
tst/ gains klammerset_test.sh (18 cases).

(from dev 64b1abf23e56)
This commit is contained in:
2026-07-30 23:50:07 +02:00
parent c42981f7e2
commit ef77f03584
83 changed files with 1429 additions and 594 deletions

View File

@@ -33,7 +33,7 @@ namespace latex {
std::string title_line(
std::string text, std::string font="1.3", std::string vskip="4pt",
const std::string& text, const std::string& font="1.3", const std::string& vskip="4pt",
bool vskip_if_missing=false)
{
std::stringstream ss {};
@@ -48,8 +48,8 @@ namespace latex {
}
std::string default_cover(
std::string title, std::string subtitle,
std::string author, std::string date, std::string version)
const std::string& title, const std::string& subtitle,
const std::string& author, const std::string& date, const std::string& version)
{
std::string test = trim(title + subtitle + author + date + version);
std::stringstream ss {};
@@ -65,8 +65,8 @@ namespace latex {
}
std::string nonbook_title(
std::string title, std::string subtitle,
std::string author, std::string date, std::string version)
const std::string& title, const std::string& subtitle,
const std::string& author, const std::string& date, const std::string& version)
{
std::string test = trim(title + subtitle + author + date + version);
std::stringstream ss {};
@@ -86,7 +86,7 @@ namespace latex {
return ss.str();
}
std::string pagenumber(int n, std::string style="arabic")
std::string pagenumber(int n, const std::string& style="arabic")
{
(void)K::log(3);
std::stringstream ss {};
@@ -94,7 +94,7 @@ namespace latex {
return ss.str();
}
std::string book_verso_page(std::string copyright)
std::string book_verso_page(const std::string& copyright)
{
(void)K::log(3);
std::stringstream ss {};
@@ -111,7 +111,7 @@ namespace latex {
return ss.str();
}
std::string font_command(std::string command, const Resolved_font& font, float scale)
std::string font_command(const std::string& command, const Resolved_font& font, float scale)
{
std::stringstream ss {};
if (font.family_name.empty())
@@ -150,23 +150,23 @@ namespace latex {
return ss.str();
}
std::string page(std::string structure,
std::string title,
std::string subtitle,
std::string authors,
std::string date,
std::string version,
std::string copyright,
std::string bottom,
std::string prolog,
std::string paper_size,
std::string page(const std::string& structure,
const std::string& title,
const std::string& subtitle,
const std::string& authors,
const std::string& date,
const std::string& version,
const std::string& copyright,
const std::string& bottom,
const std::string& prolog,
const std::string& paper_size,
bool two_column,
float leading,
int pointsize,
bool ragged_right,
std::string cover,
const std::string& cover,
bool landscape,
std::string body,
const std::string& body,
Resolved_font serif_font,
Resolved_font sans_font,
Resolved_font mono_font,