string item_tag;
- ParagraphList::iterator par = const_cast<ParagraphList&>(paragraphs).begin();
- ParagraphList::iterator pend = const_cast<ParagraphList&>(paragraphs).end();
+ ParagraphList::const_iterator par = paragraphs.begin();
+ ParagraphList::const_iterator pend = paragraphs.end();
- Counters & counters = buf.params().getLyXTextClass().counters();
+ Counters & counters = buf.params().getLyXTextClass().counters();
for (; par != pend; ++par) {
environment_inner[depth].erase();
}
- string ls = "";
- bool labelid = false;
+ string ls = par->getDocbookId();
+ if (!ls.empty())
+ ls = " id = \"" + ls + "\"";
+
// Write opening SGML tags.
switch (style->latextype) {
case LATEX_PARAGRAPH:
int i = counters.value("para");
ls = subst(style->latexparam(), "#", tostr(i));
}
+
sgml::openTag(os, depth + command_depth,
false, style->latexname(), ls);
break;
if (style->latexparam().find('#') != string::npos) {
counters.step(style->counter);
}
- // treat label as a special case for
- // more WYSIWYM handling.
- // This is a hack while paragraphs can't have
- // attributes, like id in this case.
- if (par->size() && par->isInset(0)) {
- InsetBase * inset = par->getInset(0);
- if (inset->lyxCode() == InsetOld::LABEL_CODE) {
- command_name += " id=\"";
- command_name += (static_cast<InsetCommand *>(inset))->getContents();
- command_name += '"';
- labelid = true;
- }
- }
- if (!labelid && !style->latexparam().empty()) {
+
+ if (!style->latexparam().empty()) {
ls = style->latexparam();
if (ls.find('#') != string::npos) {
string el = expandLabel(buf.params().getLyXTextClass(),
environment_inner[depth] = "!-- --";
// outputs <environment_stack[depth] latexparam()>
sgml::openTag(os, depth + command_depth, false,
- environment_stack[depth], style->latexparam());
+ environment_stack[depth], style->latexparam() + ls);
} else {
sgml::closeEnvTags(os, false, environment_inner[depth],
style->itemtag(), command_depth + depth);
break;
default:
sgml::openTag(os, depth + command_depth,
- false, style->latexname());
+ false, style->latexname(), ls);
break;
}
par->simpleDocBookOnePar(buf, os,
- outerFont(par - const_cast<ParagraphList&>(paragraphs).begin(), paragraphs),
- runparams, depth + 1 + command_depth, labelid);
+ outerFont(par - paragraphs.begin(), paragraphs),
+ runparams, depth + 1 + command_depth);
// write closing SGML tags
switch (style->latextype) {