@@ -71,26 +71,11 @@ def checklistInENMLtoSoup(soup):
7171 '''
7272 Transforms Evernote checklist elements to github `* [ ]` task list style
7373 '''
74- transform_tags = ['p' , 'div' ]
74+ for section in soup .findAll ('en-todo' , checked = 'true' ):
75+ section .replace_with ('<br />* [x]' )
7576
76- # soup.select cant be used with dashes: https://bugs.launchpad.net/beautifulsoup/+bug/1276211
77- for todo in soup .find_all ('en-todo' ):
78- parent = todo .parent
79- transform = parent .find () == todo and parent .name in transform_tags
80-
81- checked = todo .attrs .get ('checked' , None ) == "true"
82- todo .replace_with ("[x] " if checked else "[ ] " )
83-
84- # EN checklist can appear anywhere, but if they appear at the beginning
85- # of a block element, transform it so it ressembles github markdown syntax
86- if transform :
87- content = '' .join (unicode (child ) for child in parent .children
88- if isinstance (child , NavigableString )
89- ).strip ()
90-
91- new_tag = soup .new_tag ("li" )
92- new_tag .string = content
93- parent .replace_with (new_tag )
77+ for section in soup .findAll ('en-todo' ):
78+ section .replace_with ('<br />* [ ]' )
9479
9580 @staticmethod
9681 def ENMLtoText (contentENML , format = 'default' , imageOptions = {'saveImages' : False }, imageFilename = "" ):
@@ -133,12 +118,6 @@ def ENMLtoText(contentENML, format='default', imageOptions={'saveImages': False}
133118
134119 Editor .checklistInENMLtoSoup (soup )
135120
136- for section in soup .findAll ('en-todo' , checked = 'true' ):
137- section .replace_with ('[x]' )
138-
139- for section in soup .findAll ('en-todo' ):
140- section .replace_with ('[ ]' )
141-
142121 # change <en-media> tags to <img> tags
143122 if 'saveImages' in imageOptions and imageOptions ['saveImages' ]:
144123 for section in soup .findAll ('en-media' ):
0 commit comments