]> git.lyx.org Git - features.git/blobdiff - src/tex2lyx/text.cpp
Implement Hungarian quotation marks style (#12040)
[features.git] / src / tex2lyx / text.cpp
index bfa9bcd90853e81f523565a67fa4f14e6509cd7f..8d5ec7a0a7ebc69097bb7e91b9a2f5111486d145 100644 (file)
@@ -47,7 +47,7 @@ namespace lyx {
 
 namespace {
 
-void output_arguments(ostream &, Parser &, bool, bool, string, Context &,
+void output_arguments(ostream &, Parser &, bool, bool, const string &, Context &,
                       Layout::LaTeXArgMap const &);
 
 }
@@ -459,7 +459,7 @@ bool translate_len(string const & length, string & valstring, string & unit)
 
 /// If we have ambiguous quotation marks, make a smart guess
 /// based on main quote style
-string guessQuoteStyle(string in, bool const opening)
+string guessQuoteStyle(string const & in, bool const opening)
 {
        string res = in;
        if (prefixIs(in, "qr")) {// straight quote
@@ -481,6 +481,8 @@ string guessQuoteStyle(string in, bool const opening)
                        res = "brs";
                else if (preamble.quotesStyle() == "french")
                        res = "frs";
+               else if (preamble.quotesStyle() == "hungarian")
+                       res = "hrd";
                else if (preamble.quotesStyle() == "swedish")
                        res = opening ? "sld" : "srd";
        } else if (in == "els") {// `
@@ -502,6 +504,8 @@ string guessQuoteStyle(string in, bool const opening)
                        res = "fld";
                else if (preamble.quotesStyle() == "russian")
                        res = "rld";
+               else if (preamble.quotesStyle() == "hungarian")
+                       res = "hrs";
        } else if (in == "ald") {// <<
                if (preamble.quotesStyle() == "swiss")
                        res = "crd";
@@ -509,6 +513,8 @@ string guessQuoteStyle(string in, bool const opening)
                        res = "frd";
                else if (preamble.quotesStyle() == "russian")
                        res = "rrd";
+               else if (preamble.quotesStyle() == "hungarian")
+                       res = "hls";
        } else if (in == "ars") {// >
                if (preamble.quotesStyle() == "swiss")
                        res = "cls";
@@ -518,6 +524,8 @@ string guessQuoteStyle(string in, bool const opening)
        } else if (in == "gld") {// ,,
                if (preamble.quotesStyle() == "polish")
                        res = "pld";
+               else if (preamble.quotesStyle() == "hungarian")
+                       res = "hld";
                else if (preamble.quotesStyle() == "russian")
                        res = "rls";
        } else if (in == "gls") {// ,
@@ -528,7 +536,7 @@ string guessQuoteStyle(string in, bool const opening)
 }
 
 
-string const fromPolyglossiaEnvironment(string const s)
+string const fromPolyglossiaEnvironment(string const s)
 {
        // Since \arabic is taken by the LaTeX kernel,
        // the Arabic polyglossia environment is upcased
@@ -539,7 +547,7 @@ string const fromPolyglossiaEnvironment(string const s)
 }
 
 
-string uncapitalize(string const s)
+string uncapitalize(string const s)
 {
        docstring in = from_ascii(s);
        char_type t = lowercase(s[0]);
@@ -548,7 +556,7 @@ string uncapitalize(string const s)
 }
 
 
-bool isCapitalized(string const s)
+bool isCapitalized(string const s)
 {
        docstring in = from_ascii(s);
        char_type t = uppercase(s[0]);
@@ -686,7 +694,7 @@ pair<bool, string> convert_latexed_command_inset_arg(string s)
 
 /// try to convert \p s to a valid InsetCommand argument
 /// without trying to recode macros.
-string convert_literate_command_inset_arg(string s)
+string convert_literate_command_inset_arg(string const & s)
 {
        // LyX cannot handle newlines in a latex command
        return subst(s, "\n", " ");
@@ -789,7 +797,7 @@ void skip_spaces_braces(Parser & p, bool keepws = false)
 }
 
 
-void output_arguments(ostream & os, Parser & p, bool outer, bool need_layout, string const prefix,
+void output_arguments(ostream & os, Parser & p, bool outer, bool need_layout, string const prefix,
                       Context & context, Layout::LaTeXArgMap const & latexargs)
 {
        if (context.layout->latextype != LATEX_ITEM_ENVIRONMENT || !prefix.empty()) {
@@ -2536,7 +2544,7 @@ void get_cite_arguments(Parser & p, bool natbibOrder,
 }
 
 
-void copy_file(FileName const & src, string dstname)
+void copy_file(FileName const & src, string const & dstname)
 {
        if (!copyFiles())
                return;
@@ -5593,7 +5601,8 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                if (t.cs() == "newpage" ||
                    (t.cs() == "pagebreak" && !p.hasOpt()) ||
                    t.cs() == "clearpage" ||
-                   t.cs() == "cleardoublepage") {
+                   t.cs() == "cleardoublepage" ||
+                   t.cs() == "nopagebreak") {
                        context.check_layout(os);
                        begin_inset(os, "Newpage ");
                        os << t.cs();