summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f6024e9)
raw | patch | inline | side by side (parent: f6024e9)
author | joncruz <joncruz@users.sourceforge.net> | |
Sat, 14 Mar 2009 08:19:42 +0000 (08:19 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Sat, 14 Mar 2009 08:19:42 +0000 (08:19 +0000) |
src/xml/repr-io.cpp | patch | blob | history |
diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp
index 3bc79a98c99895bb13f6dee1fd64fc26805a46c6..e503540bbee7841ea3f94215b7831896161ede12 100644 (file)
--- a/src/xml/repr-io.cpp
+++ b/src/xml/repr-io.cpp
}
}
+static void repr_write_comment( Writer &out, const gchar * val, bool addWhitespace, gint indentLevel, int indent )
+{
+ if ( indentLevel > 16 ) {
+ indentLevel = 16;
+ }
+ if (addWhitespace && indent) {
+ for (gint i = 0; i < indentLevel; i++) {
+ for (gint j = 0; j < indent; j++) {
+ out.writeString(" ");
+ }
+ }
+ }
+
+ out.writeString("<!--");
+ // WARNING out.printf() and out.writeString() are *NOT* non-ASCII friendly.
+ if (val) {
+ for (const gchar* cur = val; *cur; cur++ ) {
+ out.writeChar(*cur);
+ }
+ } else {
+ out.writeString(" ");
+ }
+ out.writeString("-->");
+
+ if (addWhitespace) {
+ out.writeString("\n");
+ }
+}
+
namespace {
typedef std::map<Glib::QueryQuark, gchar const *, Inkscape::compare_quark_ids> LocalNameMap;
break;
}
case Inkscape::XML::COMMENT_NODE: {
- out.printf( "<!--%s-->", repr->content() );
+ repr_write_comment( out, repr->content(), add_whitespace, indent_level, indent );
break;
}
case Inkscape::XML::PI_NODE: {