예제 #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
파일: directives.py 프로젝트: liuyxpp/blohg
    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
파일: directives.py 프로젝트: liuyxpp/blohg
    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
파일: directives.py 프로젝트: liuyxpp/blohg
    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
파일: directives.py 프로젝트: liuyxpp/blohg
    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
파일: directives.py 프로젝트: liuyxpp/blohg
    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
파일: directives.py 프로젝트: liuyxpp/blohg
    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
파일: directives.py 프로젝트: liuyxpp/blohg
    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
파일: directives.py 프로젝트: liuyxpp/blohg
    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
파일: directives.py 프로젝트: liuyxpp/blohg
    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
파일: directives.py 프로젝트: liuyxpp/blohg
    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
파일: directives.py 프로젝트: liuyxpp/blohg
    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
파일: directives.py 프로젝트: liuyxpp/blohg
    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
파일: directives.py 프로젝트: liuyxpp/blohg
    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
파일: directives.py 프로젝트: liuyxpp/blohg
    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
파일: models.py 프로젝트: RMCampos/blohg
 def parsed_source(self):
     return parser(self.full, self._rst_header_level,
                   ':repo:%s' % self.path)
예제 #30
0
파일: models.py 프로젝트: liuyxpp/blohg
 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
파일: models.py 프로젝트: RMCampos/blohg
 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
파일: models.py 프로젝트: liuyxpp/blohg
 def parsed_source(self):
     return parser(self.full, self._rst_header_level,
                   ':repo:%s' % self.path)