summaryrefslogtreecommitdiff
path: root/src/typeset.rs
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2022-05-04 19:57:02 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2022-05-04 19:59:02 +0100
commit6448825a8f9beca0333464c9bfbc8fb96d142189 (patch)
treef4896b5b3cccb6d041d1469d9e43984f11126dd5 /src/typeset.rs
parent12059fcb1ce8237e5587773043cd442e036531c2 (diff)
downloadsubplot-6448825a8f9beca0333464c9bfbc8fb96d142189.tar.gz
(subplot): Add support for example blocks
In support of #256, this adds `example` as a permitted class and ensures that we typeset it as though it were a file. This includes linting it as though it were a file too. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'src/typeset.rs')
-rw-r--r--src/typeset.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/typeset.rs b/src/typeset.rs
index 18e5a44..9522e69 100644
--- a/src/typeset.rs
+++ b/src/typeset.rs
@@ -41,6 +41,11 @@ pub fn file_block(attr: &Attr, text: &str) -> Block {
// Otherwise if it doesn't say numberLines we add that in.
cbattrs.1.push("numberLines".to_string());
}
+ // If this was an `example`, convert that class to `file`
+ if cbattrs.1.iter().any(|s| s == "example") {
+ cbattrs.1.retain(|s| s != "example");
+ cbattrs.1.push("file".into());
+ }
let codeblock = Block::CodeBlock(cbattrs, text.to_string());
let noattr = ("".to_string(), vec![], vec![]);
Block::Div(noattr, vec![intro, codeblock])