On 2016-12-15, Jürgen Spitzmüller wrote:

...
> OK, I removed that spacing in master. Let's see what happens.

Thank you.

How about the following patch that simplifies the code a bit by using the
same characters for text, docbook and html export?
Tested and works here.

With your recent work on macro termination, a similar unification could be
applied to LaTeX export (using latex_quote_noligatures generally).

Then, future extensions like adding new styles for straight and italean
quotes become a bit simpler.

frohe Adventsgrüße,
Günter


Exec: git 'diff' 'InsetQuotes.cpp' 2>&1
Dir: /usr/local/src/lyx/src/insets/

diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp
index 49bb00b..3244647 100644
--- a/src/insets/InsetQuotes.cpp
+++ b/src/insets/InsetQuotes.cpp
@@ -97,12 +97,6 @@ char const * const latex_quote_babel[2][5] = {
   { "\\glqq", "''", "``", "\\flqq", "\\frqq" }
 };
 
-char const * const html_quote[2][5] = {
-       { "‚",  "’", "‘",
-         "‹", "›" },
-  { "„", "”", "“", "«", "»" }
-};
-
 } // namespace anon
 
 
@@ -207,10 +201,11 @@ docstring InsetQuotes::displayString() const
        docstring retdisp = docstring(1, display_quote_char[times_][index]);
 
        // in French, thin spaces are added inside double guillemets
-       // FIXME: this should be done by a separate quote type.
+       // FIXME: should this be done by a separate quote type?
        if (prefixIs(context_lang_, "fr")
            && times_ == DoubleQuotes && language_ == FrenchQuotes) {
-               // THIN SPACE (U+2009)
+               // FIXME: also for single quotes (like LuaTeX)
+               // FIXME: THIN SPACE (U+2009) or narrow no-break space (U+202F)
                char_type const thin_space = 0x2009;
                if (side_ == LeftQuote)
                        retdisp += thin_space;
@@ -325,7 +320,7 @@ void InsetQuotes::latex(otexstream & os, OutputParams const 
& runparams) const
 }
 
 
-int InsetQuotes::plaintext(odocstringstream & os, 
+int InsetQuotes::plaintext(odocstringstream & os,
         OutputParams const &, size_t) const
 {
        docstring const str = displayString();
@@ -334,34 +329,16 @@ int InsetQuotes::plaintext(odocstringstream & os,
 }
 
 
-docstring InsetQuotes::getQuoteEntity() const {
-       const int quoteind = quote_index[side_][language_];
-       docstring res = from_ascii(html_quote[times_][quoteind]);
-       // in French, thin spaces are added inside double guillemets
-       // FIXME: this should be done by a separate quote type.
-       if (prefixIs(context_lang_, "fr")
-           && times_ == DoubleQuotes && language_ == FrenchQuotes) {
-               // THIN SPACE (U+2009)
-               docstring const thin_space = from_ascii(" ");
-               if (side_ == LeftQuote)
-                       res += thin_space;
-               else
-                       res = thin_space + res;
-       }
-       return res;
-}
-
-
 int InsetQuotes::docbook(odocstream & os, OutputParams const &) const
 {
-       os << getQuoteEntity();
+       os << displayString();
        return 0;
 }
 
 
 docstring InsetQuotes::xhtml(XHTMLStream & xs, OutputParams const &) const
 {
-       xs << XHTMLStream::ESCAPE_NONE << getQuoteEntity();
+       xs << XHTMLStream::ESCAPE_NONE << displayString();
        return docstring();
 }
 

Reply via email to