aboutsummaryrefslogtreecommitdiffstats
path: root/renderer/src/html.rs
diff options
context:
space:
mode:
authorKonsta Hölttä2020-09-07 01:30:34 +0300
committerGitHub2020-09-07 00:30:34 +0200
commit4c487a44208a96e3a23ab8974d224cae489688be (patch)
tree225496197ba8d5c096497809f53bf9e31ba8231b /renderer/src/html.rs
parentc80468a8f917079189c8cd111556f9752085e3e4 (diff)
downloadrust-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 'renderer/src/html.rs')
-rw-r--r--renderer/src/html.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/renderer/src/html.rs b/renderer/src/html.rs
index fe934e7..0092315 100644
--- a/renderer/src/html.rs
+++ b/renderer/src/html.rs
@@ -11,6 +11,7 @@ use document_tree::{
elements as e,
extra_attributes as a,
element_categories as c,
+ attribute_types as at,
};
@@ -238,8 +239,11 @@ impl HTMLRender for e::Target {
impl HTMLRender for e::Raw {
fn render_html<W>(&self, renderer: &mut HTMLRenderer<W>) -> Result<(), Error> where W: Write {
- for c in self.children() {
- write!(renderer.stream, "{}", c)?;
+ let extra = self.extra();
+ if extra.format.contains(&at::NameToken("html".to_owned())) {
+ for c in self.children() {
+ write!(renderer.stream, "{}", c)?;
+ }
}
Ok(())
}