1 // This file is auto-generated by the build script 2 // Please, do not modify it manually 3 4 extern crate pulldown_cmark; 5 6 7 #[test] footnotes_test_1()8 fn footnotes_test_1() { 9 let original = r##"Lorem ipsum.[^a] 10 11 [^a]: Cool. 12 "##; 13 let expected = r##"<p>Lorem ipsum.<sup class="footnote-reference"><a href="#a">1</a></sup></p> 14 <div class="footnote-definition" id="a"><sup class="footnote-definition-label">1</sup> 15 <p>Cool.</p> 16 </div> 17 "##; 18 19 use pulldown_cmark::{Parser, html, Options}; 20 21 let mut s = String::new(); 22 23 let mut opts = Options::empty(); 24 opts.insert(Options::ENABLE_TABLES); 25 opts.insert(Options::ENABLE_FOOTNOTES); 26 27 let p = Parser::new_ext(&original, opts); 28 html::push_html(&mut s, p); 29 30 assert_eq!(expected, s); 31 } 32 33 #[test] footnotes_test_2()34 fn footnotes_test_2() { 35 let original = r##"> This is the song that never ends.\ 36 > Yes it goes on and on my friends.[^lambchops] 37 > 38 > [^lambchops]: <https://www.youtube.com/watch?v=0U2zJOryHKQ> 39 "##; 40 let expected = r##"<blockquote> 41 <p>This is the song that never ends.<br /> 42 Yes it goes on and on my friends.<sup class="footnote-reference"><a href="#lambchops">1</a></sup></p> 43 <div class="footnote-definition" id="lambchops"><sup class="footnote-definition-label">1</sup> 44 <p><a href="https://www.youtube.com/watch?v=0U2zJOryHKQ">https://www.youtube.com/watch?v=0U2zJOryHKQ</a></p> 45 </div> 46 </blockquote> 47 "##; 48 49 use pulldown_cmark::{Parser, html, Options}; 50 51 let mut s = String::new(); 52 53 let mut opts = Options::empty(); 54 opts.insert(Options::ENABLE_TABLES); 55 opts.insert(Options::ENABLE_FOOTNOTES); 56 57 let p = Parser::new_ext(&original, opts); 58 html::push_html(&mut s, p); 59 60 assert_eq!(expected, s); 61 } 62 63 #[test] footnotes_test_3()64 fn footnotes_test_3() { 65 let original = r##"Songs that simply loop are a popular way to annoy people. [^examples] 66 67 [^examples]: 68 * [The song that never ends](https://www.youtube.com/watch?v=0U2zJOryHKQ) 69 * [I know a song that gets on everybody's nerves](https://www.youtube.com/watch?v=TehWI09qxls) 70 * [Ninety-nine bottles of beer on the wall](https://www.youtube.com/watch?v=qVjCag8XoHQ) 71 "##; 72 let expected = r##"<p>Songs that simply loop are a popular way to annoy people. <sup class="footnote-reference"><a href="#examples">1</a></sup></p> 73 <div class="footnote-definition" id="examples"><sup class="footnote-definition-label">1</sup> 74 <ul> 75 <li><a href="https://www.youtube.com/watch?v=0U2zJOryHKQ">The song that never ends</a></li> 76 <li><a href="https://www.youtube.com/watch?v=TehWI09qxls">I know a song that gets on everybody's nerves</a></li> 77 <li><a href="https://www.youtube.com/watch?v=qVjCag8XoHQ">Ninety-nine bottles of beer on the wall</a></li> 78 </ul> 79 </div> 80 "##; 81 82 use pulldown_cmark::{Parser, html, Options}; 83 84 let mut s = String::new(); 85 86 let mut opts = Options::empty(); 87 opts.insert(Options::ENABLE_TABLES); 88 opts.insert(Options::ENABLE_FOOTNOTES); 89 90 let p = Parser::new_ext(&original, opts); 91 html::push_html(&mut s, p); 92 93 assert_eq!(expected, s); 94 } 95 96 #[test] footnotes_test_4()97 fn footnotes_test_4() { 98 let original = r##"[^lorem]: If heaven ever wishes to grant me a boon, it will be a total effacing of the results of a mere chance which fixed my eye on a certain stray piece of shelf-paper. It was nothing on which I would naturally have stumbled in the course of my daily round, for it was an old number of an Australian journal, the Sydney Bulletin for April 18, 1925. It had escaped even the cutting bureau which had at the time of its issuance been avidly collecting material for my uncle's research. 99 100 I had largely given over my inquiries into what Professor Angell called the "Cthulhu Cult", and was visiting a learned friend in Paterson, New Jersey; the curator of a local museum and a mineralogist of note. Examining one day the reserve specimens roughly set on the storage shelves in a rear room of the museum, my eye was caught by an odd picture in one of the old papers spread beneath the stones. It was the Sydney Bulletin I have mentioned, for my friend had wide affiliations in all conceivable foreign parts; and the picture was a half-tone cut of a hideous stone image almost identical with that which Legrasse had found in the swamp. 101 "##; 102 let expected = r##"<div class="footnote-definition" id="lorem"><sup class="footnote-definition-label">1</sup> 103 <p>If heaven ever wishes to grant me a boon, it will be a total effacing of the results of a mere chance which fixed my eye on a certain stray piece of shelf-paper. It was nothing on which I would naturally have stumbled in the course of my daily round, for it was an old number of an Australian journal, the Sydney Bulletin for April 18, 1925. It had escaped even the cutting bureau which had at the time of its issuance been avidly collecting material for my uncle's research.</p> 104 </div> 105 <p>I had largely given over my inquiries into what Professor Angell called the "Cthulhu Cult", and was visiting a learned friend in Paterson, New Jersey; the curator of a local museum and a mineralogist of note. Examining one day the reserve specimens roughly set on the storage shelves in a rear room of the museum, my eye was caught by an odd picture in one of the old papers spread beneath the stones. It was the Sydney Bulletin I have mentioned, for my friend had wide affiliations in all conceivable foreign parts; and the picture was a half-tone cut of a hideous stone image almost identical with that which Legrasse had found in the swamp.</p> 106 "##; 107 108 use pulldown_cmark::{Parser, html, Options}; 109 110 let mut s = String::new(); 111 112 let mut opts = Options::empty(); 113 opts.insert(Options::ENABLE_TABLES); 114 opts.insert(Options::ENABLE_FOOTNOTES); 115 116 let p = Parser::new_ext(&original, opts); 117 html::push_html(&mut s, p); 118 119 assert_eq!(expected, s); 120 } 121 122 #[test] footnotes_test_5()123 fn footnotes_test_5() { 124 let original = r##"[^ipsum]: How much wood would a woodchuck chuck. 125 126 If a woodchuck could chuck wood. 127 128 129 # Forms of entertainment that aren't childish 130 "##; 131 let expected = r##"<div class="footnote-definition" id="ipsum"><sup class="footnote-definition-label">1</sup> 132 <p>How much wood would a woodchuck chuck.</p> 133 </div> 134 <p>If a woodchuck could chuck wood.</p> 135 <h1>Forms of entertainment that aren't childish</h1> 136 "##; 137 138 use pulldown_cmark::{Parser, html, Options}; 139 140 let mut s = String::new(); 141 142 let mut opts = Options::empty(); 143 opts.insert(Options::ENABLE_TABLES); 144 opts.insert(Options::ENABLE_FOOTNOTES); 145 146 let p = Parser::new_ext(&original, opts); 147 html::push_html(&mut s, p); 148 149 assert_eq!(expected, s); 150 } 151 152 #[test] footnotes_test_6()153 fn footnotes_test_6() { 154 let original = r##"> He's also really stupid. [^why] 155 > 156 > [^why]: Because your mamma! 157 158 As such, we can guarantee that the non-childish forms of entertainment are probably more entertaining to adults, since, having had a whole childhood doing the childish ones, the non-childish ones are merely the ones that haven't gotten boring yet. 159 "##; 160 let expected = r##"<blockquote> 161 <p>He's also really stupid. <sup class="footnote-reference"><a href="#why">1</a></sup></p> 162 <div class="footnote-definition" id="why"><sup class="footnote-definition-label">1</sup> 163 <p>Because your mamma!</p> 164 </div> 165 </blockquote> 166 <p>As such, we can guarantee that the non-childish forms of entertainment are probably more entertaining to adults, since, having had a whole childhood doing the childish ones, the non-childish ones are merely the ones that haven't gotten boring yet.</p> 167 "##; 168 169 use pulldown_cmark::{Parser, html, Options}; 170 171 let mut s = String::new(); 172 173 let mut opts = Options::empty(); 174 opts.insert(Options::ENABLE_TABLES); 175 opts.insert(Options::ENABLE_FOOTNOTES); 176 177 let p = Parser::new_ext(&original, opts); 178 html::push_html(&mut s, p); 179 180 assert_eq!(expected, s); 181 } 182 183 #[test] footnotes_test_7()184 fn footnotes_test_7() { 185 let original = r##"Nested footnotes are considered poor style. [^a] [^xkcd] 186 187 [^a]: This does not mean that footnotes cannot reference each other. [^b] 188 189 [^b]: This means that a footnote definition cannot be directly inside another footnote definition. 190 > This means that a footnote cannot be directly inside another footnote's body. [^e] 191 > 192 > [^e]: They can, however, be inside anything else. 193 194 [^xkcd]: [The other kind of nested footnote is, however, considered poor style.](https://xkcd.com/1208/) 195 "##; 196 let expected = r##"<p>Nested footnotes are considered poor style. <sup class="footnote-reference"><a href="#a">1</a></sup> <sup class="footnote-reference"><a href="#xkcd">2</a></sup></p> 197 <div class="footnote-definition" id="a"><sup class="footnote-definition-label">1</sup> 198 <p>This does not mean that footnotes cannot reference each other. <sup class="footnote-reference"><a href="#b">3</a></sup></p> 199 </div> 200 <div class="footnote-definition" id="b"><sup class="footnote-definition-label">3</sup> 201 <p>This means that a footnote definition cannot be directly inside another footnote definition.</p> 202 <blockquote> 203 <p>This means that a footnote cannot be directly inside another footnote's body. <sup class="footnote-reference"><a href="#e">4</a></sup></p> 204 <div class="footnote-definition" id="e"><sup class="footnote-definition-label">4</sup> 205 <p>They can, however, be inside anything else.</p> 206 </div> 207 </blockquote> 208 </div> 209 <div class="footnote-definition" id="xkcd"><sup class="footnote-definition-label">2</sup> 210 <p><a href="https://xkcd.com/1208/">The other kind of nested footnote is, however, considered poor style.</a></p> 211 </div> 212 "##; 213 214 use pulldown_cmark::{Parser, html, Options}; 215 216 let mut s = String::new(); 217 218 let mut opts = Options::empty(); 219 opts.insert(Options::ENABLE_TABLES); 220 opts.insert(Options::ENABLE_FOOTNOTES); 221 222 let p = Parser::new_ext(&original, opts); 223 html::push_html(&mut s, p); 224 225 assert_eq!(expected, s); 226 } 227 228 #[test] footnotes_test_8()229 fn footnotes_test_8() { 230 let original = r##"[^Doh] Ray Me Fa So La Te Do! [^1] 231 232 [^Doh]: I know. Wrong Doe. And it won't render right. 233 [^1]: Common for people practicing music. 234 "##; 235 let expected = r##"<p><sup class="footnote-reference"><a href="#Doh">1</a></sup> Ray Me Fa So La Te Do! <sup class="footnote-reference"><a href="#1">2</a></sup></p> 236 <div class="footnote-definition" id="Doh"><sup class="footnote-definition-label">1</sup> 237 <p>I know. Wrong Doe. And it won't render right. 238 <sup class="footnote-reference"><a href="#1">2</a></sup>: Common for people practicing music.</p> 239 </div> 240 "##; 241 242 use pulldown_cmark::{Parser, html, Options}; 243 244 let mut s = String::new(); 245 246 let mut opts = Options::empty(); 247 opts.insert(Options::ENABLE_TABLES); 248 opts.insert(Options::ENABLE_FOOTNOTES); 249 250 let p = Parser::new_ext(&original, opts); 251 html::push_html(&mut s, p); 252 253 assert_eq!(expected, s); 254 }