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.

Construct a Document from a named file, using the pullmark_cmark crate.

The file can be in the CommonMark format, with some extensions. This uses the pulldown-cmark crate to parse the file into an AST.

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 the document’s metadata.

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.

Return list of files embeddedin the document.

Check the document for common problems.

Check that all named files (in matched steps) are actually present in the document.

Check that all matched steps actually have function implementations

Typeset a Subplot document.

Return all scenarios in a document.

Return matched scenarios in a document.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more