]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetSpecialChar.cpp
Reduce caption hardcoding
[lyx.git] / src / insets / InsetSpecialChar.cpp
index 1fe6840df59f20cbe69af8a86b51dbf71d2dc84b..58df102dde2c4b5692e031249bb81b3dd7e99378 100644 (file)
@@ -239,12 +239,15 @@ void InsetSpecialChar::latex(otexstream & os,
 }
 
 
-int InsetSpecialChar::plaintext(odocstream & os, OutputParams const &) const
+int InsetSpecialChar::plaintext(odocstringstream & os,
+        OutputParams const &, size_t) const
 {
        switch (kind_) {
        case HYPHENATION:
-       case LIGATURE_BREAK:
                return 0;
+       case LIGATURE_BREAK:
+               os.put(0x200c);
+               return 1;
        case END_OF_SENTENCE:
                os << '.';
                return 1;
@@ -258,7 +261,7 @@ int InsetSpecialChar::plaintext(odocstream & os, OutputParams const &) const
                os << '/';
                return 1;
        case NOBREAKDASH:
-               os << '-';
+               os.put(0x2011);
                return 1;
        }
        return 0;
@@ -295,7 +298,9 @@ docstring InsetSpecialChar::xhtml(XHTMLStream & xs, OutputParams const &) const
 {
        switch (kind_) {
        case HYPHENATION:
+               break;
        case LIGATURE_BREAK:
+               xs << XHTMLStream::ESCAPE_NONE << "&#8204;";
                break;
        case END_OF_SENTENCE:
                xs << '.';
@@ -310,7 +315,7 @@ docstring InsetSpecialChar::xhtml(XHTMLStream & xs, OutputParams const &) const
                xs << XHTMLStream::ESCAPE_NONE << "&frasl;";
                break;
        case NOBREAKDASH:
-               xs << '-';
+               xs << XHTMLStream::ESCAPE_NONE << "&#8209;";
                break;
        }
        return docstring();
@@ -319,11 +324,21 @@ docstring InsetSpecialChar::xhtml(XHTMLStream & xs, OutputParams const &) const
 
 void InsetSpecialChar::toString(odocstream & os) const
 {
-       plaintext(os, OutputParams(0));
+       switch (kind_) {
+       case LIGATURE_BREAK:
+               // Do not output ZERO WIDTH NON JOINER here
+               // Spell checker would choke on it.
+               return;
+       default:
+               break;
+       }
+       odocstringstream ods;
+       plaintext(ods, OutputParams(0));
+       os << ods.str();
 }
 
 
-void InsetSpecialChar::forToc(docstring & os, size_t) const
+void InsetSpecialChar::forOutliner(docstring & os, size_t) const
 {
        odocstringstream ods;
        plaintext(ods, OutputParams(0));