using lyx::pos_type;
-using lyx::support::contains;
using lyx::support::subst;
using std::distance;
basefont = getLayoutFont(bparams, outerfont);
}
- bool const moving_arg = runparams.moving_arg | style->needprotect;
-
// Which font is currently active?
LyXFont running_font(basefont);
// Do we have an open font change?
++column;
}
if (!asdefault)
- column += startTeXParParams(bparams, os, moving_arg);
+ column += startTeXParParams(bparams, os,
+ runparams.moving_arg);
}
for (pos_type i = 0; i < size(); ++i) {
if (!asdefault)
column += startTeXParParams(bparams, os,
- moving_arg);
+ runparams.moving_arg);
}
value_type c = getChar(i);
running_change = change;
OutputParams rp = runparams;
- rp.moving_arg = moving_arg;
rp.free_spacing = style->free_spacing;
rp.local_language = font.language()->babel();
rp.intitle = style->intitle;
}
if (!asdefault) {
- column += endTeXParParams(bparams, os, moving_arg);
+ column += endTeXParParams(bparams, os, runparams.moving_arg);
}
lyxerr[Debug::LATEX] << "SimpleTeXOnePar...done " << this << endl;
}
-string Paragraph::getID() const
+string Paragraph::getID(Buffer const & buf, OutputParams const & runparams) const
{
for (pos_type i = 0; i < size(); ++i) {
if (isInset(i)) {
InsetBase::Code lyx_code = inset->lyxCode();
if (lyx_code == InsetBase::LABEL_CODE) {
string const id = static_cast<InsetCommand const *>(inset)->getContents();
- return "id=\"" + sgml::cleanID(id) + "\"";
+ return "id=\"" + sgml::cleanID(buf, runparams, id) + "\"";
}
}
pos_type Paragraph::getFirstWord(Buffer const & buf, ostream & os, OutputParams const & runparams) const
{
pos_type i;
- LyXLayout_ptr const & style = layout();
for (i = 0; i < size(); ++i) {
if (isInset(i)) {
InsetBase const * inset = getInset(i);
string str;
boost::tie(ws, str) = sgml::escapeChar(c);
- if (style->pass_thru)
- os << c;
- else
- os << str;
+ os << str;
}
}
return i;
}
+
+bool Paragraph::onlyText(Buffer const & buf, LyXFont const & outerfont, pos_type initial) const
+{
+ LyXLayout_ptr const & style = layout();
+ LyXFont font_old;
+
+ for (pos_type i = initial; i < size(); ++i) {
+ LyXFont font = getFont(buf.params(), i, outerfont);
+ if (isInset(i))
+ return false;
+ if ( i != initial and font != font_old)
+ return false;
+ font_old = font;
+ }
+
+ return true;
+}
+
+
void Paragraph::simpleDocBookOnePar(Buffer const & buf,
ostream & os,
OutputParams const & runparams,
LyXFont font_old =
style->labeltype == LABEL_MANUAL ? style->labelfont : style->font;
- bool cdata = (style->latexparam() == "CDATA");
+ if (style->pass_thru and not onlyText(buf, outerfont, initial))
+ os << "]]>";
// parsing main loop
for (pos_type i = initial; i < size(); ++i) {
LyXFont font = getFont(buf.params(), i, outerfont);
// handle <emphasis> tag
if (font_old.emph() != font.emph()) {
if (font.emph() == LyXFont::ON) {
- if (cdata)
- os << "]]>";
os << "<emphasis>";
- if (cdata)
- os << "<![CDATA[";
emph_flag = true;
} else if (i != initial) {
- if (cdata)
- os << "]]>";
os << "</emphasis>";
- if (cdata)
- os << "<![CDATA[";
emph_flag = false;
}
}
if (isInset(i)) {
InsetBase const * inset = getInset(i);
- if (cdata)
- os << "]]>";
inset->docbook(buf, os, runparams);
- if (cdata)
- os << "<![CDATA[";
} else {
char c = getChar(i);
bool ws;
}
if (emph_flag) {
- if (cdata)
- os << "]]>";
os << "</emphasis>";
- if (cdata)
- os << "<![CDATA[";
}
if (style->free_spacing)
os << '\n';
+ if (style->pass_thru and not onlyText(buf, outerfont, initial))
+ os << "<![CDATA[";
}
}
-bool Paragraph::isKomma(pos_type pos) const
-{
- return IsKommaChar(getChar(pos));
-}
-
-
/// Used by the spellchecker
bool Paragraph::isLetter(pos_type pos) const
{
- value_type const c = getChar(pos);
- if (IsLetterChar(c))
- return true;
if (isInset(pos))
return getInset(pos)->isLetter();
- // We want to pass the ' and escape chars to ispell
- string const extra = lyxrc.isp_esc_chars + '\'';
- return contains(extra, c);
-}
-
-
-bool Paragraph::isWord(pos_type pos) const
-{
- if (isInset(pos))
- return getInset(pos)->isLetter();
- value_type const c = getChar(pos);
- return !(IsSeparatorChar(c)
- || IsKommaChar(c)
- || IsInsetChar(c));
+ else {
+ value_type const c = getChar(pos);
+ return IsLetterChar(c) || IsDigit(c);
+ }
}