Dolda2000 GitWeb
/
wrw.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7e9080a
)
Improved indentation a bit further.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Sat, 28 Dec 2013 05:47:37 +0000
(06:47 +0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Sat, 28 Dec 2013 05:47:37 +0000
(06:47 +0100)
wrw/sp/util.py
patch
|
blob
|
blame
|
history
diff --git
a/wrw/sp/util.py
b/wrw/sp/util.py
index
02f61f0
..
2599206
100644
(file)
--- a/
wrw/sp/util.py
+++ b/
wrw/sp/util.py
@@
-229,6
+229,7
@@
class indenter(formatter):
self.inline = False
self.stack = []
self.last = None, None
self.inline = False
self.stack = []
self.last = None, None
+ self.lastendbr = True
def write(self, text):
lines = text.split(u"\n")
def write(self, text):
lines = text.split(u"\n")
@@
-262,7
+263,7
@@
class indenter(formatter):
def starttag(self, el):
if not self.inline:
def starttag(self, el):
if not self.inline:
- if self.last[0] == "<" and self.last[1].name == el.name:
+ if self.last[0] == "<" and self.last[1].name == el.name
and self.lastendbr
:
pass
else:
self.br()
pass
else:
self.br()
@@
-279,8
+280,11
@@
class indenter(formatter):
def endtag(self, el):
il = self.inline
self.pop()
def endtag(self, el):
il = self.inline
self.pop()
- if not il:
+ if il or (self.last[0] == ">" and self.last[1] == el):
+ self.lastendbr = False
+ else:
self.br()
self.br()
+ self.lastendbr = True
super(indenter, self).endtag(el)
def start(self, el):
super(indenter, self).endtag(el)
def start(self, el):