Make databake compatible
This commit is contained in:
parent
35891f8f49
commit
8239b2b51d
9 changed files with 240 additions and 26 deletions
66
tests/html-ut/ut/footnotes.rs
Normal file
66
tests/html-ut/ut/footnotes.rs
Normal file
|
@ -0,0 +1,66 @@
|
|||
use crate::compare;
|
||||
|
||||
// Footnote references may appear within a footnote.
|
||||
#[test]
|
||||
fn test_1c8325a() {
|
||||
let src = r##"[^a]
|
||||
|
||||
[^a]: a[^b][^c]
|
||||
[^b]: b
|
||||
"##;
|
||||
let expected = r##"<p><a id="fnref1" href="#fn1" role="doc-noteref"><sup>1</sup></a></p>
|
||||
<section role="doc-endnotes">
|
||||
<hr>
|
||||
<ol>
|
||||
<li id="fn1">
|
||||
<p>a<a id="fnref2" href="#fn2" role="doc-noteref"><sup>2</sup></a><a id="fnref3" href="#fn3" role="doc-noteref"><sup>3</sup></a><a href="#fnref1" role="doc-backlink">↩︎︎</a></p>
|
||||
</li>
|
||||
<li id="fn2">
|
||||
<p>b<a href="#fnref2" role="doc-backlink">↩︎︎</a></p>
|
||||
</li>
|
||||
<li id="fn3">
|
||||
<p><a href="#fnref3" role="doc-backlink">↩︎︎</a></p>
|
||||
</li>
|
||||
</ol>
|
||||
</section>
|
||||
"##;
|
||||
compare!(src, expected);
|
||||
}
|
||||
|
||||
// Footnote references in unreferenced footnotes are ignored.
|
||||
#[test]
|
||||
fn test_9eab5c8() {
|
||||
let src = r##"para
|
||||
|
||||
[^a]: a[^b][^c]
|
||||
[^b]: b
|
||||
"##;
|
||||
let expected = r##"<p>para</p>
|
||||
"##;
|
||||
compare!(src, expected);
|
||||
}
|
||||
|
||||
// Footnotes may appear within footnotes.
|
||||
#[test]
|
||||
fn test_041f54c() {
|
||||
let src = r##"[^b]
|
||||
[^a]
|
||||
|
||||
[^a]: [^b]: inner
|
||||
"##;
|
||||
let expected = r##"<p><a id="fnref1" href="#fn1" role="doc-noteref"><sup>1</sup></a>
|
||||
<a id="fnref2" href="#fn2" role="doc-noteref"><sup>2</sup></a></p>
|
||||
<section role="doc-endnotes">
|
||||
<hr>
|
||||
<ol>
|
||||
<li id="fn1">
|
||||
<p>inner<a href="#fnref1" role="doc-backlink">↩︎︎</a></p>
|
||||
</li>
|
||||
<li id="fn2">
|
||||
<p><a href="#fnref2" role="doc-backlink">↩︎︎</a></p>
|
||||
</li>
|
||||
</ol>
|
||||
</section>
|
||||
"##;
|
||||
compare!(src, expected);
|
||||
}
|
27
tests/html-ut/ut/lists.rs
Normal file
27
tests/html-ut/ut/lists.rs
Normal file
|
@ -0,0 +1,27 @@
|
|||
use crate::compare;
|
||||
|
||||
#[test]
|
||||
fn test_fefa2dc() {
|
||||
let src = r##"1. item
|
||||
|
||||
para
|
||||
"##;
|
||||
let expected = r##"<ol>
|
||||
<li>
|
||||
item
|
||||
</li>
|
||||
</ol>
|
||||
<p>para</p>
|
||||
"##;
|
||||
compare!(src, expected);
|
||||
}
|
||||
|
||||
// Only single letter alphabetic list markers.
|
||||
#[test]
|
||||
fn test_2a0aa95() {
|
||||
let src = r##"word. Continuing paragraph.
|
||||
"##;
|
||||
let expected = r##"<p>word. Continuing paragraph.</p>
|
||||
"##;
|
||||
compare!(src, expected);
|
||||
}
|
3
tests/html-ut/ut/mod.rs
Normal file
3
tests/html-ut/ut/mod.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
mod footnotes;
|
||||
mod lists;
|
||||
mod raw_blocks;
|
24
tests/html-ut/ut/raw_blocks.rs
Normal file
24
tests/html-ut/ut/raw_blocks.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
use crate::compare;
|
||||
|
||||
#[test]
|
||||
fn test_bf9dbab() {
|
||||
let src = r##"```=html
|
||||
<tag1>
|
||||
<tag2>
|
||||
```
|
||||
|
||||
paragraph
|
||||
|
||||
```=html
|
||||
</tag2>
|
||||
</tag1>
|
||||
```
|
||||
"##;
|
||||
let expected = r##"<tag1>
|
||||
<tag2>
|
||||
<p>paragraph</p>
|
||||
</tag2>
|
||||
</tag1>
|
||||
"##;
|
||||
compare!(src, expected);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue