Skip to content

Commit

Permalink
Issue #82: Added test for markdown code highlight extension
Browse files Browse the repository at this point in the history
  • Loading branch information
navilan committed Nov 9, 2011
1 parent 1151820 commit 82a521f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
8 changes: 5 additions & 3 deletions README.rst
Expand Up @@ -107,14 +107,16 @@ Any PyFS dependencies (Example: `boto` for S3 publishing)
need to be installed seprately as well.

::
pip install fs
pip install boto

pip install fs
pip install boto

To get additional help on PyFS backends, you can run the following
command once PyFS is installed:

::
fsls --listopeners

fsls --listopeners

Examples
--------
Expand Down
34 changes: 33 additions & 1 deletion hyde/tests/test_jinja2template.py
Expand Up @@ -209,6 +209,39 @@ def test_markdown_with_extensions():
html = t.render(source, {}).strip()
assert html == u'<h3 id="heading_3">Heading 3</h3>'

def test_markdown_with_sourcecode():
source = """
{%markdown%}
# Code
:::python
def add(a, b):
return a + b
See [Example][]
[Example]: example.html
{%endmarkdown%}
"""

expected = """
<h1>Code</h1>
<div class="codehilite"><pre><span class="k">def</span> <span class="nf">add</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
<span class="k">return</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span>
</pre></div>
<p>See <a href="example.html">Example</a></p>
"""
t = Jinja2Template(JINJA2.path)
s = Site(JINJA2.path)
c = Config(JINJA2.path, config_dict=dict(
markdown=dict(extensions=['codehilite'])))
s.config = c
t.configure(s)
html = t.render(source, {}).strip()
assert html.strip() == expected.strip()


def test_line_statements():
source = """
Expand Down Expand Up @@ -713,6 +746,5 @@ def test_urldecode_filter(self):
t = Jinja2Template(JINJA2.path)
t.configure(None)
html = t.render(text, {}).strip()
print html
assert html.strip() == expected.strip()

0 comments on commit 82a521f

Please sign in to comment.