Width and height argtypes, kdesc --argtypes from ref/, txt @define/@left_right/@columns, kdiag --check value validation (from dev d6993110e9b3)
Also: the klammertext argtype (descriptions kept as source), txt table wrapping and :hpos/:offset, @c between ‹ ›, txt section headings, the ktext newline-only trim, capitalize(), and the argtype test suite. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
9b0d0d7897
commit
0ead40f272
39 files changed
+734
-158
No files matched your search
@@ -134,6 +134,29 @@ strings_t word_split(const std::string& s)
|
||||
return regex_split(s, std::regex("\\s+"));
|
||||
}
|
||||
|
||||
std::string capitalize(std::string s)
|
||||
{
|
||||
// The cast through unsigned char is what makes std::toupper safe on a
|
||||
// byte above 127 (negative as a char, and undefined behaviour to pass).
|
||||
if (!s.empty())
|
||||
s[0] = static_cast<char>(std::toupper(static_cast<unsigned char>(s[0])));
|
||||
return s;
|
||||
}
|
||||
|
||||
std::string unquote_punctuation(const std::string& s)
|
||||
{
|
||||
std::string result {};
|
||||
result.reserve(s.size());
|
||||
for (size_t i = 0; i < s.size(); i++) {
|
||||
if (s[i] == '^' && i + 1 < s.size() && std::ispunct(static_cast<unsigned char>(s[i + 1]))) {
|
||||
result += s[++i];
|
||||
} else {
|
||||
result += s[i];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string collapse_whitespace(const std::string& s)
|
||||
{
|
||||
std::string result {};
|
||||
|
||||
Reference in new issue
Block a user