~fmos/zim/features

« back to all changes in this revision

Viewing changes to zim/formats/__init__.py

  • Committer: Fabian Moser
  • Date: 2011-01-26 20:33:29 UTC
  • mfrom: (297.1.43 pyzim-trunk)
  • Revision ID: e-mail+launchpad@fabianmoser.at-20110126203329-9qhtvpsf169hb18y
Merged main branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
281
281
 
282
282
                return count
283
283
 
 
284
        def get_ends_with_newline(self):
 
285
                '''Checks whether this tree ends in a newline or not'''
 
286
                newline = False
 
287
                for element in self.getiterator():
 
288
                        if element.tail:
 
289
                                newline = element.tail.endswith('\n')
 
290
                        elif element.tag in ('li', 'h'):
 
291
                                newline = True
 
292
                        elif element.text:
 
293
                                newline = element.text.endswith('\n')
 
294
 
 
295
                return newline
 
296
 
284
297
 
285
298
count_eol_re = re.compile(r'\n+\Z')
286
299
split_para_re = re.compile(r'((?:^[ \t]*\n){2,})', re.M)