Browse Source

Issue #82: Added test for markdown code highlight extension

main
Lakshmi Vyasarajan 14 years ago
parent
commit
82a521f45f
2 changed files with 38 additions and 4 deletions
  1. +5
    -3
      README.rst
  2. +33
    -1
      hyde/tests/test_jinja2template.py

+ 5
- 3
README.rst View File

@@ -107,14 +107,16 @@ Any PyFS dependencies (Example: `boto` for S3 publishing)
need to be installed seprately as well. 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 To get additional help on PyFS backends, you can run the following
command once PyFS is installed: command once PyFS is installed:


:: ::
fsls --listopeners

fsls --listopeners


Examples Examples
-------- --------


+ 33
- 1
hyde/tests/test_jinja2template.py View File

@@ -209,6 +209,39 @@ def test_markdown_with_extensions():
html = t.render(source, {}).strip() html = t.render(source, {}).strip()
assert html == u'<h3 id="heading_3">Heading 3</h3>' 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(): def test_line_statements():
source = """ source = """
@@ -713,6 +746,5 @@ item_list:
t = Jinja2Template(JINJA2.path) t = Jinja2Template(JINJA2.path)
t.configure(None) t.configure(None)
html = t.render(text, {}).strip() html = t.render(text, {}).strip()
print html
assert html.strip() == expected.strip() assert html.strip() == expected.strip()



Loading…
Cancel
Save