summaryrefslogtreecommitdiff
path: root/src/bin/subplot.rs
AgeCommit message (Collapse)AuthorFilesLines
2024-01-07cli: If no template available, don't lint the implsDaniel Silverstone1-1/+6
2023-12-27bindings: Add warnings for missing capture names or missing capture typesDaniel Silverstone1-0/+1
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2023-12-25feat: typeset scenarios by typesetting stepsLars Wirzenius1-1/+1
Typeset each step in a scenario, including captures in the steps. Previously the scenario was just one <pre> element, now things can be styled with CSS. Signed-off-by: Lars Wirzenius <liw@liw.fi> Sponsored-by: author
2023-12-01feat: make libdocgen fail if a binding lacks a doc stringLars Wirzenius1-3/+14
The --merciful option allows this if the user really wants it. Signed-off-by: Lars Wirzenius <liw@liw.fi> Sponsored-by: author
2023-11-04feat: generate library documentation from bindings filesLars Wirzenius1-2/+87
Add a `doc` field to a binding. It's a string meant to contain markdown. Add subcommand `subplot libdocgen YAML -o MD` to read a bindings file and output a markdown file documenting the steps in the bindings file, and the type of captures, and the documentation for the step. Signed-off-by: Lars Wirzenius <liw@liw.fi> Sponsored-by: author
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-06-15refactor: change Document::to_html to return a ResultLars Wirzenius1-1/+1
HTML generation uses write!, which can fail, so to_html must return a Result. Sponsored-by: author
2023-06-10feat: Warn when named codeblocks lack classesDaniel Silverstone1-0/+1
To both improve debugability when writing scenarios, and also to protect against future incompatibilities which might occur if we add more classes which are appropriate for named code blocks, we require that named blocks have one of `file` or `example` as classes or else we warn. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2023-06-03fix: allow docgen to handle a subplot not in current directoryLars Wirzenius1-1/+7
Sponsored-by: author
2023-05-31feat! docgen always outputs a documentLars Wirzenius1-23/+3
We have long had a feature for docgen that checks the time stamps of all input files and the output file and avoids running Pandoc to produce the output file, if the output file won't change. This has always been a little imperfect: sometimes the output file would change due to other changes than what's in the input files. For example, when Pandoc changes, or when Subplot code changes. This has led to surprised users. We no longer user Pandoc at all. Drop the time stamp checking functionality and have docgen always write the output file. Sponsored-by: author
2023-05-10feat! allow multiple markdown files for a subplotLars Wirzenius1-2/+12
Sponsored-by: author
2023-04-08feat: change main program to not use PandocLars Wirzenius1-21/+3
Sponsored-by: author
2023-02-25(doc, md, bin): Update APIs so warnings are externally accumulatedDaniel Silverstone1-8/+10
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2023-02-14feat! drop support for producing PDF outputLars Wirzenius1-6/+1
We may add this back later, but for now, it's not wanted. Sponsored-by: author
2023-02-11chore: use variables in Rust format stringsLars Wirzenius1-1/+1
Change this: format!("{}", foo) into this: format!("{foo}") Support for this feature was added in Rust 1.58 (see https://github.com/rust-lang/rust/releases/tag/1.58.0) and in 1.67 clippy suggests about this. Because the new style seems to be where the Rust ecosystem is going, I think Subplot should follow to avoid being needlessly different from most other projects. Sponsored-by: author
2022-12-01(chore): Update to clap4Daniel Silverstone1-20/+5
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2022-10-21fix: look up markdown file relative to basedir of subplotLars Wirzenius1-1/+2
This allows running docgen on a subplot that isn't in the current directory. Sponsored-by: author
2022-10-21fix: say for which file lookup of input file mtime failsLars Wirzenius1-1/+4
Sponsored-by: author
2022-09-06feat! read document metadata from a YAML fileLars Wirzenius1-1/+1
This is a huge change all in one commit, sorry. However, as it changes a fundamental part of the command line interface (namely, what constitutes as the input file), there doesn't seem a way to break this into a tidy series of small commits. Most of the diff is in subplot.md, where every scenario that invokes Subplot needs multiple changes, thus touching much of the file. The overall change is that where we previously had document metadata in embedded YAML in the Markdown file, we now have it in a separate YAML file. The Markdown file is named in the YAML file. We still parse the Markdown with Pandoc for everything, except codegen. Switching from Pandoc to pulldown_cmark for parsing will be another big change that I didn't want to include in this huge change set. Sponsored-by: author
2022-09-03refactor: rename DataFile{,s} to EmbeddedFile{,s} to be systematicLars Wirzenius1-2/+2
Sponsored-by: author
2022-08-14feat! drop support to act as a Pandoc filterLars Wirzenius1-58/+2
When we change Subplot to take a YAML file instead of a Markdown file as input, it doesn't make sense to act as a Pandoc filter anymore: Pandoc doesn't understand our YAML file. In any case, I seem to have been the only user ever of that feature, so it won't really bother anyone else. Even so, we should treat this as a breaking change. "subplot docgen" still works as before. Sponsored-by: author
2022-08-13feat: make errors have a source errorLars Wirzenius1-8/+5
When errors have a source, i.e., an underlying error, it results in better error messages to the user. Also, refactor the way the source chain is printed, to code that is clearer to me. I will need this to for loading document metadata from an external YAML file. Sponsored-by: author
2022-07-02(subplot): Use .unwrap_or()Daniel Silverstone1-1/+1
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2022-05-14(cli): Change from structopt to clap3-deriveDaniel Silverstone1-35/+35
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2022-04-15feat: improve logging via env_loggerLars Wirzenius1-10/+46
Configure env_logger from environment, including style (colors). Simplify how log messages are formatted: drop the timestamp and crate name, as they're just noise for the case of Subplot. Adjust log messages so that what a user may want to normally know is info or above, and at level debug if they want to see in more detail what's happening. Handle the error from failing to execute pandoc specially, for a better error message. The default error message from the pandoc crate was hard for a user to understand. The new message clearly says what the exit code is, and logs the stderr, but not stdout, as Pandoc correctly writes errors only to stderr. Sponsored-by: author
2022-04-10use Option<&str> instead of &Option<String>Lars Wirzenius1-11/+16
Sponsored-by: author
2022-04-10feat! treat warnings as errors by defaultLars Wirzenius1-27/+54
Add a --merciful option to subcommands for which this matters. Adjust tests to invoke subplot with that option as necessary. Sponsored-by: author
2022-03-24feat! change logging to use log/env_logger instead of tracingLars Wirzenius1-82/+12
We don't use async in Subplot, and the mental overhead of learning tracing and the code overhead to add support for logging custom values (implementing the Value trait for Subplot internal types) does not seem worthwhile. Sponsored-by: author
2022-02-02chore: rewrite use of chorno crate to use just time crateLars Wirzenius1-3/+6
Also, sort the dependency list in Cargo.toml so it's tidy. Sponsored-by: author
2021-11-27feat: warn about unused embedded filesLars Wirzenius1-1/+3
This is merely a warning, for now, to stderr. subplot.md has two embedded files used as examples, and I'm too tired to add a way to indicate that it's OK for a specific file to not be used. That should probably be added later, though. Sponsored-by: author
2021-11-19metadata: Switch to using pullmark parsingDaniel Silverstone1-2/+5
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-11-19subplot: Rework for impls not template/functionsDaniel Silverstone1-4/+4
As the next step in polyglot documents, this reworks the internals to expect the metadata of documents to contain an impls mapping from template name to function filenames for that template. Sadly this does mean that if there're no function files, the document author will have to still specify an empty list, but that seems acceptable. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-11-19various: Rework document to support multiple implementationsDaniel Silverstone1-7/+31
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-13feat: add crate subplot-build for using Subplot from build.rsLars Wirzenius1-27/+7
Make it easy to generate test code from a subplot in another project's `build.rs` script. Move the code to load documents and generate test code from src/bin/subplot.rs and src/bin/cli/mod.rs to src/doc.rs so it can be used without using the subplot executable. Make the add_search_path function public so it can be used outside its module. The subplot executable arranged for the directory where the markdown input file resides to be added to the search path via another way. Sponsored-by: pep.foundation
2021-09-16feat! parse Markdown input with pull-cmark instead of PandocLars Wirzenius1-1/+1
This is a first step towards being able to use Subplot codegen from a project's build.rs, and with only pure-Rust build dependencies. Replace Pandoc for parsing Markdown input with pulldown-cmark. This is mostly a drop-in replacement, but not entirely. The YAML parsing is more strict now. Note that this is a breaking change. Some subplots that used to work, and still work with docgen, no longer work with the new parser. Major differences are: * Only specific fields are supported. All the Markdown files in the Subplot source tree work. If anything else is needed, and it likely is, the new parser needs to be extended. * The bindings, functions, classes, and bibliography fields MUST be lists of strings. A single string value will no longer work. Sponsored-by: pep.foundation
2021-09-14debug: add tracing calls to help debugLars Wirzenius1-2/+13
I needed these to figure out a problem that wasn't in Subplot itself. I'd like to keep them for the future. Sponsored-by: author
2021-09-07subplot: Properly support polyglot bindingsDaniel Silverstone1-7/+10
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-09-07chore: Unwind global template nameDaniel Silverstone1-1/+6
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-09-05resources: Hidden subcommand to list internal resourcesDaniel Silverstone1-0/+19
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-09-05tracing: Un-DRY the code a bit to cope with a guardDaniel Silverstone1-5/+4
Unfortunately there was a problem where the file writer guard got dropped and so the subscriber (correctly) silently swallowed the tracing instead of writing it out. This was caused by me trying to DRY the code a bit. Undo some of that until we can come up with a more elegant solution. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-09-04tracing: Make formatting better and documentDaniel Silverstone1-12/+36
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-09-04subplot: Trace without ANSI to file, and always trace to console if not ↵Daniel Silverstone1-2/+2
otherwise set Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-09-04chore: Enable tracingDaniel Silverstone1-2/+58
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-06-19cli: Add flexibility in dot and plantuml locationsDaniel Silverstone1-3/+9
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-05-02chore: Fix up some clippy lintsDaniel Silverstone1-4/+1
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-05-02resources: Use new path checking orderDaniel Silverstone1-1/+39
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-04-23version: Add support for git-testament derived version infoDaniel Silverstone1-1/+36
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-04-09subplot: Add initial Codegen code into binaryDaniel Silverstone1-2/+62
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-04-09subplot: Copy in sp-docgen contentDaniel Silverstone1-1/+96
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-04-09bin: Add metadata subcommand to subplotDaniel Silverstone1-0/+31
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>