diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-09-03 10:23:51 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-09-03 10:23:51 +0300 |
commit | 7a500b07a7a272c6813b52df954b2e9466a25901 (patch) | |
tree | 9b3484207a44fd7de0e4a9c6762f0a8fcf004f29 /src | |
parent | adbaf65c09550cbc4fdb6d3272d7efa33eefb069 (diff) | |
download | subplot-7a500b07a7a272c6813b52df954b2e9466a25901.tar.gz |
refactor: make long function a little more readable with empty lines
Sponsored-by: author
Diffstat (limited to 'src')
-rw-r--r-- | src/ast.rs | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -310,19 +310,25 @@ impl YamlMetadata { fn to_map(&self) -> Map<String, MetaValue> { trace!("Creating metadata map from parsed YAML"); let mut map: Map<String, MetaValue> = Map::new(); + map.insert("title".into(), meta_string(&self.title)); + if let Some(v) = &self.subtitle { map.insert("subtitle".into(), meta_string(v)); } + if let Some(v) = &self.author { map.insert("author".into(), meta_string(v)); } + if let Some(v) = &self.date { map.insert("date".into(), meta_string(v)); } + if let Some(v) = &self.classes { map.insert("classes".into(), meta_strings(v)); } + if !self.impls.is_empty() { let impls = self .impls @@ -331,15 +337,19 @@ impl YamlMetadata { .collect(); map.insert("impls".into(), MetaValue::MetaMap(impls)); } + if let Some(v) = &self.bibliography { map.insert("bibliography".into(), meta_path_bufs(v)); } + if let Some(v) = &self.bindings { map.insert("bindings".into(), meta_path_bufs(v)); } + if let Some(v) = &self.documentclass { map.insert("documentclass".into(), meta_string(v)); } + trace!("Created metadata map from parsed YAML"); map } |