summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-04-28 02:12:17 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-04-28 02:12:17 +0000
commit552d1567eefc8a6515947a67d8abc0de3d578f61 (patch)
treee311f52c9441b7a23f2ba4d60b0f72c56a922d2d
parent08d6ab26956b8fcc443ca7b9162ee3fee0ed8af6 (diff)
downloadgobject-introspection-552d1567eefc8a6515947a67d8abc0de3d578f61.tar.gz
Include indentation in line length calculation
2008-04-27 Johan Dahlin <johan@gnome.org> * giscanner/xmlwriter.py: * tests/parser/Foo-expected.gir: Include indentation in line length calculation svn path=/trunk/; revision=239
-rw-r--r--ChangeLog6
-rw-r--r--giscanner/xmlwriter.py8
-rw-r--r--tests/parser/Foo-expected.gir4
3 files changed, 14 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 8045843a..f75859ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2008-04-27 Johan Dahlin <johan@gnome.org>
+ * giscanner/xmlwriter.py:
+ * tests/parser/Foo-expected.gir:
+ Include indentation in line length calculation
+
+2008-04-27 Johan Dahlin <johan@gnome.org>
+
* giscanner/girparser.py:
Prettify NS parsing using elementtree.
diff --git a/giscanner/xmlwriter.py b/giscanner/xmlwriter.py
index 53926d7c..cfb8a774 100644
--- a/giscanner/xmlwriter.py
+++ b/giscanner/xmlwriter.py
@@ -32,17 +32,19 @@ class XMLWriter(object):
# Private
- def _calc_attrs_length(self, attributes):
+ def _calc_attrs_length(self, attributes, indent):
+ if indent == -1:
+ return -1
attr_length = 0
for attr, value in attributes:
attr_length += 1 + len(attr) + len(quoteattr(value))
- return attr_length
+ return attr_length + indent
def _collect_attributes(self, attributes, indent=-1):
if not attributes:
return ''
- if indent != -1 and self._calc_attrs_length(attributes) > 79:
+ if self._calc_attrs_length(attributes, indent) > 79:
indent_len = self._indent + indent
else:
indent_len = 0
diff --git a/tests/parser/Foo-expected.gir b/tests/parser/Foo-expected.gir
index 6dee16a7..4996e05f 100644
--- a/tests/parser/Foo-expected.gir
+++ b/tests/parser/Foo-expected.gir
@@ -210,7 +210,9 @@
<member name="FOO_ENUM_DEUX" value="2"/>
<member name="FOO_ENUM_TROIS" value="3"/>
</enumeration>
- <glib:boxed glib:name="Boxed" glib:type-name="FooBoxed" glib:get-type="foo_boxed_get_type">
+ <glib:boxed glib:name="Boxed"
+ glib:type-name="FooBoxed"
+ glib:get-type="foo_boxed_get_type">
<constructor name="new" c:identifier="foo_boxed_new">
<return-value c:identifer="Boxed*">
<type name="Boxed*"/>