#pragma once // https://jakubmarian.com/special-characters-diacritics-used-in-european-languages/ #include #include #include #include #include #include #include #include const std::regex unicode_re(R"(\^(([0-9A-Fa-f]{5})|([0-9A-Fa-f]{4})|([0-9A-Fa-f]))\^)"); const std::regex unicode_hide_re(R"(=([0-9A-Fa-f]{2})=)"); const std::regex hex2_re(R"(([0-9A-Fa-f]{2}))"); const std::regex hex4_re(R"(([0-9A-Fa-f]{4}))"); const std::regex hex5_re(R"(([0-9A-Fa-f]{5}))"); // The hide_special_characters vector was removed. The ^X mechanism for // Klammertext special characters is handled by the katomizer (type // katom_t::special) and the general KTESC escape mechanism for // target-specific characters. inline std::map diacritic_example_letter { {"'", "e"}, {"`", "a"}, {"h", "o"}, {"~", "n"}, {"\"", "u"}, {"c", "c"}, {"-", "o"}, {"b", "g"}, {"r", "a"}, {"d", "e"}, {"w", "s"}, {"a", "o"}}; inline std::map> diacritics { {"`", {"0300", "grave accent"}}, {"'", {"0301", "acute accent"}}, {"h", {"0302", "circumflex"}}, {"~", {"0303", "tilde"}}, {"-", {"0304", "macron"}}, {"\"", {"0308", "diaresis"}}, // {"v", {"0305", "vinculum"}}, {"b", {"0306", "breve"}}, {"d", {"0307", "dot above"}}, {"r", {"030A", "ring above"}}, {"w", {"030C", "wedge"}}, {"c", {"0327", "cedilla"}}, {"a", {"030B", "double acute accent"}}}; inline std::vector extended_latin_symbols = { "s", "i", "I", "t", "T", "e", "E", "o", "O", "d", "D", "ae", "AE", "oe", "OE" }; inline std::map> extended_latin { {"ae", {"00E6", "ae ligature"}}, {"AE", {"00C6", "ae ligature capital"}}, {"oe", {"0153", "oe ligature"}}, {"OE", {"0152", "oe ligature capital"}}, {"i", {"0131", "dotless i"}}, {"I", {"0130", "capital dotted i"}}, {"t", {"00FE", "thorn"}}, {"T", {"00DE", "thorn capital"}}, {"e", {"00F0", "eth"}}, {"E", {"00D0", "eth capital"}}, {"o", {"00F8", "o stroke"}}, {"O", {"00D8", "o stroke capital"}}, {"s", {"00DF", "Eszett"}}, {"d", {"0111", "d stroke"}}, {"D", {"0110", "d stroke capital"}}}; inline std::map> pinyin_tones { {"1", {"0304", "high"}}, {"2", {"0301", "rising"}}, {"3", {"030C", "falling-rising"}}, {"4", {"0300", "falling"}}}; inline bool is_tty() { return isatty(fileno(stdout)); } //const char* italic_on() { return tty() ? "\033[3m" : ""; } //const char* italic_off() { return tty() ? "\033[0m" : ""; } inline const std::string italic_on() { return is_tty() ? "\033[3m" : ""; } inline const std::string italic_off() { return is_tty() ? "\033[0m" : ""; } std::string encode(const std::string& s); void diacritics_examples(const std::string& kt_filename = ""); void extended_latin_examples(const std::string& kt_filename = ""); void pinyin_examples(const std::string& kt_filename = ""); void show_special_characters();