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:
ack committed 2026-09-12 18:11:48 +02:00
1 parent 760fda5470
commit 9b0d0d7897
34 files changed
+895 -394

No files matched your search

+37 -6
View File
@@ -147,6 +147,36 @@ static void font_command(const strings_t& words)
}
}
// The target for the Klammertext kdesc renders for its own output: the
// ansi target (plain text with type styles as escape sequences) when
// stdout is a terminal, the txt target otherwise. The COMMAND decides,
// because only it knows the stream -- the same per-stream rule Color
// follows for the listings, NO_COLOR included -- and the targets stay
// formats a writer names with -t.
static std::string text_target()
{
return color_enabled(std::cout) ? "ansi" : "txt";
}
void show_special_characters()
{
Machine M;
M.read(M.m_state.value("KLAMMERTEXT_HOME") + "/ref/ref.k");
M.read_string("@b Writing characters with diacritics and non-English characters @\n\n");
M.read_string("@diacritics_examples@");
M.read_string("@extended_latin_examples@");
M.read_string("@pinyin_examples@");
std::cout << "\n" << M.apply(text_target()) << "\n";
}
void show_unicode_examples()
{
Machine M;
M.read(M.m_state.value("KLAMMERTEXT_HOME") + "/ref/ref.k");
M.read_string("@unicode_examples@");
std::cout << "\n" << M.apply(text_target()) << "\n\n";
}
int main(int argc, char* argv[])
{
try {
@@ -189,13 +219,9 @@ int main(int argc, char* argv[])
args.describe();
}
if (p("c")) {
show_special_characters();
std::cout << "\n";
}
if (p("u")) {
unicode_examples();
show_unicode_examples();
}
if (p("argtypes")) {
@@ -292,12 +318,17 @@ int main(int argc, char* argv[])
}
}
strings_t own_klammers_only {};
if (!input_filenames.empty()) {
own_klammers_only = context_files;
}
if (p("c")) {
show_special_characters();
std::cout << "\n";
}
if (p("t")) {
std::cout << boldblack << "Targets\n" << black
<< M.m_targets.describe(2, true, own_klammers_only);