Fix up tests.
This commit is contained in:
parent
9bd5739b13
commit
602f67498c
|
@ -15,7 +15,7 @@ def src(doc, code, cls="", root=True):
|
|||
except pygments.util.ClassNotFound as e:
|
||||
lexer = get_lexer_by_name(code.attrs.get("language", "text"))
|
||||
|
||||
return highlight(escape(code.value), lexer, HtmlFormatter(linenos=True))
|
||||
return highlight(code.value, lexer, HtmlFormatter(linenos=True))
|
||||
|
||||
|
||||
def img(doc, item, cls="", root=True):
|
||||
|
@ -52,9 +52,10 @@ def blockquote(doc, token, cls="", root=True):
|
|||
|
||||
|
||||
def header(doc, item, cls="", root=True):
|
||||
depth = "1"
|
||||
depth = 1
|
||||
if item.attrs:
|
||||
depth = item.attrs.get("depth", "1")
|
||||
depth = item.attrs.get("depth", depth)
|
||||
depth += 1
|
||||
return "<h%s%s>%s</h%s>\n" % (depth, cls, item.value, depth)
|
||||
|
||||
|
||||
|
@ -91,7 +92,7 @@ builddoc = {
|
|||
tokens.SOURCE: (src, None),
|
||||
tokens.EXAMPLE: (blockquote, None),
|
||||
tokens.RESULTS: (blockquote, None),
|
||||
tokens.TABLE: (table, None),
|
||||
tokens.TABLE: (table, "responsive-table striped"),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@ def test_html_output():
|
|||
print(htmlbody)
|
||||
assert (
|
||||
htmlbody
|
||||
== """<h1> Header 1</h1>
|
||||
<h2> Sub Header 1</h2>
|
||||
== """<h2> Header 1</h2>
|
||||
<h3> Sub Header 1</h3>
|
||||
<p class="flow-text">body <code>text</code>
|
||||
over multiple <b>lines</b>
|
||||
</p><h2> Sub Header 2</h2>
|
||||
<h1> Header 2</h1>
|
||||
</p><h3> Sub Header 2</h3>
|
||||
<h2> Header 2</h2>
|
||||
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="p">(</span><span class="nv">some</span> <span class="nv">lispy</span> <span class="nv">code</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</td></tr></table><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="p">(</span><span class="nv">test</span> <span class="nv">code</span><span class="p">)</span>
|
||||
|
|
|
@ -16,6 +16,7 @@ def test_table():
|
|||
r2 = document.strip()
|
||||
assert r1 == r2
|
||||
|
||||
|
||||
def test_example():
|
||||
document = """#+BEGIN_EXAMPLE
|
||||
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="view-source:https://edwardtufte.github.io/tufte-css/tufte.css" />
|
||||
|
@ -24,5 +25,5 @@ def test_example():
|
|||
assert doc.doc[0].token == tokens.EXAMPLE
|
||||
r1 = doc.doc[0].value.strip()
|
||||
r2 = document.strip()
|
||||
r2 = '#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="view-source:https://edwardtufte.github.io/tufte-css/tufte.css" />'
|
||||
assert r1 == r2
|
||||
|
||||
|
|
Loading…
Reference in New Issue