#include "support/lstrings.h"
#include "support/lyxlib.h"
-#include "support/tostr.h"
+#include "support/convert.h"
+#include "support/types.h"
#ifdef HAVE_LOCALE
#endif
+using lyx::pos_type;
using lyx::support::subst;
using std::endl;
if(p->params().depth() < par->params().depth())
return p;
- if( style->latexname() != bstyle->latexname() and p->params().depth() == par->params().depth() )
+ if( style->latexname() != bstyle->latexname() && p->params().depth() == par->params().depth() )
return p;
}
return pend;
OutputParams const & runparams,
ParagraphList const & paragraphs,
ParagraphList::const_iterator const & pbegin,
- ParagraphList::const_iterator const & pend) {
- ParagraphList::const_iterator par = pbegin;
- Counters & counters = buf.params().getLyXTextClass().counters();
- const int depth = 0;
-
- for(; par != pend; ++par) {
- LyXLayout_ptr const & style = par->layout();
- string id = par->getDocbookId();
-
- if (!style->latexparam().empty()) {
- counters.step("para");
- int i = counters.value("para");
- id = subst(style->latexparam(), "#", tostr(i));
+ ParagraphList::const_iterator const & pend)
+{
+ LyXLayout_ptr const & defaultstyle = buf.params().getLyXTextClass().defaultLayout();
+ for(ParagraphList::const_iterator par = pbegin; par != pend; ++par) {
+ if (par->layout() == defaultstyle && par->emptyTag()) {
+ par->simpleDocBookOnePar(buf, os, runparams, outerFont(par - paragraphs.begin(), paragraphs));
+ } else {
+ sgml::openTag(buf, os, runparams, *par);
+ par->simpleDocBookOnePar(buf, os, runparams, outerFont(par - paragraphs.begin(), paragraphs));
+ sgml::closeTag(os, *par);
+ os << '\n';
}
-
- id = id.empty()? "": " id = \"" + id + "\"";
- sgml::openTag(os, depth, true, style->latexname(), id);
- par->simpleDocBookOnePar(buf, os, outerFont(par - paragraphs.begin(), paragraphs), runparams, depth);
-
- sgml::closeTag(os, depth, true, style->latexname());
- os << '\n';
}
return pend;
}
ParagraphList::const_iterator const & pend) {
ParagraphList::const_iterator par = pbegin;
- Counters & counters = buf.params().getLyXTextClass().counters();
LyXLayout_ptr const & defaultstyle = buf.params().getLyXTextClass().defaultLayout();
- const int depth = 0;
-
LyXLayout_ptr const & bstyle = par->layout();
string item_tag;
-
- string id = par->getDocbookId();
- string env_name = bstyle->latexname();
+
// Opening outter tag
- sgml::openTag(os, depth, false, env_name, bstyle->latexparam() + id);
+ sgml::openTag(buf, os, runparams, *pbegin);
os << '\n';
- if (bstyle->latextype == LATEX_ENVIRONMENT and bstyle->innertag() == "CDATA")
+ if (bstyle->latextype == LATEX_ENVIRONMENT && bstyle->pass_thru)
os << "<![CDATA[";
while (par != pend) {
LyXLayout_ptr const & style = par->layout();
- string id = "";
ParagraphList::const_iterator send;
+ string id = par->getID(buf, runparams);
string wrapper = "";
+ pos_type sep = 0;
// Opening inner tag
switch (bstyle->latextype) {
case LATEX_ENVIRONMENT:
- if (!bstyle->innertag().empty() and bstyle->innertag() != "CDATA") {
- sgml::openTag(os, depth, true, bstyle->innertag());
+ if (!bstyle->innertag().empty()) {
+ sgml::openTag(os, bstyle->innertag(), id);
}
break;
case LATEX_ITEM_ENVIRONMENT:
if (!bstyle->labeltag().empty()) {
- sgml::openTag(os, depth, true, bstyle->labeltag());
- } else {
- if (!defaultstyle->latexparam().empty()) {
- counters.step("para");
- id = tostr(counters.value("para"));
- id = " id=\""+ subst(defaultstyle->latexparam(), "#", id) + '"';
- }
- wrapper = defaultstyle->latexname();
- sgml::openTag(os, depth, true, bstyle->itemtag());
+ sgml::openTag(os, bstyle->innertag(), id);
+ sgml::openTag(os, bstyle->labeltag());
+ sep = par->getFirstWord(buf, os, runparams) + 1;
+ sgml::closeTag(os, bstyle->labeltag());
}
+ wrapper = defaultstyle->latexname();
+ sgml::openTag(os, bstyle->itemtag());
default:
break;
}
case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT: {
if(par->params().depth() == pbegin->params().depth()) {
- sgml::openTag(os, depth, true, wrapper, id);
- par->simpleDocBookOnePar(buf, os, outerFont(par - paragraphs.begin(), paragraphs), runparams, depth);
- sgml::closeTag(os, depth, true, wrapper);
+ sgml::openTag(os, wrapper);
+ par->simpleDocBookOnePar(buf, os, runparams, outerFont(par - paragraphs.begin(), paragraphs), sep);
+ sgml::closeTag(os, wrapper);
++par;
}
else {
// Closing inner tag
switch (bstyle->latextype) {
case LATEX_ENVIRONMENT:
- if (!bstyle->innertag().empty() and bstyle->innertag() != "CDATA") {
- sgml::closeTag(os, depth, true, bstyle->innertag());
+ if (!bstyle->innertag().empty()) {
+ sgml::closeTag(os, bstyle->innertag());
os << '\n';
}
break;
case LATEX_ITEM_ENVIRONMENT:
- sgml::closeTag(os, depth, true, bstyle->itemtag());
+ sgml::closeTag(os, bstyle->itemtag());
+ if (!bstyle->labeltag().empty())
+ sgml::closeTag(os, bstyle->innertag());
break;
default:
break;
}
}
- if (bstyle->latextype == LATEX_ENVIRONMENT and bstyle->innertag() == "CDATA")
+ if (bstyle->latextype == LATEX_ENVIRONMENT && bstyle->pass_thru)
os << "]]>";
// Closing outter tag
- sgml::closeTag(os, depth, false, env_name);
+ sgml::closeTag(os, *pbegin);
return pend;
}
ParagraphList::const_iterator const & pbegin,
ParagraphList::const_iterator const & pend)
{
- Paragraph::depth_type depth = 0; // paragraph depth
-
ParagraphList::const_iterator par = pbegin;
-
- Counters & counters = buf.params().getLyXTextClass().counters();
LyXLayout_ptr const & bstyle = par->layout();
-
- string id = par->getDocbookId();
- id = id.empty()? "" : " id = \"" + id + "\"";
-
- if (bstyle->latexparam().find('#') != string::npos) {
- counters.step(bstyle->counter);
- }
-
- if (!bstyle->latexparam().empty()) {
- id = bstyle->latexparam();
- if (id.find('#') != string::npos) {
- string el = expandLabel(buf.params().getLyXTextClass(),
- bstyle, false);
- id = subst(id, "#", el);
- }
- }
//Open outter tag
- sgml::openTag(os, depth, false, bstyle->latexname(), id);
+ sgml::openTag(buf, os, runparams, *pbegin);
os << '\n';
// Label around sectioning number:
if (!bstyle->labeltag().empty()) {
- sgml::openTag(os, depth, false, bstyle->labeltag());
+ sgml::openTag(os, bstyle->labeltag());
os << expandLabel(buf.params().getLyXTextClass(), bstyle, false);
- sgml::closeTag(os, depth, false, bstyle->labeltag());
+ sgml::closeTag(os, bstyle->labeltag());
}
-
- // Opend inner tag
- sgml::openTag(os, depth, true, bstyle->innertag());
-
- par->simpleDocBookOnePar(buf, os, outerFont(par - paragraphs.begin(), paragraphs),
- runparams, depth);
- // Close inner tags
- sgml::closeTag(os, depth, true, bstyle->innertag());
+ // Opend inner tag and close inner tags
+ sgml::openTag(os, bstyle->innertag());
+ par->simpleDocBookOnePar(buf, os, runparams, outerFont(par - paragraphs.begin(), paragraphs));
+ sgml::closeTag(os, bstyle->innertag());
os << '\n';
-
+
++par;
while (par != pend) {
LyXLayout_ptr const & style = par->layout();
break;
}
}
-
// Close outter tag
- sgml::closeTag(os, depth, false, bstyle->latexname());
+ sgml::closeTag(os, *pbegin);
return pend;
}