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

@@ -29,7 +29,7 @@ std::ostream& operator<<(std::ostream& os, const numbered_elements& line_states)
return os;
}
std::string add_latex_caption_numbers(std::string latex_text)
std::string add_latex_caption_numbers(const std::string& latex_text)
{
std::string caption_delimiter { "__CAPTION__" }; // But also in kutil.py
std::regex caption_delimiter_rgx(caption_delimiter);
@@ -74,7 +74,7 @@ std::string add_latex_caption_numbers(std::string latex_text)
return result;
}
numbered_elements latex_line_states(std::vector<std::string> lines)
numbered_elements latex_line_states(const std::vector<std::string>& lines)
{
// \hypertarget{Reference-Figure-0}{}\label{Label-Reference-Figure-0}
std::regex element_container_rgx(BS + R"(hypertarget\{(Reference-(\w+)-\d+)\}.*)");
@@ -96,9 +96,9 @@ numbered_elements latex_line_states(std::vector<std::string> lines)
return states;
}
std::string find_target(std::string target,
std::vector<std::string>& lines, int start, numbered_elements states,
std::string target_type, int target_count, std::string direction)
std::string find_target(const std::string& target,
const std::vector<std::string>& lines, int start, const numbered_elements& states,
const std::string& target_type, int target_count, const std::string& direction)
{
// msg() << "find_target: " << target_type << " target_count: " << target_count
// << " direction: " << direction << "\n";
@@ -137,7 +137,7 @@ std::string find_target(std::string target,
}
std::string resolve_caption_references(
std::string target, std::vector<std::string> lines, numbered_elements states)
const std::string& target, const std::vector<std::string>& lines, numbered_elements states)
{
//auto lines = regex_split(text, std::regex(R"(\n)"), false);
// numbered_elements states = line_states(lines);