##// END OF EJS Templates
Moved more code to Strings utilities file
Jonathan Frederic -
Show More
@@ -46,7 +46,7 b' from .utils import get_lines #TODO'
46 46 from .utils import remove_ansi #TODO
47 47 from .utils import highlight, ansi2html #TODO
48 48 from .latex_transformer import rm_math_space #TODO
49 from .utils.strings import wrap as _wrap
49 import .utils.strings as strings
50 50
51 51 #Jinja2 filters
52 52 from .jinja_filters import (python_comment,
@@ -208,8 +208,8 b' class Exporter(Configurable):'
208 208 self.env.filters['markdown2latex'] = markdown2latex
209 209 self.env.filters['markdown2rst'] = markdown2rst
210 210 self.env.filters['get_lines'] = get_lines
211 self.env.filters['wrap'] = _wrap
212 self.env.filters['rm_dollars'] = _rm_dollars
211 self.env.filters['wrap'] = strings.wrap
212 self.env.filters['rm_dollars'] = strings.strip_dollars
213 213 self.env.filters['rm_math_space'] = rm_math_space
214 214 self.env.filters['highlight2html'] = highlight
215 215 self.env.filters['highlight2latex'] = highlight2latex
@@ -293,12 +293,6 b' class Exporter(Configurable):'
293 293 def _rm_fake(strng):
294 294 return strng.replace('/files/', '')
295 295
296
297 #TODO: Comment me.
298 def _rm_dollars(strng):
299 return strng.strip('$')
300
301
302 296 #TODO: Comment me.
303 297 def _python_comment(string):
304 298 return '# '+'\n# '.join(string.split('\n'))
@@ -21,9 +21,15 b' import textwrap #TODO'
21 21 # Functions
22 22 #-----------------------------------------------------------------------------
23 23 def wrap(text, width=100):
24 """ Try to detect and wrap paragraph"""
24 """ Intelligently wrap text"""
25 25
26 26 splitt = text.split('\n')
27 27 wrp = map(lambda x:textwrap.wrap(x,width),splitt)
28 28 wrpd = map('\n'.join, wrp)
29 return '\n'.join(wrpd) No newline at end of file
29 return '\n'.join(wrpd)
30
31
32 def strip_dollars(text):
33 """Remove all dollar symbols from text"""
34
35 return text.strip('$') No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now