From 8e27aa2fb7c0b9469ac83f0af49e1f7bc59006f7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Matox?= Date: Fri, 29 Oct 2004 23:08:04 +0000 Subject: [PATCH] Sanitize ids for SGML/XML. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9142 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 11 ++++++ src/insets/ChangeLog | 9 +++++ src/insets/insetgraphics.C | 13 ++----- src/insets/insetlabel.C | 5 ++- src/insets/insetref.C | 9 +++-- src/mathed/ChangeLog | 5 +++ src/mathed/math_hullinset.C | 48 +++++++++++++++++------- src/mathed/ref_inset.C | 14 +++++-- src/output_docbook.C | 3 +- src/paragraph.C | 5 ++- src/paragraph.h | 4 +- src/sgml.C | 75 +++++++++++++++++++++++++++++++++++-- src/sgml.h | 6 +++ 13 files changed, 165 insertions(+), 42 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 72e7e17643..0955a93515 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2004-10-29 José Matos + + * output_docbook.C (makeEnvironment): + * sgml.C (openTag): + * paragraph.[Ch] (getID): rename function, and return it enclosed in id="...". + +2004-10-29 Andreas Vox + + * sgml.[Ch] (uniqueID): returns a unique id for a given label. + (cleanID): sanitize any id. + 2004-10-29 Georg Baum * buffer.C, lyxlex_pimpl.C: diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 0bd9e7c3d0..1d3430135c 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,12 @@ +2004-10-29 José Matos + + * insetgraphics.C (uniqueID): transfered to sgml.C + +2004-10-29 Andreas Vox + + * insetlabel.C (docbook, linuxdoc): + * insetref.C (docbook, linuxdoc) sanitize id. + 2004-10-29 Georg Baum * ExternalSupport.C: s/getExtFromContents/getFormatFromContents/ diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 956819d798..71f4a3d531 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -69,6 +69,7 @@ TODO #include "metricsinfo.h" #include "mover.h" #include "outputparams.h" +#include "sgml.h" #include "frontends/Alert.h" #include "frontends/LyXView.h" @@ -78,7 +79,6 @@ TODO #include "support/lyxlib.h" // float_equal #include "support/os.h" #include "support/systemcall.h" -#include "support/tostr.h" #include #include @@ -126,13 +126,6 @@ string const RemoveExtension(string const & filename) } -string const uniqueID() -{ - static unsigned int seed = 1000; - return "graph" + tostr(++seed); -} - - string findTargetFormat(string const & format, OutputParams const & runparams) { // Are we using latex or pdflatex? @@ -160,7 +153,7 @@ string findTargetFormat(string const & format, OutputParams const & runparams) InsetGraphics::InsetGraphics() - : graphic_label(uniqueID()), + : graphic_label(sgml::uniqueID("graph")), graphic_(new RenderGraphic(this)) {} @@ -168,7 +161,7 @@ InsetGraphics::InsetGraphics() InsetGraphics::InsetGraphics(InsetGraphics const & ig) : InsetOld(ig), boost::signals::trackable(), - graphic_label(uniqueID()), + graphic_label(sgml::uniqueID("graph")), graphic_(new RenderGraphic(*ig.graphic_, this)) { setParams(ig.params()); diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index 816821f9c7..c3643f5b95 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -20,6 +20,7 @@ #include "lyxtext.h" #include "paragraph.h" #include "pariterator.h" +#include "sgml.h" #include "frontends/LyXView.h" @@ -135,7 +136,7 @@ int InsetLabel::plaintext(Buffer const &, ostream & os, int InsetLabel::linuxdoc(Buffer const &, ostream & os, OutputParams const &) const { - os << "