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:
19
mac/target.h
19
mac/target.h
@@ -24,6 +24,7 @@ public:
|
||||
void transform(std::vector<Katom>& katoms) const;
|
||||
|
||||
void add_escapes(const std::string& escape_spec);
|
||||
void add_resolves(const std::string& resolve_spec);
|
||||
std::string escape_text(std::string text) const;
|
||||
std::string unescape_text(std::string text) const;
|
||||
std::string resolve_escapes(std::string text) const;
|
||||
@@ -40,6 +41,13 @@ public:
|
||||
Locator m_loc {};
|
||||
std::vector<std::pair<std::string, std::string>> m_transforms {};
|
||||
std::vector<std::pair<std::string, std::string>> m_escapes {};
|
||||
// Resolution-only entries (:resolve): how a QUOTED character renders in
|
||||
// this target. The resolve half of :escape without the escape half --
|
||||
// needed where the raw character must stay untouched in writer text
|
||||
// (tex cannot escape "-" without destroying the --- convention) but the
|
||||
// quoted character must not decode to its raw self (a decoded -- would
|
||||
// re-form TeX's dash ligature).
|
||||
std::vector<std::pair<std::string, std::string>> m_resolves {};
|
||||
// Argtype_registry m_argtypes {};
|
||||
|
||||
|
||||
@@ -60,3 +68,14 @@ std::string ktesc_resolve(std::string text);
|
||||
// sub-Machines and the @eval result read-back. Resolved by ktesc_resolve()
|
||||
// at final processing.
|
||||
std::string hide_structural_characters(const std::string& s);
|
||||
|
||||
// Replace each ^P pair in s -- "^" before any ASCII punctuation character
|
||||
// except "'" (which opens a ^'...'^ literal span) -- with the KTESC marker
|
||||
// of P: "^" before a punctuation character quotes it, uniformly, not only
|
||||
// the six Klammertext specials. A letter or digit is never special, so
|
||||
// ^<letter-or-digit> keeps its existing meanings (diacritics, mnemonics,
|
||||
// ^UUUU^ code points). Returns whether anything was replaced. Called from
|
||||
// hide_special_katoms() on writer-text katoms OUTSIDE definition and
|
||||
// @eval/@read/@cond spans -- code keeps its carets (grep '^-' must reach
|
||||
// the shell intact), the same skip set as the quoted-special hiding.
|
||||
bool hide_quoted_punctuation(std::string& s);
|
||||
|
||||
Reference in New Issue
Block a user