}
-docstring InsetQuotesParams::getHTMLQuote(char_type c) const
-{
- string res;
-
- switch (c){
- case 0x201a: // ,
- res = "‚";
- break;
- case 0x2019: // '
- res = "’";
- break;
- case 0x2018: // `
- res = "‘";
- break;
- case 0x2039: // <
- res = "‹";
- break;
- case 0x203a: // >
- res = "›";
- break;
- case 0x0027: // ' (plain)
- res = "'";
- break;
- case 0x201e: // ,,
- res = "„";
- break;
- case 0x201d: // ''
- res = "”";
- break;
- case 0x201c: // ``
- res = "“";
- break;
- case 0x00ab: // <<
- res = "«";
- break;
- case 0x00bb: // >>
- res = "»";
- break;
- case 0x0022: // "
- res = """;
- break;
- case 0x300c: // LEFT CORNER BRACKET
- res = "「";
- break;
- case 0x300d: // RIGHT CORNER BRACKET
- res = "」";
- break;
- case 0x300e: // LEFT WHITE CORNER BRACKET
- res = "『";
- break;
- case 0x300f: // RIGHT WHITE CORNER BRACKET
- res = "』";
- break;
- case 0x300a: // LEFT DOUBLE ANGLE BRACKET
- res = "《";
- break;
- case 0x300b: // RIGHT DOUBLE ANGLE BRACKET
- res = "》";
- break;
- case 0x3008: // LEFT ANGLE BRACKET
- res = "〈";
- break;
- case 0x3009: // RIGHT ANGLE BRACKET
- res = "〉";
- break;
- default:
- break;
- }
-
- return from_ascii(res);
-}
-
-
docstring InsetQuotesParams::getXMLQuote(char_type c) const
{
// Directly output the character Unicode form.
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
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;
+ }
}
-docstring InsetQuotes::getQuoteEntity(bool isHTML) const {
+docstring InsetQuotes::getQuoteXMLEntity() const {
QuoteStyle style =
(style_ == QuoteStyle::Dynamic) ? global_style_ : style_;
- docstring res = isHTML ? quoteparams.getHTMLQuote(quoteparams.getQuoteChar(style, level_, side_)) :
- quoteparams.getXMLQuote(quoteparams.getQuoteChar(style, level_, side_));
+ docstring res = quoteparams.getXMLQuote(quoteparams.getQuoteChar(style, level_, side_));
// in French, thin spaces are added inside double guillemets
if (prefixIs(context_lang_, "fr")
void InsetQuotes::docbook(XMLStream & xs, OutputParams const &) const
{
- xs << XMLStream::ESCAPE_NONE << getQuoteEntity(false);
+ xs << XMLStream::ESCAPE_NONE << getQuoteXMLEntity();
}
docstring InsetQuotes::xhtml(XMLStream & xs, OutputParams const &) const
{
- xs << XMLStream::ESCAPE_NONE << getQuoteEntity(true);
+ xs << XMLStream::ESCAPE_NONE << getQuoteXMLEntity();
return docstring();
}
return "context-quote";
}
+
+pair<int, int> InsetQuotes::isWords() const
+{
+ int length = 1;
+ // In PassThru, we use straight quotes otherwise we need to check for French
+ if (!pass_thru_) {
+
+ QuoteStyle style = (style_ == QuoteStyle::Dynamic) ? global_style_ : style_;
+
+ // in French, thin spaces are added inside double guillemets
+ if (level_ == QuoteLevel::Primary
+ && (style == QuoteStyle::Swiss
+ || style == QuoteStyle::French
+ || style == QuoteStyle::FrenchIN)
+ && prefixIs(context_lang_, "fr")) {
+ // space added by default for all formats
+ length++;
+ }
+ }
+
+ //one or two characters from the statistics perspective
+ return std::pair<int,int>(length, 0);
+}
+
} // namespace lyx