diff --git a/api/exporter.py b/api/exporter.py index ab85a1e..1c9f8be 100755 --- a/api/exporter.py +++ b/api/exporter.py @@ -46,7 +46,7 @@ from .utils import get_lines #TODO from .utils import remove_ansi #TODO from .utils import highlight, ansi2html #TODO from .latex_transformer import rm_math_space #TODO -from .utils.strings import wrap as _wrap +import .utils.strings as strings #Jinja2 filters from .jinja_filters import (python_comment, @@ -208,8 +208,8 @@ class Exporter(Configurable): self.env.filters['markdown2latex'] = markdown2latex self.env.filters['markdown2rst'] = markdown2rst self.env.filters['get_lines'] = get_lines - self.env.filters['wrap'] = _wrap - self.env.filters['rm_dollars'] = _rm_dollars + self.env.filters['wrap'] = strings.wrap + self.env.filters['rm_dollars'] = strings.strip_dollars self.env.filters['rm_math_space'] = rm_math_space self.env.filters['highlight2html'] = highlight self.env.filters['highlight2latex'] = highlight2latex @@ -293,12 +293,6 @@ class Exporter(Configurable): def _rm_fake(strng): return strng.replace('/files/', '') - - #TODO: Comment me. - def _rm_dollars(strng): - return strng.strip('$') - - #TODO: Comment me. def _python_comment(string): return '# '+'\n# '.join(string.split('\n')) diff --git a/utils/strings.py b/utils/strings.py index e86c620..83141a8 100644 --- a/utils/strings.py +++ b/utils/strings.py @@ -21,9 +21,15 @@ import textwrap #TODO # Functions #----------------------------------------------------------------------------- def wrap(text, width=100): - """ Try to detect and wrap paragraph""" + """ Intelligently wrap text""" splitt = text.split('\n') wrp = map(lambda x:textwrap.wrap(x,width),splitt) wrpd = map('\n'.join, wrp) - return '\n'.join(wrpd) \ No newline at end of file + return '\n'.join(wrpd) + + +def strip_dollars(text): + """Remove all dollar symbols from text""" + + return text.strip('$') \ No newline at end of file