mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 21:05:12 +00:00
Inside the same the same paragraph don't change CDATA status.
Don't output paragraphs inside inline elements (char styles). (docbook) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9151 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3297d415dc
commit
a059f47e59
@ -1,3 +1,9 @@
|
||||
2004-10-30 José Matos <jamatos@lyx.org>
|
||||
|
||||
* paragraph.[Ch] (onlyText): Checks if the paragraph contains only
|
||||
text and no inset or font change. This allows to use CDATA
|
||||
sections just for the whole paragraph.
|
||||
|
||||
2004-10-30 José Matos <jamatos@lyx.org>
|
||||
|
||||
* paragraph.C (getFirstWord): remove unused variable.
|
||||
|
@ -1,3 +1,8 @@
|
||||
2004-10-30 José Matos <jamatos@lyx.org>
|
||||
|
||||
* insetcharstyle.C (docbook): a compromisse solution. Don't output
|
||||
paragraph tags inside inline elements.
|
||||
|
||||
2004-10-30 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* insetcharstyle.C (latex, linuxdoc, docbook, plaintext): use
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "lyxtext.h"
|
||||
#include "metricsinfo.h"
|
||||
#include "paragraph.h"
|
||||
#include "paragraph_funcs.h"
|
||||
#include "sgml.h"
|
||||
|
||||
#include "frontends/font_metrics.h"
|
||||
@ -189,10 +190,19 @@ int InsetCharStyle::linuxdoc(Buffer const & buf, ostream & os,
|
||||
int InsetCharStyle::docbook(Buffer const & buf, ostream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
sgml::openTag(os, params_.latexname, params_.latexparam);
|
||||
int i = InsetText::docbook(buf, os, runparams);
|
||||
ParagraphList::const_iterator par = paragraphs().begin();
|
||||
ParagraphList::const_iterator end = paragraphs().end();
|
||||
|
||||
sgml::openTag(os, params_.latexname, par->getID() + params_.latexparam);
|
||||
|
||||
for (; par != end; ++par) {
|
||||
par->simpleDocBookOnePar(buf, os, runparams,
|
||||
outerFont(par - paragraphs().begin(),
|
||||
paragraphs()));
|
||||
}
|
||||
|
||||
sgml::closeTag(os, params_.latexname);
|
||||
return i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1394,6 +1394,25 @@ pos_type Paragraph::getFirstWord(Buffer const & buf, ostream & os, OutputParams
|
||||
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,
|
||||
@ -1406,7 +1425,8 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
|
||||
LyXFont font_old =
|
||||
style->labeltype == LABEL_MANUAL ? style->labelfont : style->font;
|
||||
|
||||
bool cdata = style->pass_thru;
|
||||
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);
|
||||
@ -1414,29 +1434,17 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
|
||||
// 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;
|
||||
@ -1452,15 +1460,13 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
|
||||
}
|
||||
|
||||
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[";
|
||||
}
|
||||
|
||||
|
||||
|
@ -140,6 +140,10 @@ public:
|
||||
std::ostream & os,
|
||||
OutputParams const & runparams) const;
|
||||
|
||||
/// Checks if the paragraph contains only text and no inset or font change.
|
||||
bool onlyText(Buffer const & buf, LyXFont const & outerfont,
|
||||
lyx::pos_type initial) const;
|
||||
|
||||
/// Writes to stream the docbook representation
|
||||
void simpleDocBookOnePar(Buffer const & buf,
|
||||
std::ostream &,
|
||||
|
Loading…
Reference in New Issue
Block a user