mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
InsetIPAMacro: refactor code between DocBook and XHTML.
This commit is contained in:
parent
21d1d917ba
commit
df025d15df
@ -553,59 +553,34 @@ int InsetIPAChar::plaintext(odocstringstream & os, OutputParams const &, size_t)
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
std::string ipaCharToXMLEntity(InsetIPAChar::Kind kind) {
|
||||
switch (kind) {
|
||||
case InsetIPAChar::Kind::TONE_FALLING:
|
||||
return "˥˩";
|
||||
case InsetIPAChar::Kind::TONE_RISING:
|
||||
return "˩˥";
|
||||
case InsetIPAChar::Kind::TONE_HIGH_RISING:
|
||||
return "˧˥";
|
||||
case InsetIPAChar::Kind::TONE_LOW_RISING:
|
||||
return "˩˧";
|
||||
case InsetIPAChar::Kind::TONE_HIGH_RISING_FALLING:
|
||||
return "˨˥˨";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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:
|
||||
xs << XMLStream::ESCAPE_NONE << "˨";
|
||||
xs << XMLStream::ESCAPE_NONE << "˥";
|
||||
xs << XMLStream::ESCAPE_NONE << "˨";
|
||||
break;
|
||||
}
|
||||
xs << XMLStream::ESCAPE_NONE << from_ascii(ipaCharToXMLEntity(kind()));
|
||||
}
|
||||
|
||||
|
||||
docstring InsetIPAChar::xhtml(XMLStream & xs, OutputParams const &) const
|
||||
{
|
||||
switch (kind_) {
|
||||
case TONE_FALLING:
|
||||
xs << XMLStream::ESCAPE_NONE << "˥"
|
||||
<< XMLStream::ESCAPE_NONE << "˩";
|
||||
break;
|
||||
case TONE_RISING:
|
||||
xs << XMLStream::ESCAPE_NONE << "˩"
|
||||
<< XMLStream::ESCAPE_NONE << "˥";
|
||||
break;
|
||||
case TONE_HIGH_RISING:
|
||||
xs << XMLStream::ESCAPE_NONE << "˧"
|
||||
<< XMLStream::ESCAPE_NONE << "˥";
|
||||
break;
|
||||
case TONE_LOW_RISING:
|
||||
xs << XMLStream::ESCAPE_NONE << "˩"
|
||||
<< XMLStream::ESCAPE_NONE << "˧";
|
||||
break;
|
||||
case TONE_HIGH_RISING_FALLING:
|
||||
xs << XMLStream::ESCAPE_NONE << "˨"
|
||||
<< XMLStream::ESCAPE_NONE << "˥"
|
||||
<< XMLStream::ESCAPE_NONE << "˨";
|
||||
break;
|
||||
}
|
||||
xs << XMLStream::ESCAPE_NONE << from_ascii(ipaCharToXMLEntity(kind()));
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user