summaryrefslogtreecommitdiff
path: root/src/ast.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast.rs')
-rw-r--r--src/ast.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ast.rs b/src/ast.rs
index e6fd5db..f59d9f4 100644
--- a/src/ast.rs
+++ b/src/ast.rs
@@ -109,6 +109,15 @@ impl<'a> Document {
self.files.files()
}
+ /// Check that document has a title in its metadata.
+ pub fn has_title(&self) -> Result<()> {
+ if self.meta().title().is_empty() {
+ Err(Error::no_title())
+ } else {
+ Ok(())
+ }
+ }
+
/// Typeset a Subplot document.
pub fn typeset(&mut self) {
let mut visitor = TypesettingVisitor::new(&self.meta.bindings);