X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetIPAMacro.cpp;h=4e8afcfa7ecac8384f60063beb82bbe691918f52;hb=8ae0841826d90b8cdee1922f91fd6ccc5009f5ef;hp=4b2369b3796741fb6177bd1f876da9313146f893;hpb=c466baaa5b99e44ea25616556bd0918197f4b54c;p=features.git diff --git a/src/insets/InsetIPAMacro.cpp b/src/insets/InsetIPAMacro.cpp index 4b2369b379..4e8afcfa7e 100644 --- a/src/insets/InsetIPAMacro.cpp +++ b/src/insets/InsetIPAMacro.cpp @@ -22,7 +22,7 @@ #include "LaTeXFeatures.h" #include "Lexer.h" #include "MetricsInfo.h" -#include "output_xhtml.h" +#include "xml.h" #include "texstream.h" #include "frontends/FontMetrics.h" @@ -305,14 +305,26 @@ int InsetIPADeco::plaintext(odocstringstream & os, } -int InsetIPADeco::docbook(odocstream & os, OutputParams const & runparams) const +void InsetIPADeco::docbook(XMLStream & xs, OutputParams const & runparams) const { - // FIXME: Any docbook option here? - return InsetCollapsible::docbook(os, runparams); + // The special combining character must be put in the middle, between the two other characters. + // It will not work if there is anything else than two pure characters, so going back to plaintext. + odocstringstream ods; + int h = (int)(InsetText::plaintext(ods, runparams) / 2); + docstring result = ods.str(); + docstring const before = result.substr(0, h); + docstring const after = result.substr(h, result.size()); + + xs << XMLStream::ESCAPE_NONE << before; + if (params_.type == InsetIPADecoParams::Toptiebar) + xs << XMLStream::ESCAPE_NONE << "͡"; + else if (params_.type == InsetIPADecoParams::Bottomtiebar) + xs << XMLStream::ESCAPE_NONE << "͜"; + xs << XMLStream::ESCAPE_NONE << after; } -docstring InsetIPADeco::xhtml(XHTMLStream & xs, OutputParams const & runparams) const +docstring InsetIPADeco::xhtml(XMLStream & xs, OutputParams const & runparams) const { // FIXME: Like in plaintext, the combining characters "͡" (toptiebar) // or "͜" (bottomtiebar) would need to be inserted just in the mid @@ -540,45 +552,57 @@ int InsetIPAChar::plaintext(odocstringstream & os, OutputParams const &, size_t) } -int InsetIPAChar::docbook(odocstream & /*os*/, OutputParams const &) const +void InsetIPAChar::docbook(XMLStream & xs, OutputParams const &) const { switch (kind_) { case TONE_FALLING: + xs << XMLStream::ESCAPE_NONE << "˥"; + xs << XMLStream::ESCAPE_NONE << "˩"; + break; case TONE_RISING: + xs << XMLStream::ESCAPE_NONE << "˩"; + xs << XMLStream::ESCAPE_NONE << "˥"; + break; case TONE_HIGH_RISING: + xs << XMLStream::ESCAPE_NONE << "˧"; + xs << XMLStream::ESCAPE_NONE << "˥"; + break; case TONE_LOW_RISING: + xs << XMLStream::ESCAPE_NONE << "˩"; + xs << XMLStream::ESCAPE_NONE << "˧"; + break; case TONE_HIGH_RISING_FALLING: - // FIXME - LYXERR0("IPA tone macros not yet implemented with DocBook!"); + xs << XMLStream::ESCAPE_NONE << "˨"; + xs << XMLStream::ESCAPE_NONE << "˥"; + xs << XMLStream::ESCAPE_NONE << "˨"; break; } - return 0; } -docstring InsetIPAChar::xhtml(XHTMLStream & xs, OutputParams const &) const +docstring InsetIPAChar::xhtml(XMLStream & xs, OutputParams const &) const { switch (kind_) { case TONE_FALLING: - xs << XHTMLStream::ESCAPE_NONE << "˥" - << XHTMLStream::ESCAPE_NONE << "˩"; + xs << XMLStream::ESCAPE_NONE << "˥" + << XMLStream::ESCAPE_NONE << "˩"; break; case TONE_RISING: - xs << XHTMLStream::ESCAPE_NONE << "˩" - << XHTMLStream::ESCAPE_NONE << "˥"; + xs << XMLStream::ESCAPE_NONE << "˩" + << XMLStream::ESCAPE_NONE << "˥"; break; case TONE_HIGH_RISING: - xs << XHTMLStream::ESCAPE_NONE << "˧" - << XHTMLStream::ESCAPE_NONE << "˥"; + xs << XMLStream::ESCAPE_NONE << "˧" + << XMLStream::ESCAPE_NONE << "˥"; break; case TONE_LOW_RISING: - xs << XHTMLStream::ESCAPE_NONE << "˩" - << XHTMLStream::ESCAPE_NONE << "˧"; + xs << XMLStream::ESCAPE_NONE << "˩" + << XMLStream::ESCAPE_NONE << "˧"; break; case TONE_HIGH_RISING_FALLING: - xs << XHTMLStream::ESCAPE_NONE << "˨" - << XHTMLStream::ESCAPE_NONE << "˥" - << XHTMLStream::ESCAPE_NONE << "˨"; + xs << XMLStream::ESCAPE_NONE << "˨" + << XMLStream::ESCAPE_NONE << "˥" + << XMLStream::ESCAPE_NONE << "˨"; break; } return docstring();