Пример #1
0
    def test_run_with_default_opts(self):
        content = parser('''\
asd
---

.. blohg-attachmentimage:: foo.jpg
''', 3)
        self.url_for.assert_called_once_with('attachments', filename='foo.jpg',
                                             _external=True)
        self.assertIn('http://lol/foo.jpg', content['images'])
        self.assertIn('src="http://lol/foo.jpg"', content['fragment'])
Пример #2
0
    def test_run_with_default_opts(self):
        content = parser('''\
asd
---

.. blohg-attachmentimage:: foo.jpg
''', 3)
        self.url_for.assert_called_once_with('attachments', filename='foo.jpg',
                                             _external=True)
        self.assertIn('http://lol/foo.jpg', content['images'])
        self.assertIn('src="http://lol/foo.jpg"', content['fragment'])
Пример #3
0
    def test_simple_include(self):
        content = parser('''\
asd
===

hahah

.. blohg-includehg:: content/foo.rst
''', 3)
        self.assertIn('<h3>Included paragraph</h3>', content['fragment'])
        self.assertIn('<p>lol</p>', content['fragment'])
        self.assertIn('<p>XD</p>', content['fragment'])
Пример #4
0
    def test_simple_include(self):
        content = parser('''\
asd
===

hahah

.. blohg-includehg:: content/foo.rst
''', 3)
        self.assertIn('<h3>Included paragraph</h3>', content['fragment'])
        self.assertIn('<p>lol</p>', content['fragment'])
        self.assertIn('<p>XD</p>', content['fragment'])
Пример #5
0
    def test_include_literal(self):
        content = parser('''\
asd
===

hahah

.. blohg-includehg:: content/foo.rst
   :literal:
''', 3)
        self.assertIn('\nIncluded paragraph\n', content['fragment'])
        self.assertIn('\nlol\n', content['fragment'])
        self.assertIn('\nXD\n', content['fragment'])
Пример #6
0
    def test_include_literal(self):
        content = parser('''\
asd
===

hahah

.. blohg-includehg:: content/foo.rst
   :literal:
''', 3)
        self.assertIn('\nIncluded paragraph\n', content['fragment'])
        self.assertIn('\nlol\n', content['fragment'])
        self.assertIn('\nXD\n', content['fragment'])
Пример #7
0
    def test_run_with_default_opts(self):
        content = parser('''\
asd
---

.. blohg-vimeo:: 34368016
''', 3)
        self.assertIn('http://player.vimeo.com/video/34368016',
                      content['fragment'])
        self.assertIn('width: 425px', content['fragment'])
        self.assertIn('height: 344px', content['fragment'])
        self.assertIn('align-center', content['fragment'])
        self.assertIn('frameborder="0"', content['fragment'])
        self.assertIn('allowfullscreen', content['fragment'])
Пример #8
0
    def test_run_with_default_opts(self):
        content = parser('''\
asd
---

.. blohg-youtube:: ssMfQ9ybTEc
''', 3)
        self.assertIn('http://www.youtube.com/embed/ssMfQ9ybTEc',
                      content['fragment'])
        self.assertIn('width: 425px', content['fragment'])
        self.assertIn('height: 344px', content['fragment'])
        self.assertIn('align-center', content['fragment'])
        self.assertIn('frameborder="0"', content['fragment'])
        self.assertIn('allowfullscreen', content['fragment'])
Пример #9
0
    def test_run_with_default_opts(self):
        content = parser('''\
asd
---

.. blohg-sourcecode:: python

    import os

    print os.path

''', 3)
        self.assertIn('class="highlight"', content['fragment'])
        self.assertIn('import', content['fragment'])
Пример #10
0
    def test_run_with_default_opts(self):
        content = parser('''\
asd
---

.. blohg-math::

   \\frac{x^2}{1+x}
''', 3)
        self.assertIn('https://chart.googleapis.com/chart?cht=tx&chl='
                      '%5Cfrac%7Bx%5E2%7D%7B1%2Bx%7D', content['images'])
        self.assertIn('https://chart.googleapis.com/chart?cht=tx&amp;'
                      'chl=%5Cfrac%7Bx%5E2%7D%7B1%2Bx%7D', content['fragment'])
        self.assertIn('align-center', content['fragment'])
Пример #11
0
    def test_run_with_default_opts(self):
        content = parser('''\
asd
---

.. blohg-vimeo:: 34368016
''', 3)
        self.assertIn('http://player.vimeo.com/video/34368016',
                      content['fragment'])
        self.assertIn('width: 425px', content['fragment'])
        self.assertIn('height: 344px', content['fragment'])
        self.assertIn('align-center', content['fragment'])
        self.assertIn('frameborder="0"', content['fragment'])
        self.assertIn('allowfullscreen', content['fragment'])
Пример #12
0
    def test_run_with_default_opts(self):
        content = parser('''\
asd
---

.. blohg-math::

   \\frac{x^2}{1+x}
''', 3)
        self.assertIn('https://chart.googleapis.com/chart?cht=tx&chl='
                      '%5Cfrac%7Bx%5E2%7D%7B1%2Bx%7D', content['images'])
        self.assertIn('https://chart.googleapis.com/chart?cht=tx&amp;'
                      'chl=%5Cfrac%7Bx%5E2%7D%7B1%2Bx%7D', content['fragment'])
        self.assertIn('align-center', content['fragment'])
Пример #13
0
    def test_run_with_default_opts(self):
        content = parser('''\
asd
---

.. blohg-sourcecode:: python

    import os

    print os.path

''', 3)
        self.assertIn('class="highlight"', content['fragment'])
        self.assertIn('import', content['fragment'])
Пример #14
0
    def test_run_with_default_opts(self):
        content = parser('''\
asd
---

.. blohg-youtube:: ssMfQ9ybTEc
''', 3)
        self.assertIn('http://www.youtube.com/embed/ssMfQ9ybTEc',
                      content['fragment'])
        self.assertIn('width: 425px', content['fragment'])
        self.assertIn('height: 344px', content['fragment'])
        self.assertIn('align-center', content['fragment'])
        self.assertIn('frameborder="0"', content['fragment'])
        self.assertIn('allowfullscreen', content['fragment'])
Пример #15
0
    def test_include_with_start_and_end(self):
        content = parser('''\
asd
===

hahah

.. blohg-includehg:: content/foo.rst
   :start-line: 3
   :end-line: 4
''', 3)
        self.assertNotIn('<h3>Included paragraph</h3>', content['fragment'])
        self.assertIn('<p>lol</p>', content['fragment'])
        self.assertNotIn('<p>XD</p>', content['fragment'])
Пример #16
0
    def test_include_with_start_and_end(self):
        content = parser('''\
asd
===

hahah

.. blohg-includehg:: content/foo.rst
   :start-line: 3
   :end-line: 4
''', 3)
        self.assertNotIn('<h3>Included paragraph</h3>', content['fragment'])
        self.assertIn('<p>lol</p>', content['fragment'])
        self.assertNotIn('<p>XD</p>', content['fragment'])
Пример #17
0
    def test_run_with_argument_for_subsubpage(self):
        content = parser('''\
asd
---

.. blohg-subpages:: foo/bar
''', 3)
        self.assertNotIn('"/foo/"', content['fragment'])
        self.assertNotIn('>Foo :)<', content['fragment'])
        self.assertNotIn('"/bar/"', content['fragment'])
        self.assertNotIn('>Bar!<', content['fragment'])
        self.assertNotIn('"/foo/bar/"', content['fragment'])
        self.assertNotIn('>Foo Bar :P<', content['fragment'])
        self.assertIn('"/foo/bar/baz/"', content['fragment'])
        self.assertIn('>Foo Bar Baz XD<', content['fragment'])
Пример #18
0
    def test_run_with_argument_from_subpage(self):
        content = parser('''\
asd
---

.. blohg-subpages:: foo
''', 3, ':repo:cont/foo/index.rs')
        self.assertNotIn('"/foo/"', content['fragment'])
        self.assertNotIn('>Foo :)<', content['fragment'])
        self.assertNotIn('"/bar/"', content['fragment'])
        self.assertNotIn('>Bar!<', content['fragment'])
        self.assertIn('"/foo/bar/"', content['fragment'])
        self.assertIn('>Foo Bar :P<', content['fragment'])
        self.assertNotIn('"/foo/bar/baz/"', content['fragment'])
        self.assertNotIn('>Foo Bar Baz XD<', content['fragment'])
Пример #19
0
    def test_run(self):
        content = parser('''\
asd
---

.. blohg-sourcecode:: python
   :linenos:

    import os

    print os.path

''', 3)
        self.assertIn('class="lineno">3', content['fragment'])
        self.assertIn('import', content['fragment'])
Пример #20
0
    def test_run_with_argument_from_subpage(self):
        content = parser('''\
asd
---

.. blohg-subpages:: foo
''', 3, ':repo:cont/foo/index.rs')
        self.assertNotIn('"/foo/"', content['fragment'])
        self.assertNotIn('>Foo :)<', content['fragment'])
        self.assertNotIn('"/bar/"', content['fragment'])
        self.assertNotIn('>Bar!<', content['fragment'])
        self.assertIn('"/foo/bar/"', content['fragment'])
        self.assertIn('>Foo Bar :P<', content['fragment'])
        self.assertNotIn('"/foo/bar/baz/"', content['fragment'])
        self.assertNotIn('>Foo Bar Baz XD<', content['fragment'])
Пример #21
0
    def test_run(self):
        content = parser('''\
asd
---

.. blohg-sourcecode:: python
   :linenos:

    import os

    print os.path

''', 3)
        self.assertIn('class="lineno">3', content['fragment'])
        self.assertIn('import', content['fragment'])
Пример #22
0
    def test_run(self):
        content = parser('''\
asd
---

.. blohg-attachmentfigure:: foo.jpg
   :align: left

   asdf lol.

''', 3)
        self.url_for.assert_called_once_with('attachments', filename='foo.jpg',
                                             _external=True)
        self.assertIn('http://lol/foo.jpg', content['images'])
        self.assertIn('src="http://lol/foo.jpg"', content['fragment'])
        self.assertIn('caption">asdf lol.', content['fragment'])
        self.assertIn('align-left', content['fragment'])
Пример #23
0
    def test_run(self):
        content = parser('''\
asd
---

.. blohg-attachmentfigure:: foo.jpg
   :align: left

   asdf lol.

''', 3)
        self.url_for.assert_called_once_with('attachments', filename='foo.jpg',
                                             _external=True)
        self.assertIn('http://lol/foo.jpg', content['images'])
        self.assertIn('src="http://lol/foo.jpg"', content['fragment'])
        self.assertIn('caption">asdf lol.', content['fragment'])
        self.assertIn('align-left', content['fragment'])
Пример #24
0
    def test_run_with_argument_for_subsubpage(self):
        content = parser('''\
asd
---

.. blohg-subpages:: foo/bar
''', 3)
        self.assertNotIn('"/foo/"', content['fragment'])
        self.assertNotIn('>Foo :)<', content['fragment'])
        self.assertNotIn('"/bar/"', content['fragment'])
        self.assertNotIn('>Bar!<', content['fragment'])
        self.assertNotIn('"/foo/bar/"', content['fragment'])
        self.assertNotIn('>Foo Bar :P<', content['fragment'])
        self.assertIn('"/foo/bar/baz/"', content['fragment'])
        self.assertIn('>Foo Bar Baz XD<', content['fragment'])
        self.assertNotIn('>Foo Bar Bad XD<', content['fragment'])
        self.assertIn('"/foo/bar/bad/"', content['fragment'])
        self.assertIn('###asd###', content['fragment'])
Пример #25
0
    def test_run(self):
        content = parser('''\
asd
---

.. blohg-vimeo:: 34368016
   :align: left
   :width: 100
   :height: 200
   :allowfullscreen: false
   :border: 1
''', 3)
        self.assertIn('http://player.vimeo.com/video/34368016',
                      content['fragment'])
        self.assertIn('width: 100px', content['fragment'])
        self.assertIn('height: 200px', content['fragment'])
        self.assertIn('align-left', content['fragment'])
        self.assertIn('frameborder="1"', content['fragment'])
        self.assertNotIn('allowfullscreen', content['fragment'])
Пример #26
0
    def test_run(self):
        content = parser('''\
asd
---

.. blohg-youtube:: ssMfQ9ybTEc
   :align: left
   :width: 100
   :height: 200
   :allowfullscreen: false
   :border: 1
''', 3)
        self.assertIn('http://www.youtube.com/embed/ssMfQ9ybTEc',
                      content['fragment'])
        self.assertIn('width: 100px', content['fragment'])
        self.assertIn('height: 200px', content['fragment'])
        self.assertIn('align-left', content['fragment'])
        self.assertIn('frameborder="1"', content['fragment'])
        self.assertNotIn('allowfullscreen', content['fragment'])
Пример #27
0
    def test_run(self):
        content = parser('''\
asd
---

.. blohg-youtube:: ssMfQ9ybTEc
   :align: left
   :width: 100
   :height: 200
   :allowfullscreen: false
   :border: 1
''', 3)
        self.assertIn('http://www.youtube.com/embed/ssMfQ9ybTEc',
                      content['fragment'])
        self.assertIn('width: 100px', content['fragment'])
        self.assertIn('height: 200px', content['fragment'])
        self.assertIn('align-left', content['fragment'])
        self.assertIn('frameborder="1"', content['fragment'])
        self.assertNotIn('allowfullscreen', content['fragment'])
Пример #28
0
    def test_run(self):
        content = parser('''\
asd
---

.. blohg-vimeo:: 34368016
   :align: left
   :width: 100
   :height: 200
   :allowfullscreen: false
   :border: 1
''', 3)
        self.assertIn('http://player.vimeo.com/video/34368016',
                      content['fragment'])
        self.assertIn('width: 100px', content['fragment'])
        self.assertIn('height: 200px', content['fragment'])
        self.assertIn('align-left', content['fragment'])
        self.assertIn('frameborder="1"', content['fragment'])
        self.assertNotIn('allowfullscreen', content['fragment'])
Пример #29
0
 def parsed_source(self):
     return parser(self.full, self._rst_header_level,
                   ':repo:%s' % self.path)
Пример #30
0
 def parsed_abstract(self):
     if not self.read_more:
         return self.parsed_source
     return parser(self.abstract, self._rst_header_level,
                   ':repo:%s' % self.path)
Пример #31
0
 def parsed_abstract(self):
     if not self.read_more:
         return self.parsed_source
     return parser(self.abstract, self._rst_header_level,
                   ':repo:%s' % self.path)
Пример #32
0
 def parsed_source(self):
     return parser(self.full, self._rst_header_level,
                   ':repo:%s' % self.path)