From a86b3a1c84b38e34d0e298c2858f87eb390066a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Matox?= Date: Thu, 28 Oct 2004 15:10:10 +0000 Subject: [PATCH] Move ids in environments to the possible wider scope. Replace <> by the "" for all attributes. Use open and closeTag always. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9140 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 8 +++++++- src/insets/ChangeLog | 4 ++++ src/insets/insetcharstyle.C | 23 +++++++++++------------ src/output_docbook.C | 6 +++--- src/sgml.C | 10 ++++++---- 5 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5b0a336ae0..dc4fac761f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,4 +1,10 @@ -2004-10-25 José Matos +2004-10-28 José Matos + + * output_docbook.C (makeEnvironment): move id to broadest possible scope. + + * sgml.C (openTag): apply substitution of <> for all attribuites. + +2004-10-28 José Matos * buffer.C (makeLinuxDocFile, makeDocBookFile): * output_docbook.C (makeParagraph, makeEnvironment, makeCommand): diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 3c11b24701..9aeb767886 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2004-10-28 José Matos + + * insetcharstyle.C (linuxdoc, docbook): apply opentTag and closeTag. + 2004-10-28 Georg Baum * ExternalTransforms.C (sanitizeLatexOption): simplify regex diff --git a/src/insets/insetcharstyle.C b/src/insets/insetcharstyle.C index 910350243c..e57e30ba2a 100644 --- a/src/insets/insetcharstyle.C +++ b/src/insets/insetcharstyle.C @@ -24,6 +24,7 @@ #include "lyxtext.h" #include "metricsinfo.h" #include "paragraph.h" +#include "sgml.h" #include "frontends/font_metrics.h" #include "frontends/Painter.h" @@ -208,12 +209,11 @@ int InsetCharStyle::latex(Buffer const &, ostream & os, int InsetCharStyle::linuxdoc(Buffer const &, std::ostream & os, OutputParams const &) const { - os << "<" << params_.latexname; - if (!params_.latexparam.empty()) - os << " " << params_.latexparam; - os << ">"; - int const i = outputVerbatim(os, *this); - os << ""; + ostringstream oss; + int i = outputVerbatim(oss, *this); + sgml::openTag(os, params_.latexname, params_.latexparam); + os << sgml::escapeString(oss.str()); + sgml::closeTag(os, params_.latexname); return i; } @@ -221,12 +221,11 @@ int InsetCharStyle::linuxdoc(Buffer const &, std::ostream & os, int InsetCharStyle::docbook(Buffer const &, std::ostream & os, OutputParams const &) const { - os << "<" << params_.latexname; - if (!params_.latexparam.empty()) - os << " " << params_.latexparam; - os << ">"; - int const i = outputVerbatim(os, *this); - os << ""; + ostringstream oss; + int i = outputVerbatim(oss, *this); + sgml::openTag(os, params_.latexname, params_.latexparam); + os << sgml::escapeString(oss.str()); + sgml::closeTag(os, params_.latexname); return i; } diff --git a/src/output_docbook.C b/src/output_docbook.C index 9a7a641b65..593071c11a 100644 --- a/src/output_docbook.C +++ b/src/output_docbook.C @@ -142,13 +142,13 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf, switch (bstyle->latextype) { case LATEX_ENVIRONMENT: if (!bstyle->innertag().empty() and bstyle->innertag() != "CDATA") { - sgml::openTag(os, bstyle->innertag()); + sgml::openTag(os, bstyle->innertag(), id); } break; case LATEX_ITEM_ENVIRONMENT: if (!bstyle->labeltag().empty()) { - sgml::openTag(os, bstyle->innertag()); + sgml::openTag(os, bstyle->innertag(), id); sgml::openTag(os, bstyle->labeltag()); sep = par->getFirstWord(buf, os, runparams) + 1; sgml::closeTag(os, bstyle->labeltag()); @@ -163,7 +163,7 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf, case LATEX_ENVIRONMENT: case LATEX_ITEM_ENVIRONMENT: { if(par->params().depth() == pbegin->params().depth()) { - sgml::openTag(os, wrapper, id); + sgml::openTag(os, wrapper); par->simpleDocBookOnePar(buf, os, runparams, outerFont(par - paragraphs.begin(), paragraphs), sep); sgml::closeTag(os, wrapper); ++par; diff --git a/src/sgml.C b/src/sgml.C index 57f89219b4..12f045193a 100644 --- a/src/sgml.C +++ b/src/sgml.C @@ -114,10 +114,14 @@ string escapeString(string const & raw) void openTag(ostream & os, string const & name, string const & attribute) { + // This should be fixed in layout files later. + string param = subst(attribute, "<", "\""); + param = subst(param, ">", "\""); + if (!name.empty() && name != "!-- --") { os << '<' << name; - if (!attribute.empty()) - os << " " << attribute; + if (!param.empty()) + os << " " << param; os << '>'; } } @@ -157,8 +161,6 @@ void openTag(Buffer const & buf, ostream & os, Paragraph const & par) counters.step(style->latexname()); int i = counters.value(name); attribute = subst(param, "#", tostr(i)); - attribute = subst(attribute, "<", "\""); - attribute = subst(attribute, ">", "\""); } else { attribute = param; } -- 2.39.2