X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLayout.cpp;h=ec6e2dc5a5dfe760f5c931acea611e93f1635ddf;hb=8ea66efe16ad109a5c107716185fb82bbebca8c8;hp=cf4fc6bc9108021c2844676832d5379ca1aa6fdb;hpb=28d7db3b9f537691b521accb445c74b904a21589;p=lyx.git diff --git a/src/Layout.cpp b/src/Layout.cpp index cf4fc6bc91..ec6e2dc5a5 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -24,7 +24,6 @@ #include "support/lassert.h" #include "support/lstrings.h" #include "support/Messages.h" -#include "support/regex.h" #include "support/textutils.h" @@ -859,68 +858,6 @@ void Layout::readSpacing(Lexer & lex) } -namespace { - -docstring const i18npreamble(Language const * lang, Encoding const & enc, - docstring const & templ, bool const polyglossia, - bool const unicode) -{ - if (templ.empty()) - return templ; - - string preamble = polyglossia ? - subst(to_utf8(templ), "$$lang", lang->polyglossia()) : - subst(to_utf8(templ), "$$lang", lang->babel()); - -#ifdef TEX2LYX - // tex2lyx does not have getMessages() - LASSERT(false, /**/); - (void)enc; - (void)unicode; -#else - string const langenc = lang->encoding()->iconvName(); - string const texenc = lang->encoding()->latexName(); - string const bufenc = enc.iconvName(); - // First and second character of plane 15 (Private Use Area) - string const s1 = "\xf3\xb0\x80\x80"; // U+F0000 - string const s2 = "\xf3\xb0\x80\x81"; // U+F0001 - // FIXME UNICODE - // lyx::regex is not unicode-safe. - // Should use QRegExp or (boost::u32regex, but that requires ICU) - static regex const reg("_\\(([^\\)]+)\\)"); - smatch sub; - while (regex_search(preamble, sub, reg)) { - string const key = sub.str(1); - string translated = to_utf8(lang->translateLayout(key)); - if (!unicode && langenc != bufenc) - translated = "\\inputencoding{" + texenc + "}" - + s1 + langenc + s2 + translated - + s1 + bufenc + s2; - preamble = subst(preamble, sub.str(), translated); - } -#endif - return from_utf8(preamble); -} - -} - - -docstring const Layout::langpreamble(Language const * lang, - Encoding const & enc, bool const polyglossia, - bool const unicode) const -{ - return i18npreamble(lang, enc, langpreamble_, polyglossia, unicode); -} - - -docstring const Layout::babelpreamble(Language const * lang, - Encoding const & enc, bool const polyglossia, - bool const unicode) const -{ - return i18npreamble(lang, enc, babelpreamble_, polyglossia, unicode); -} - - string const & Layout::htmltag() const { if (htmltag_.empty())