Struct subplot::Document [−][src]
pub struct Document { /* fields omitted */ }
Expand description
A parsed Subplot document.
Pandoc works by parsing its various input files and constructing an abstract syntax tree or AST. When Pandoc generates output, it works based on the AST. This way, the input parsing and output generation are cleanly separated.
A Pandoc filter can modify the AST before output generation starts working. This allows the filter to make changes to what gets output, without having to understand the input documents at all.
This function is a Pandoc filter, to be use with pandoc_ast::filter, for typesetting Subplot documents.
Example
fix this example;
let markdown = "\ --- title: Test Title ... This is a test document. "; use std::io::Write; use tempfile::NamedTempFile; let mut f = NamedTempFile::new().unwrap(); f.write_all(markdown.as_bytes()).unwrap(); let filename = f.path(); use subplot; let basedir = std::path::Path::new("."); let style = subplot::Style::default(); let doc = subplot::Document::from_file(&basedir, filename, style).unwrap(); assert_eq!(doc.files(), &[]);
Implementations
Construct a Document from a JSON AST
Construct a Document from a named file.
The file can be in any format Pandoc understands. This runs Pandoc to parse the file into an AST, so it can be a little slow.
Return the AST of a Document, serialized as JSON.
This is useful in a Pandoc filter, so that the filter can give it back to Pandoc for typesetting.
Return all source filenames for the document.
The sources are any files that affect the output so that if the source file changes, the output needs to be re-generated.
Check that all named files (in matched steps) are actually present in the document.
Return matched scenarios in a document.