Hi!

This is the insetgraphics patch, which also changes the Docbook SGML
preamble. Nothing new, except that I not only erased all blanks but also
some superflous '<' chars :-)

/Andreas

Index: src/insets/insetcite.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/insets/insetcite.C,v
retrieving revision 1.86
diff -u -p -r1.86 insetcite.C
--- src/insets/insetcite.C      2004/10/05 10:11:41     1.86
+++ src/insets/insetcite.C      2004/10/21 07:35:12
@@ -324,6 +324,35 @@ int InsetCitation::plaintext(Buffer cons
 }


+namespace {
+
+string const cleanupWhitespace(string const & citelist)
+{
+ string::const_iterator it = citelist.begin();
+ string::const_iterator end = citelist.end();
+ // Paranoia check: make sure that there is no whitespace in here
+ // -- at least not behind commas or at the beginning
+ string result;
+ char last = ',';
+ for (; it != end; ++it) {
+ if (*it != ' ')
+ last = *it;
+ if (*it != ' ' || last != ',')
+ result += *it;
+ }
+ return result;
+}
+
+// end anon namyspace
+}
+
+int InsetCitation::docbook(Buffer const &, ostream & os, OutputParams const &) const
+{
+ os << "<citation>" << cleanupWhitespace(getContents()) << "</citation>";
+ return 0;
+}
+
+
// Have to overwrite the default InsetCommand method in order to check that
// the \cite command is valid. Eg, the user has natbib enabled, inputs some
// citations and then changes his mind, turning natbib support off. The output
@@ -343,20 +372,8 @@ int InsetCitation::latex(Buffer const &
os << '[' << before << "][" << after << ']';
else if (!after.empty())
os << '[' << after << ']';
-
- string::const_iterator it = getContents().begin();
- string::const_iterator end = getContents().end();
- // Paranoia check: make sure that there is no whitespace in here
- string content;
- char last = ',';
- for (; it != end; ++it) {
- if (*it != ' ')
- last = *it;
- if (*it != ' ' || last != ',')
- content += *it;
- }


-       os << '{' << content << '}';
+       os << '{' << cleanupWhitespace(getContents()) << '}';

        return 0;
 }
Index: src/insets/insetcite.h
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/insets/insetcite.h,v
retrieving revision 1.52
diff -u -p -r1.52 insetcite.h
--- src/insets/insetcite.h      2004/08/14 18:41:27     1.52
+++ src/insets/insetcite.h      2004/10/21 07:35:13
@@ -40,6 +40,9 @@ public:
        int latex(Buffer const &, std::ostream &,
                  OutputParams const &) const;
        ///
+       int docbook(Buffer const &, std::ostream &,
+                 OutputParams const &) const;
+       ///
        void validate(LaTeXFeatures &) const;

 private:



Reply via email to