]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetQuotes.cpp
Typo
[features.git] / src / insets / InsetQuotes.cpp
index 5fe2939a7df6ed3e6f995c1bab6fa12b973abf25..19eb846baabc358107533a81cacb372c7fa8d557 100644 (file)
@@ -67,10 +67,11 @@ namespace {
  * r    <<russian>>  (,,inner quotation``)
  * j    [U+300C]cjk[U+300D]  ([U+300E]inner quotation[U+300F]) [CORNER BRACKETS]
  * k    [U+300A]cjkangle[U+300B]  ([U+3008]inner quotation[U+3009]) [ANGLE BRACKETS]
+ * h    ,,hungarian''   (>>inner quotation<<)
  * x    dynamic style (inherits document settings)
  */
 
-char const * const style_char = "esgpcaqbwfirjkx";
+char const * const style_char = "esgpcaqbwfirjkhx";
 char const * const side_char = "lr" ;
 char const * const level_char = "sd";
 
@@ -305,6 +306,13 @@ char_type InsetQuotesParams::getQuoteChar(QuoteStyle const & style, QuoteLevel c
                right_secondary = 0x3009; // RIGHT ANGLE BRACKET
                break;
        }
+       case QuoteStyle::Hungarian: {
+               left_primary =  0x201e; // ,,
+               right_primary = 0x201d; // ''
+               left_secondary = 0x00bb; // >>
+               right_secondary = 0x00ab; // <<
+               break;
+       }
        case QuoteStyle::Dynamic:
        default:
                // should not happen
@@ -631,11 +639,8 @@ InsetQuotes::InsetQuotes(Buffer * buf, char_type c, QuoteLevel level,
        bool dynamic = false;
        if (buf) {
                global_style_ = buf->masterBuffer()->params().quotes_style;
-               fontenc_ = buf->masterBuffer()->params().main_font_encoding();
                dynamic = buf->masterBuffer()->params().dynamic_quotes;
                fontspec_ = buf->masterBuffer()->params().useNonTeXFonts;
-       } else {
-               fontenc_ = "OT1";
        }
        if (style.empty())
                style_ = dynamic ? QuoteStyle::Dynamic : global_style_;
@@ -707,6 +712,8 @@ QuoteStyle InsetQuotes::getStyle(string const & s)
                qs = QuoteStyle::CJK;
        else if (s == "cjkangle")
                qs = QuoteStyle::CJKAngle;
+       else if (s == "hungarian")
+               qs = QuoteStyle::Hungarian;
        else if (s == "dynamic")
                qs = QuoteStyle::Dynamic;
 
@@ -844,7 +851,7 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const
        docstring qstr;
 
        // In pass-thru context, we output plain quotes
-       if (runparams.pass_thru)
+       if (runparams.pass_thru || runparams.find_effective())
                qstr = (level_ == QuoteLevel::Primary) ? from_ascii("\"") : from_ascii("'");
        else if (style == QuoteStyle::Plain && fontspec_) {
                // For XeTeX and LuaTeX,we need to disable mapping to get straight
@@ -881,7 +888,7 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const
                // Use internal commands in headings with hyperref
                // (ligatures not featured in PDF strings)
                qstr = quoteparams.getLaTeXQuote(quotechar, "int", rtl_);
-       } else if (fontenc_ == "T1"
+       } else if (runparams.main_fontenc == "T1"
                   && !runparams.local_font->language()->internalFontEncoding()) {
                // Quotation marks for T1 font encoding
                // (using ligatures)
@@ -895,7 +902,7 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const
 #else
        } else if ((!runparams.use_babel
 #endif
-                  || (fontenc_ != "T1" && fontenc_ != "OT1"))
+                  || (runparams.main_fontenc != "T1" && runparams.main_fontenc != "OT1"))
                   || runparams.isFullUnicode()) {
                // Standard quotation mark macros
                // These are also used by babel
@@ -935,11 +942,20 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const
 
 
 int InsetQuotes::plaintext(odocstringstream & os,
-        OutputParams const &, size_t) const
+        OutputParams const & op, size_t) const
 {
-       docstring const str = displayString();
-       os << str;
-       return str.size();
+       if (!op.find_effective()) {
+               docstring const str = displayString();
+               os << str;
+               return str.size();
+       }
+       else {
+               if (level_ == QuoteLevel::Primary)
+                       os << from_ascii("\"");
+               else
+                       os << from_ascii("'");
+               return 1;
+       }
 }
 
 
@@ -998,7 +1014,6 @@ void InsetQuotes::updateBuffer(ParIterator const & it, UpdateType /* utype*/, bo
        pass_thru_ = it.paragraph().isPassThru();
        context_lang_ = font.language()->code();
        internal_fontenc_ = font.language()->internalFontEncoding();
-       fontenc_ = bp.main_font_encoding();
        global_style_ = bp.quotes_style;
        fontspec_ = bp.useNonTeXFonts;
        rtl_ = font.isRightToLeft();
@@ -1018,7 +1033,8 @@ void InsetQuotes::validate(LaTeXFeatures & features) const
 #else
        if (!features.useBabel()
 #endif
-           && !features.runparams().isFullUnicode() && fontenc_ != "T1") {
+           && !features.runparams().isFullUnicode()
+           && features.runparams().main_fontenc != "T1") {
                switch (type) {
                case 0x201a:
                        features.require("quotesinglbase");
@@ -1055,7 +1071,7 @@ void InsetQuotes::validate(LaTeXFeatures & features) const
        case 0x0022: {
                if (features.runparams().isFullUnicode() && fontspec_)
                        features.require("textquotedblp");
-               else if (fontenc_ != "T1" || internal_fontenc_)
+               else if (features.runparams().main_fontenc != "T1" || internal_fontenc_)
                        features.require("textquotedbl");
                break;
        }