diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-05-20 08:25:56 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-05-20 10:59:54 +0300 |
commit | 6ca305d000360de74e686d801c638086c876d08a (patch) | |
tree | b918c7aaa7f7d099759f0d5812c9270c2bae9e6c /src/codegen.rs | |
parent | 6d77fdedd7fd0f832a543b7eb530ae15984aa377 (diff) | |
download | subplot-6ca305d000360de74e686d801c638086c876d08a.tar.gz |
feat!: allow multiple bindings and functions files
Where previously the document metadata could specify a single bindings
file, and a single functions file, it can now specify one or more. If
a single value is given, that's the filename. Otherwise, it can be a
YAML list of filenames.
Drop the functions_filename template variable, which was effectively
unused, and for which there is no recorded use case at this time.
Diffstat (limited to 'src/codegen.rs')
-rw-r--r-- | src/codegen.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/codegen.rs b/src/codegen.rs index 70d1966..db31765 100644 --- a/src/codegen.rs +++ b/src/codegen.rs @@ -41,12 +41,12 @@ fn context(doc: &mut Document) -> Result<Context> { context.insert("scenarios", &doc.matched_scenarios()?); context.insert("files", doc.files()); - let (funcs_filename, funcs) = match doc.meta().functions_filename() { - Some(filename) => (filename, cat(filename)?), - None => (Path::new(""), "".to_string()), - }; + let funcs_filenames = doc.meta().functions_filenames(); + let mut funcs = String::new(); + for filename in funcs_filenames { + funcs.push_str(&cat(filename)?); + } context.insert("functions", &funcs); - context.insert("functions_filename", funcs_filename); Ok(context) } |