##// 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 from .utils import remove_ansi #TODO
46 from .utils import remove_ansi #TODO
47 from .utils import highlight, ansi2html #TODO
47 from .utils import highlight, ansi2html #TODO
48 from .latex_transformer import rm_math_space #TODO
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 #Jinja2 filters
51 #Jinja2 filters
52 from .jinja_filters import (python_comment,
52 from .jinja_filters import (python_comment,
@@ -208,8 +208,8 b' class Exporter(Configurable):'
208 self.env.filters['markdown2latex'] = markdown2latex
208 self.env.filters['markdown2latex'] = markdown2latex
209 self.env.filters['markdown2rst'] = markdown2rst
209 self.env.filters['markdown2rst'] = markdown2rst
210 self.env.filters['get_lines'] = get_lines
210 self.env.filters['get_lines'] = get_lines
211 self.env.filters['wrap'] = _wrap
211 self.env.filters['wrap'] = strings.wrap
212 self.env.filters['rm_dollars'] = _rm_dollars
212 self.env.filters['rm_dollars'] = strings.strip_dollars
213 self.env.filters['rm_math_space'] = rm_math_space
213 self.env.filters['rm_math_space'] = rm_math_space
214 self.env.filters['highlight2html'] = highlight
214 self.env.filters['highlight2html'] = highlight
215 self.env.filters['highlight2latex'] = highlight2latex
215 self.env.filters['highlight2latex'] = highlight2latex
@@ -293,12 +293,6 b' class Exporter(Configurable):'
293 def _rm_fake(strng):
293 def _rm_fake(strng):
294 return strng.replace('/files/', '')
294 return strng.replace('/files/', '')
295
295
296
297 #TODO: Comment me.
298 def _rm_dollars(strng):
299 return strng.strip('$')
300
301
302 #TODO: Comment me.
296 #TODO: Comment me.
303 def _python_comment(string):
297 def _python_comment(string):
304 return '# '+'\n# '.join(string.split('\n'))
298 return '# '+'\n# '.join(string.split('\n'))
@@ -21,9 +21,15 b' import textwrap #TODO'
21 # Functions
21 # Functions
22 #-----------------------------------------------------------------------------
22 #-----------------------------------------------------------------------------
23 def wrap(text, width=100):
23 def wrap(text, width=100):
24 """ Try to detect and wrap paragraph"""
24 """ Intelligently wrap text"""
25
25
26 splitt = text.split('\n')
26 splitt = text.split('\n')
27 wrp = map(lambda x:textwrap.wrap(x,width),splitt)
27 wrp = map(lambda x:textwrap.wrap(x,width),splitt)
28 wrpd = map('\n'.join, wrp)
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