Beispiel #1
0
 def test_escape_tex(self):
     self.assertEquals(utils.tex_escape('Line one\nLine two\nLine three'),
                       'Line one\\\\\nLine two\\\\\nLine three')
     self.assertEquals(utils.tex_escape('Line one\n\nLine three'),
                       'Line one\\\\\n~\\\\\nLine three')
     self.assertEquals(
         utils.tex_escape('Line one\r\nLine two\r\nLine three'),
         'Line one\\\\\nLine two\\\\\nLine three')
Beispiel #2
0
 def test_escape_tex(self):
     self.assertEquals(
         utils.tex_escape('Line one\nLine two\nLine three'),
         'Line one\\\\\nLine two\\\\\nLine three'
     )
     self.assertEquals(
         utils.tex_escape('Line one\n\nLine three'),
         'Line one\\\\\n~\\\\\nLine three'
     )
Beispiel #3
0
    def all_published_posts_as_latex_list(self):
        from correspondence.utils import tex_escape
        posts = self.user.documents_authored.public().order_by('date_written')
        parts = [ur'\begin{itemize}']
        for post in posts:
            if post.in_reply_to:
                try:
                    orig = posts.get(reply_code=post.in_reply_to)
                except Document.DoesNotExist:
                    title = post.get_title()
                else:
                    title = u'{} (in reply to {})'.format(
                        post.get_title(), orig.get_title())
            else:
                title = post.get_title()

            parts.append(
                ur'  \item %s (\emph{%s})' %
                (tex_escape(title), post.date_written.strftime('%Y-%m-%d')))
        parts.append(ur'\end{itemize}')
        return u"\n".join(parts)
Beispiel #4
0
    def all_published_posts_as_latex_list(self):
        from correspondence.utils import tex_escape
        posts = self.user.documents_authored.public().order_by('date_written')
        parts = [ur'\begin{itemize}']
        for post in posts:
            if post.in_reply_to:
                try:
                    orig = posts.get(reply_code=post.in_reply_to)
                except Document.DoesNotExist:
                    title = post.get_title()
                else:
                    title = u'{} (in reply to {})'.format(
                        post.get_title(),
                        orig.get_title()
                    )
            else:
                title = post.get_title()

            parts.append(ur'  \item %s (\emph{%s})' % (
                tex_escape(title), 
                post.date_written.strftime('%Y-%m-%d')
            ))
        parts.append(ur'\end{itemize}')
        return u"\n".join(parts)
Beispiel #5
0
def tex_escape(value):
    return utils.tex_escape(value)
Beispiel #6
0
def tex_escape(value):
    return utils.tex_escape(value)