Skip to content

Commit

Permalink
tab to 5 spaces for #24
Browse files Browse the repository at this point in the history
  • Loading branch information
nvbn committed Oct 19, 2012
1 parent e756517 commit 07cab36
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions everpad/pad/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,15 @@ def content(self):
del todo['type']
for media in soup.findAll('img'):
if media.get('class') == 'tab':
media.replaceWith('\t')
media.replaceWith(' ' * 5)
if media.get('hash'):
media.name = 'en-media'
del media['src']
self._content = reduce(
lambda txt, cur: txt + unicode(cur),
self._sanitize(soup.find(id='content')).contents,
u'').replace('\n', '')
print self._content
return self._content

@content.setter
Expand All @@ -238,7 +239,8 @@ def content(self, val):
media['src'] = ''
else:
media.hidden = True
self._content = unicode(soup).replace('\t', '<img class="tab" />') # shit!
self._content = unicode(soup).replace(' ' * 5, '<img class="tab" />') # shit!
print self._content
self.apply()

def _sanitize(self, soup): # TODO: optimize it
Expand Down

0 comments on commit 07cab36

Please sign in to comment.