From 552d1567eefc8a6515947a67d8abc0de3d578f61 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Mon, 28 Apr 2008 02:12:17 +0000 Subject: [PATCH] Include indentation in line length calculation 2008-04-27 Johan Dahlin * giscanner/xmlwriter.py: * tests/parser/Foo-expected.gir: Include indentation in line length calculation svn path=/trunk/; revision=239 --- ChangeLog | 6 ++++++ giscanner/xmlwriter.py | 8 +++++--- tests/parser/Foo-expected.gir | 4 +++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8045843..f75859a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2008-04-27 Johan Dahlin + * giscanner/xmlwriter.py: + * tests/parser/Foo-expected.gir: + Include indentation in line length calculation + +2008-04-27 Johan Dahlin + * giscanner/girparser.py: Prettify NS parsing using elementtree. diff --git a/giscanner/xmlwriter.py b/giscanner/xmlwriter.py index 53926d7..cfb8a77 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 6dee16a..4996e05 100644 --- a/tests/parser/Foo-expected.gir +++ b/tests/parser/Foo-expected.gir @@ -210,7 +210,9 @@ - + -- 2.7.4