summaryrefslogtreecommitdiffstats
path: root/src/filters.rs
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2021-11-28 00:19:12 +0100
committerMinijackson <minijackson@riseup.net>2021-11-28 00:21:46 +0100
commit17b10fab16bc5df3a969826150e92f50e88a99b9 (patch)
tree12a0c721e89ef17f07a9ede593d82a4c95bc7937 /src/filters.rs
parent517cabe8ec54d0bf5f5f9cc9089d76a1fad7bb6a (diff)
downloadpandoc-docbook-17b10fab16bc5df3a969826150e92f50e88a99b9.tar.gz
pandoc-docbook-17b10fab16bc5df3a969826150e92f50e88a99b9.zip
add css and html template, refactor build
Diffstat (limited to 'src/filters.rs')
-rw-r--r--src/filters.rs23
1 files changed, 1 insertions, 22 deletions
diff --git a/src/filters.rs b/src/filters.rs
index 1b06920..8dbe578 100644
--- a/src/filters.rs
+++ b/src/filters.rs
@@ -40,15 +40,13 @@ impl<'a> pandoc_ast::MutVisitor for RelativizeUrls<'a> {
40 if output_path.exists() { 40 if output_path.exists() {
41 // TODO: relativize from URL root 41 // TODO: relativize from URL root
42 42
43 trace!("Relativizing link '{}'", link_path.display());
44
45 *link = Path::new(link) 43 *link = Path::new(link)
46 .with_extension(&self.extension) 44 .with_extension(&self.extension)
47 .to_str() 45 .to_str()
48 .expect("Path constructed from UTF-8 valid strings in not UTF-8 valid") 46 .expect("Path constructed from UTF-8 valid strings in not UTF-8 valid")
49 .to_string(); 47 .to_string();
50 48
51 trace!("-> into '{}'", link); 49 trace!("Relativizing link '{}' -> into '{}'", link_path.display(), link);
52 } 50 }
53 } 51 }
54} 52}
@@ -94,22 +92,3 @@ pub fn relativize_summary(summary: &pandoc_ast::Pandoc, level: usize) -> pandoc_
94 }) 92 })
95 .clone() 93 .clone()
96} 94}
97
98pub struct InsertSummary<'a> {
99 pub summary: &'a pandoc_ast::Pandoc,
100 pub level: usize,
101}
102
103impl<'a> pandoc_ast::MutVisitor for InsertSummary<'a> {
104 fn walk_pandoc(&mut self, pandoc: &mut pandoc_ast::Pandoc) {
105 let summary = relativize_summary(self.summary, self.level);
106
107 pandoc.blocks.insert(
108 0,
109 pandoc_ast::Block::Div(
110 (String::new(), vec!["summary".to_string()], vec![]),
111 summary.blocks,
112 ),
113 );
114 }
115}