latexml_post/manifest/
mod.rs1pub mod epub;
8
9use libxml::tree::Node;
10
11use crate::{
12 document::PostDocument,
13 processor::{ProcessResult, Processor},
14};
15
16#[derive(Debug, Clone)]
18pub enum ManifestFormat {
19 Epub,
20}
21
22pub struct Manifest {
26 name: String,
27 format: Option<ManifestFormat>,
28 site_directory: Option<String>,
29}
30
31impl Manifest {
32 pub fn new(format: Option<ManifestFormat>, site_directory: Option<String>) -> Self {
33 let name = match &format {
34 Some(ManifestFormat::Epub) => "Manifest[Epub]".to_string(),
35 None => "Manifest".to_string(),
36 };
37 Manifest { name, format, site_directory }
38 }
39}
40
41impl Processor for Manifest {
42 fn get_name(&self) -> &str { &self.name }
43
44 fn process(&mut self, doc: PostDocument, _nodes: Vec<Node>) -> ProcessResult {
45 match &self.format {
46 Some(ManifestFormat::Epub) => {
47 Info!(
48 "manifest",
49 "epub",
50 "EPUB manifest generation delegated to epub submodule"
51 );
52 Ok(vec![doc])
53 },
54 None => {
55 Warn!(
56 "manifest",
57 "format",
58 "No manifest format specified; skipping"
59 );
60 Ok(vec![doc])
61 },
62 }
63 }
64}