mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 21:40:19 +00:00
Make the standard paragraph an empty paragraph if its content allows it.
Fix bug 1708. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9143 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8e27aa2fb7
commit
876a495c6b
@ -1,3 +1,9 @@
|
||||
2004-10-30 José Matos <jamatos@lyx.org>
|
||||
|
||||
* output_docbook.C (makeParagraphs):
|
||||
* paragraph.[Ch] (emptyTag): for docbook and company, if the
|
||||
standard paragraph has only a given type of content drop the wrapper.
|
||||
|
||||
2004-10-29 José Matos <jamatos@lyx.org>
|
||||
|
||||
* output_docbook.C (makeEnvironment):
|
||||
|
@ -102,11 +102,16 @@ ParagraphList::const_iterator makeParagraph(Buffer const & buf,
|
||||
ParagraphList::const_iterator const & pbegin,
|
||||
ParagraphList::const_iterator const & pend)
|
||||
{
|
||||
LyXLayout_ptr const & defaultstyle = buf.params().getLyXTextClass().defaultLayout();
|
||||
for(ParagraphList::const_iterator par = pbegin; par != pend; ++par) {
|
||||
sgml::openTag(buf, os, *par);
|
||||
par->simpleDocBookOnePar(buf, os, runparams, outerFont(par - paragraphs.begin(), paragraphs));
|
||||
sgml::closeTag(os, *par);
|
||||
os << '\n';
|
||||
if (par->layout() == defaultstyle && par->emptyTag()) {
|
||||
par->simpleDocBookOnePar(buf, os, runparams, outerFont(par - paragraphs.begin(), paragraphs));
|
||||
} else {
|
||||
sgml::openTag(buf, os, *par);
|
||||
par->simpleDocBookOnePar(buf, os, runparams, outerFont(par - paragraphs.begin(), paragraphs));
|
||||
sgml::closeTag(os, *par);
|
||||
os << '\n';
|
||||
}
|
||||
}
|
||||
return pend;
|
||||
}
|
||||
|
@ -1331,6 +1331,31 @@ void Paragraph::simpleLinuxDocOnePar(Buffer const & buf,
|
||||
}
|
||||
|
||||
|
||||
bool Paragraph::emptyTag() const
|
||||
{
|
||||
for (pos_type i = 0; i < size(); ++i) {
|
||||
if (isInset(i)) {
|
||||
InsetBase const * inset = getInset(i);
|
||||
InsetBase::Code lyx_code = inset->lyxCode();
|
||||
if (lyx_code != InsetBase::TOC_CODE and
|
||||
lyx_code != InsetBase::INCLUDE_CODE and
|
||||
lyx_code != InsetBase::GRAPHICS_CODE and
|
||||
lyx_code != InsetBase::ERT_CODE and
|
||||
lyx_code != InsetBase::FLOAT_CODE and
|
||||
lyx_code != InsetBase::TABULAR_CODE) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
char c = getChar(i);
|
||||
if(c!= ' ' and c!= '\t')
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
string Paragraph::getID() const
|
||||
{
|
||||
for (pos_type i = 0; i < size(); ++i) {
|
||||
|
@ -122,13 +122,16 @@ public:
|
||||
LyXFont const & outerfont, std::ostream &,
|
||||
TexRow & texrow, OutputParams const &) const;
|
||||
|
||||
///
|
||||
/// Writes to stream the content of the paragraph for linuxdoc
|
||||
void simpleLinuxDocOnePar(Buffer const & buf,
|
||||
std::ostream & os,
|
||||
LyXFont const & outerfont,
|
||||
OutputParams const & runparams,
|
||||
lyx::depth_type depth) const;
|
||||
|
||||
/// Can we drop the standard paragraph wrapper?
|
||||
bool Paragraph::emptyTag() const;
|
||||
|
||||
/// Get the id of the paragraph, usefull for docbook and linuxdoc
|
||||
std::string getID() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user