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) {
LyXLayout_ptr const & style = par->layout();
// environment tag closing
for (; depth > par->params().depth(); --depth) {
- sgml::closeEnvTags(os, false, environment_inner[depth],
+ sgml::closeEnvTags(os, false, environment_inner[depth],
item_tag, command_depth + depth);
sgml::closeTag(os, depth + command_depth, false, environment_stack[depth]);
environment_stack[depth].erase();
if (depth == par->params().depth()
&& environment_stack[depth] != style->latexname()
&& !environment_stack[depth].empty()) {
- sgml::closeEnvTags(os, false, environment_inner[depth],
+ sgml::closeEnvTags(os, false, environment_inner[depth],
item_tag, command_depth + depth);
sgml::closeTag(os, depth + command_depth, false, environment_stack[depth]);
environment_stack[depth].erase();
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 (depth != 0)
//error(ErrorItem(_("Error"), _("Wrong depth for LatexType Command."), par->id(), 0, par->size()));
;
-
+
command_name = style->latexname();
cmd_depth = style->commanddepth;
-
+
if (command_flag) {
if (cmd_depth < command_base) {
for (Paragraph::depth_type j = command_depth;
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(),
+ string el = expandLabel(buf.params().getLyXTextClass(),
style, false);
ls = subst(ls, "#", el);
- }
+ }
}
-
+
sgml::openTag(os, depth + command_depth, false, command_name, ls);
// Label around sectioning number:
if (!style->labeltag().empty()) {
- sgml::openTag(os, depth + 1 + command_depth, false,
+ sgml::openTag(os, depth + 1 + command_depth, false,
style->labeltag());
os << expandLabel(buf.params().getLyXTextClass(), style, false);
- sgml::closeTag(os, depth + 1 + command_depth, false,
+ sgml::closeTag(os, depth + 1 + command_depth, false,
style->labeltag());
}
// Inner tagged header text, e.g. <title> for sectioning:
- sgml::openTag(os, depth + 1 + command_depth, false,
+ sgml::openTag(os, depth + 1 + command_depth, false,
style->innertag());
break;
environment_stack[depth] = style->latexname();
environment_inner[depth] = "!-- --";
// outputs <environment_stack[depth] latexparam()>
- sgml::openTag(os, depth + command_depth, false,
- environment_stack[depth], style->latexparam());
+ sgml::openTag(os, depth + command_depth, false,
+ environment_stack[depth], style->latexparam() + ls);
} else {
- sgml::closeEnvTags(os, false, environment_inner[depth],
+ sgml::closeEnvTags(os, false, environment_inner[depth],
style->itemtag(), command_depth + depth);
}
if (style->innertag() == "CDATA")
os << "<![CDATA[";
else
- sgml::openTag(os, depth + command_depth, false,
+ sgml::openTag(os, depth + command_depth, false,
style->innertag());
}
break;
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) {
case LATEX_COMMAND:
- sgml::closeTag(os, depth + command_depth, false,
+ sgml::closeTag(os, depth + command_depth, false,
style->innertag());
break;
case LATEX_ENVIRONMENT:
if (style->innertag() == "CDATA")
os << "]]>";
else
- sgml::closeTag(os, depth + command_depth, false,
+ sgml::closeTag(os, depth + command_depth, false,
style->innertag());
}
break;
// Close open tags
for (int d = depth; d >= 0; --d) {
if (!environment_stack[depth].empty()) {
- sgml::closeEnvTags(os, false, environment_inner[depth],
+ sgml::closeEnvTags(os, false, environment_inner[depth],
item_tag, command_depth + depth);
}
}
os << endl;
}
}
-