diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-02-15 07:20:05 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-02-15 07:20:05 +0000 |
commit | 62df0717e7087a051ec697b59b21feefaa27ece7 (patch) | |
tree | 9e33c085db46629672b566bfd7712c002a2c6ed3 /src/ast.rs | |
parent | b0c3b2f3158611caf3f7bcc4ce8b277abde1e035 (diff) | |
parent | e975bd5b30eb7f3f46cba32e16ca813e110bc497 (diff) | |
download | subplot-62df0717e7087a051ec697b59b21feefaa27ece7.tar.gz |
Merge branch 'liw/titles' into 'master'
Change: require docgen, codegen to fail if document has no title
See merge request larswirzenius/subplot!2
Diffstat (limited to 'src/ast.rs')
-rw-r--r-- | src/ast.rs | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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); |