summaryrefslogtreecommitdiff
path: root/src/codegen.rs
AgeCommit message (Collapse)AuthorFilesLines
2023-08-12subplot: Enable passing of location into the template expansionDaniel Silverstone1-0/+17
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2023-06-21refactor: rename Document::files to ::embedded_filesLars Wirzenius1-1/+1
This makes it more clear what kind of files we're talking about. The old name could've meant, say, the markdown files. Sponsored-by: author
2023-04-30chore: drop now-obsolete commentLars Wirzenius1-2/+0
Thank you Milo Moisson. Sponsored-by: author
2023-04-24fix(src/codegen.rs): formattingLars Wirzenius1-3/+3
Sponsored-by: author
2023-04-10(chore): Update for newer base64 APIDaniel Silverstone1-2/+2
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2023-04-01fix: create Tera using ::default, instead of ::newLars Wirzenius1-1/+1
Tera now returns an error if Tera::new is given a glob that references a directory that doesn't exist. We don't want to use the glob at all, so Tera::default is a better way to create a Tera. Sponsored-by: author
2022-05-06refactor! split SubplotError::IoError into more specific errorsLars Wirzenius1-4/+9
Replace SubplotError::IoError with ::Spawn, ::WriteToChild, ::WaitForChild, ::ReadFile, ::CreateFile, ::Writefile. IoError was a catchall error and as such, so generic that it didn't help the user to figure out what actually is wrong. For example, there was no indication what operation was attempted or on what file. The new error variants are specific. Sponsored-by: author
2021-11-19various: Rework document to support multiple implementationsDaniel Silverstone1-20/+12
In order to eventually shift the document metadata to support more than one template defined for the document this reworks all the internal APIs to expect templates, and also the external CLI to be able to provide it. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-10-08codegen: Refuse to codegen if there are zero scenariosDaniel Silverstone1-1/+7
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-09-07subplot: Properly support polyglot bindingsDaniel Silverstone1-1/+1
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-09-07chore: Unwind global template nameDaniel Silverstone1-7/+10
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-09-04chore: Fix unnecessary borrow lintsDaniel Silverstone1-3/+3
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-04-14refactor: don't use anyhow in the library part of the crateLars Wirzenius1-11/+12
Add one variant to the SubplotError enum and change src/codegen.rs to return Result<_, SubplotError> instead of anyhow::Result<_>.
2021-04-09chore: Clear some clippy lintsDaniel Silverstone1-2/+2
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-01-23codegen: Load helpers before main templateDaniel Silverstone1-9/+8
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-01-10resources: Rearrange share/ structure ready for lib importDaniel Silverstone1-3/+3
In readiness for the lib/ import, rearrange from a structure of share/templates/$lang/... to be share/$lang/template/... This will permit share/$lang/lib/ to exist later. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-01-10resource: Switch from 'templates' to 'share'Daniel Silverstone1-4/+5
In a general sense, we will want to have more than just template files as resources. This shifts from the concept that the only thing resource-wise that subplot has is templates, to a more general shared resources concept without a default path beyond CWD. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-01-09chore: Simplify to use resource::read_as_stringDaniel Silverstone1-10/+3
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-01-09resource: Step one of VFS support, redirect all opensDaniel Silverstone1-5/+8
This redirects all file reading via the new resource module which will be used to control where files come from. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-12-10codegen: Add tests for new filtersDaniel Silverstone1-0/+37
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-12-10codegen: Add commentsafe filterDaniel Silverstone1-0/+19
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-12-10codegen: Add a nameslug filterDaniel Silverstone1-0/+20
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-12-03codegen: Make template metadata entry mandatoryDaniel Silverstone1-4/+4
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-09-04feat(codegen): allow templates to list helper filesLars Wirzenius1-1/+6
A template's YAML file can now list any additional files, called helpers. An empty list is OK, as is not having the 'helper' key in the YAML file. The helpers are loaded as Tera templates so they can be included in the main template. This will allow us to split out un-templated code out of the main template. The helpers can then be linted and unit tested separately. This commit only adds the mechanism, and fixes up the YAML files. Later commits will actually split the main Python template into helpers, and add unit tests. refactor: use .join
2020-06-07feat: supply source file name for functions filesLars Wirzenius1-3/+19
The Python and Bash templates now insert the name of the source files from where the function codes come from.
2020-06-06fix: report name of missing bindings or functions file in error msgLars Wirzenius1-2/+4
2020-05-20feat!: allow multiple bindings and functions filesLars Wirzenius1-5/+5
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.
2020-05-09Change: use a base directory for relative pathsLars Wirzenius1-1/+1
This moves the policy decision of what the base directory is to the main functions of the various programs, instead of hiding it deep in the call stack and making it implicitly the current working directory.
2020-04-22Refactor: move code generation logic to src/codegen.rsLars Wirzenius1-5/+80
This lets sp-codegen.rs be only about the command line parsing etc.
2020-01-01Add: codegen.rs moduleLars Wirzenius1-0/+8