コード例 #1
0
ファイル: test_templatetags.py プロジェクト: lip365/ebagu0.2
 def test_render_fallback_markup_comment(self):
     with patch.multiple('django_comments_xtd.conf.settings',
                         COMMENTS_XTD_MARKUP_FALLBACK_FILTER=None):
         comment = r'''An [example](http://url.com/ "Title")'''
         result = render_markup_comment(comment)
         self.assertEqual(result,
                          r'''An [example](http://url.com/ "Title")''')
コード例 #2
0
ファイル: test_templatetags.py プロジェクト: lip365/ebagu0.2
    def test_render_markup_comment_in_markdown(self):
        comment = r'''#!markdown
An [example](http://url.com/ "Title")'''
        result = render_markup_comment(comment)
        self.assertEqual(
            result,
            '<p>An <a href="http://url.com/" title="Title">example</a></p>')
コード例 #3
0
 def test_render_markup_comment_in_restructuredtext(self):
     comment = ('#!restructuredtext\n'
                'A fibonacci generator in Python, taken from '
                '`LiteratePrograms <http://en.literateprograms.org/'
                'Fibonacci_numbers_%28Python%29>`_::\n\n'
                '    def fib():\n'
                '        a, b = 0, 1\n'
                '        while 1:\n'
                '            yield a\n'
                '            a, b = b, a + b')
     result = render_markup_comment(comment)
     self.assertEqual(result,
                      ('<div class="document">\n'
                       '<p>A fibonacci generator in Python, taken from '
                       '<a class="reference external" href="http://en.'
                       'literateprograms.org/Fibonacci_numbers_%28'
                       'Python%29">LiteratePrograms</a>:</p>\n'
                       '<pre class="literal-block">\n'
                       'def fib():\n'
                       '    a, b = 0, 1\n'
                       '    while 1:\n'
                       '        yield a\n'
                       '        a, b = b, a + b\n'
                       '</pre>\n'
                       '</div>\n'))
コード例 #4
0
 def test_render_fallback_markup_comment(self):
     with patch.multiple('django_comments_xtd.conf.settings',
                         COMMENTS_XTD_MARKUP_FALLBACK_FILTER=None):
         comment = r'''An [example](http://url.com/ "Title")'''
         result = render_markup_comment(comment)
         self.assertEqual(result,
                          r'''An [example](http://url.com/ "Title")''')
コード例 #5
0
 def test_render_fallback_markup_comment(self):
     with patch.multiple('django_comments_xtd.conf.settings',
                         COMMENTS_XTD_MARKUP_FALLBACK_FILTER='markdown'):
         comment = r'''An [example](http://url.com/ "Title")'''
         result = render_markup_comment(comment)
         self.assertEqual(result,
                          '<p>An <a href="http://url.com/" title="Title">example</a></p>')
コード例 #6
0
 def test_render_markup_comment_in_restructuredtext(self):
     comment = ('#!restructuredtext\n'
                'A fibonacci generator in Python, taken from '
                '`LiteratePrograms <http://en.literateprograms.org/'
                'Fibonacci_numbers_%28Python%29>`_::\n\n'
                '    def fib():\n'
                '        a, b = 0, 1\n'
                '        while 1:\n'
                '            yield a\n'
                '            a, b = b, a + b')
     result = render_markup_comment(comment)
     self.assertEqual(result,
                      ('<div class="document">\n'
                       '<p>A fibonacci generator in Python, taken from '
                       '<a class="reference external" href="http://en.'
                       'literateprograms.org/Fibonacci_numbers_%28'
                       'Python%29">LiteratePrograms</a>:</p>\n'
                       '<pre class="literal-block">\n'
                       'def fib():\n'
                       '    a, b = 0, 1\n'
                       '    while 1:\n'
                       '        yield a\n'
                       '        a, b = b, a + b\n'
                       '</pre>\n'
                       '</div>\n'))
コード例 #7
0
 def test_render_fallback_markup_comment_markdown(self):
     with patch.multiple('django_comments_xtd.conf.settings',
                         COMMENTS_XTD_MARKUP_FALLBACK_FILTER='markdown'):
         comment = r'''An [example](http://url.com/ "Title")'''
         result = render_markup_comment(comment)
         self.assertEqual(
             result, '<p>An <a href="http://url.com/" '
             'title="Title">example</a></p>')
コード例 #8
0
    def test_render_markup_comment_in_restructuredtext(self):
        comment = r'''#!restructuredtext
A fibonacci generator in Python, taken from `LiteratePrograms <http://en.literateprograms.org/Fibonacci_numbers_%28Python%29>`_::

    def fib():
        a, b = 0, 1
        while 1:
            yield a
            a, b = b, a + b'''
        result = render_markup_comment(comment)
        self.assertEqual(result,
                         r'''<p>A fibonacci generator in Python, taken from <a class="reference external" href="http://en.literateprograms.org/Fibonacci_numbers_%28Python%29">LiteratePrograms</a>:</p>
<pre class="literal-block">
def fib():
    a, b = 0, 1
    while 1:
        yield a
        a, b = b, a + b
</pre>
''')
コード例 #9
0
ファイル: test_templatetags.py プロジェクト: lip365/ebagu0.2
    def test_render_markup_comment_in_restructuredtext(self):
        comment = r'''#!restructuredtext
A fibonacci generator in Python, taken from `LiteratePrograms <http://en.literateprograms.org/Fibonacci_numbers_%28Python%29>`_::

    def fib():
        a, b = 0, 1
        while 1:
            yield a
            a, b = b, a + b'''
        result = render_markup_comment(comment)
        self.assertEqual(
            result,
            r'''<p>A fibonacci generator in Python, taken from <a class="reference external" href="http://en.literateprograms.org/Fibonacci_numbers_%28Python%29">LiteratePrograms</a>:</p>
<pre class="literal-block">
def fib():
    a, b = 0, 1
    while 1:
        yield a
        a, b = b, a + b
</pre>
''')
コード例 #10
0
    def test_render_markup_comment_in_markdown(self):
        comment = r'''#!markdown
An [example](http://url.com/ "Title")'''
        result = render_markup_comment(comment)
        self.assertEqual(result,
                         '<p>An <a href="http://url.com/" title="Title">example</a></p>')