+namespace {
+
+docstring const cleanupWhitespace(docstring const & citelist)
+{
+ docstring::const_iterator it = citelist.begin();
+ docstring::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
+ docstring result;
+ char_type last = ',';
+ for (; it != end; ++it) {
+ if (*it != ' ')
+ last = *it;
+ if (*it != ' ' || last != ',')
+ result += *it;
+ }
+ return result;
+}
+
+// end anon namyspace
+}
+
+int InsetCitation::docbook(Buffer const &, odocstream & os, OutputParams const &) const
+{
+ os << "<citation>"
+ << cleanupWhitespace(getParam("key"))
+ << "</citation>";
+ return 0;
+}
+
+
+int InsetCitation::textString(Buffer const & buf, odocstream & os,
+ OutputParams const & op) const
+{
+ return plaintext(buf, os, op);
+}
+
+