X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsgml.cpp;h=4842b07912e8f2f4524782a12093a5b3865174b8;hb=4db3e641ed6765e005343010cb90ee8af26f8f99;hp=1611f32495ceb0125651af950ef39b4a810a0f5e;hpb=d8a6b5bfd0baa02a4ba03f8c9e9c618baf41b03f;p=lyx.git diff --git a/src/sgml.cpp b/src/sgml.cpp index 1611f32495..4842b07912 100644 --- a/src/sgml.cpp +++ b/src/sgml.cpp @@ -3,7 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author José Matos + * \author José Matos * \author John Levon * * Full author contact details are available in file CREDITS. @@ -28,7 +28,6 @@ #include "support/textutils.h" #include -#include using namespace std; using namespace lyx::support; @@ -182,7 +181,12 @@ void sgml::openTag(odocstream & os, string const & name, string const & attribut string param = subst(attribute, "<", "\""); param = subst(param, ">", "\""); - if (!name.empty() && name != "!-- --") { + // Note: we ignore the name if it empty or if it is a comment "" or + // if the name is *dummy*. + // We ignore dummy because dummy is not a valid docbook element and it is + // the internal name given to single paragraphs in the latex output. + // This allow us to simplify the code a lot and is a reasonable compromise. + if (!name.empty() && name != "!-- --" && name != "dummy") { os << '<' << from_ascii(name); if (!param.empty()) os << ' ' << from_ascii(param); @@ -193,7 +197,7 @@ void sgml::openTag(odocstream & os, string const & name, string const & attribut void sgml::closeTag(odocstream & os, string const & name) { - if (!name.empty() && name != "!-- --") + if (!name.empty() && name != "!-- --" && name != "dummy") os << "'; } @@ -201,9 +205,9 @@ void sgml::closeTag(odocstream & os, string const & name) void sgml::openTag(Buffer const & buf, odocstream & os, OutputParams const & runparams, Paragraph const & par) { - LayoutPtr const & style = par.layout(); - string const & name = style->latexname(); - string param = style->latexparam(); + Layout const & style = par.layout(); + string const & name = style.latexname(); + string param = style.latexparam(); Counters & counters = buf.params().documentClass().counters(); string id = par.getID(buf, runparams); @@ -220,10 +224,13 @@ void sgml::openTag(Buffer const & buf, odocstream & os, } else { if (param.find('#') != string::npos) { // FIXME UNICODE - if (!style->counter.empty()) - counters.step(style->counter); + if (!style.counter.empty()) + // This uses InternalUpdate at the moment becuase sgml output + // does not do anything with tracked counters, and it would need + // to track layouts if it did want to use them. + counters.step(style.counter, InternalUpdate); else - counters.step(from_ascii(name)); + counters.step(from_ascii(name), InternalUpdate); int i = counters.value(from_ascii(name)); attribute = subst(param, "#", convert(i)); } else { @@ -236,8 +243,8 @@ void sgml::openTag(Buffer const & buf, odocstream & os, void sgml::closeTag(odocstream & os, Paragraph const & par) { - LayoutPtr const & style = par.layout(); - closeTag(os, style->latexname()); + Layout const & style = par.layout(); + closeTag(os, style.latexname()); }