Verbatim-safe typography, ^-punctuation quoting, full-range ^UUUU^, polyglot html

Typographic transforms (---, quote pairs, ~) no longer touch verbatim
text: @c/@code/@source_listing content and ^'...'^ spans show exactly the
characters written. "^" before any punctuation character quotes it in
every target (the apostrophe excepted: ^' opens a literal span), with the
new :resolve option on @@@target declaring per-target renderings. The
^UUUU^ code-point form accepts 4-6 hex digits, the full Unicode range.
The html output and transform spellings are polyglot (XML-valid), in
preparation for an EPUB target. New suites: transform_test, character_test
(engine), typography_test (SKS).

(from dev 07ce5ea86a0a)
This commit is contained in:
2026-08-23 20:48:26 +02:00
parent d982c0d6cc
commit 37b6ba1c4f
77 changed files with 1665 additions and 1608 deletions

View File

@@ -86,10 +86,10 @@ Parameter parse_positional_parameter(const katom_list& katoms, const Argtype_reg
{
// (void)K::log(3, katoms);
if (katoms.size() > 1) {
throw Argument_error("Multiple katoms for positional argument: " +
throw Argument_error("Multiple katoms for positional argument:\n " +
as_string(katoms.begin(), katoms.end(), true) +
"\nPositional arguments are separated by the bar (|) character.",
katoms[0].m_loc, false);
katoms[0].m_loc);
}
Katom k = katoms[0];
std::string name = k.m_text;
@@ -367,7 +367,7 @@ void Parameter_set::check_positional(const katom_lists& positional_arguments, co
ss << " " << arg.m_name << "\n";
}
//std::cout << ss.str();
throw Argument_error(ss.str(), loc, false);
throw Argument_error(ss.str(), loc);
} else if (positional_count < given_count) {
//std::cout << "DESCRIBE\n";
//describe_parameters();
@@ -391,7 +391,7 @@ Parameter_set::check_optional(const katom_lists& optional_arguments, const Locat
}
if (std::ranges::count(optional_names_used, name) > 0) {
throw Argument_error("Optional argument \":" + name + "\" already provided "
+ "with a value of:\n" + values[name], loc, false);
+ "with a value of:\n" + values[name], loc);
}
katom_list value_katoms(opt.begin()+1, opt.end());
std::string value = trim(to_string(value_katoms));
@@ -477,9 +477,12 @@ void Parameter_set::validate(
std::stringstream ss {};
ss << "The value \"" << value << "\" given for the argument \""
<< parameter.m_name << "\" does not match the \"" << argtype.m_name
<< "\" argument type:\n\n"
<< trim(argtype.m_desc) << "\n";
throw Argument_error(ss.str(), loc, false);
<< "\" argument type.\n\nThe \"" << argtype.m_name << "\" argument type describes "
// A .k description is prose: collapse its source layout (line
// breaks, continuation indentation) so it re-flows with the
// sentence -- indented .k lines would otherwise read as verbatim.
<< collapse_whitespace(argtype.m_desc) << "\n";
throw Argument_error(ss.str(), loc);
}
}
@@ -520,7 +523,7 @@ std::string replace_arguments(
}
ss << "To prevent the \"*\" character from specifying an argument, "
<< "precede it with the \"^\" character.";
throw Argument_error(ss.str(), loc, false);
throw Argument_error(ss.str(), loc);
}
return result;
}