diff options
| author | Konsta Hölttä | 2020-09-07 01:30:34 +0300 |
|---|---|---|
| committer | GitHub | 2020-09-07 00:30:34 +0200 |
| commit | 4c487a44208a96e3a23ab8974d224cae489688be (patch) | |
| tree | 225496197ba8d5c096497809f53bf9e31ba8231b /parser/src/tests.rs | |
| parent | c80468a8f917079189c8cd111556f9752085e3e4 (diff) | |
| download | rust-rst-4c487a44208a96e3a23ab8974d224cae489688be.tar.bz2 | |
Add support for raw directives (#17)
All content under a raw directive is rendered as-is if the output format
matches the writer. Otherwise none of it is shown.
Diffstat (limited to 'parser/src/tests.rs')
| -rw-r--r-- | parser/src/tests.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/parser/src/tests.rs b/parser/src/tests.rs index 504d13b..93e20ec 100644 --- a/parser/src/tests.rs +++ b/parser/src/tests.rs @@ -186,6 +186,45 @@ The end #[allow(clippy::cognitive_complexity)] #[test] +fn raw() { + parses_to! { + parser: RstParser, + input: "\ +.. raw:: html + + hello <span>world</span> + +.. raw:: html + + hello <pre>world + + parse</pre> this + +The end +", + rule: Rule::document, + tokens: [ + raw_directive(0, 43, [ + raw_output_format(9, 13), + raw_block(18, 43, [ + raw_line(18, 43), + ]), + ]), + raw_directive(44, 100, [ + raw_output_format(53, 57), + raw_block(62, 100, [ + raw_line(62, 79), + raw_line_blank(79, 80), + raw_line(83, 100), + ]), + ]), + paragraph(101, 108, [ str(101, 108) ]), + ] + }; +} + +#[allow(clippy::cognitive_complexity)] +#[test] fn substitutions() { parses_to! { parser: RstParser, |
