Age | Commit message (Collapse) | Author | Files | Lines |
|
Sponsored-by: author
|
|
Sponsored-by: author
|
|
Sponsored-by: author
|
|
Use YamlMetadata instead. I find this to be clearer and that it
reduces the coupling with pandoc_ast a little. This should help us
when we implement document metadata in a separate YAML file instead of
embedding it in the Markdown.
Sponsored-by: author
|
|
Sponsored-by: author
|
|
The helper function was unnecessary baggage, written by an
inexperienced Rust programmer (i.e., me, three years ago). It's time
to let go.
Sponsored-by: author
|
|
This reduces the confusion with metadata::Metadata and Pandoc's metadata.
Sponsored-by: author
|
|
Sponsored-by: author
|
|
This allows us to not use a generic byte vector, and slightly lessens
the chance of mistakes. Also, it strongly encodes what we need to know
about and do with SVG images.
Sponsored-by: author
|
|
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
|
|
feat: make errors have a source error
See merge request subplot/subplot!284
|
|
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
|
|
Sponsored-by: author
|
|
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
tidy up error handling a bit
See merge request subplot/subplot!275
|
|
SubplotError::JsonError is a generic error, but we actually only parse
JSON when parsing the AST from Pandoc. Replace it with a ::AstJson
error to be more specific, and hopefully more helpful to the user.
Sponsored-by: author
|
|
SubplotError::RegexError was a struct variant in the enum. Replace it
with a more usual variant with the regex::Error as a source field, for
better error messaging.
Sponsored-by: author
|
|
SubplotError::YamlError is quite generic. We only parse YAML as part
of document metadata, so replace the error with a more specific one.
Sponsored-by: author
|
|
Replace SubplotError::PandocError with ::Pandoc, which is only for
executing the Pandoc program. In reality, so was the old variant, but
the new one is more specific, and also embeds the error from executing
Pandoc as a source error.
The error message is still crap, but that will be fixed later by not
using Pandoc for parsing Markdown.
Sponsored-by: author
|
|
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
|
|
Replace subplot::Result<T> with Result<T, SubplotError>. I find this
now to be clearer, as I don't need to remind myself which Result is
being used where. This should not be a breaking change.
Sponsored-by: author
|
|
In support of #256, this adds `example` as a permitted class and
ensures that we typeset it as though it were a file.
This includes linting it as though it were a file too.
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
Change everywhere to use the word "diagram" instead of "graph. Diagram
seems like the better word. It's mostly used in comments and
documentation, but there was one filename and one trait name that
needed changing.
I used "rg -iw graph" and "find -iname '*graph*'" to find everywhere
that needed changing.
Sponsored-by: author
|
|
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
|
|
Sponsored-by: author
|
|
Sponsored-by: author
|
|
Sponsored-by: author
|
|
Sponsored-by: author
|
|
Add a --merciful option to subcommands for which this matters. Adjust
tests to invoke subplot with that option as necessary.
Sponsored-by: author
|
|
Change places where warnings used to be written out so the warnings
are pushed into the list in Document instead.
Sponsored-by: author
|
|
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
|
|
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
Also, sort the dependency list in Cargo.toml so it's tidy.
Sponsored-by: author
|
|
This changes typesetting of scenarios so that when two adjacent
scenario steps have the same keyword, "and" is used on the second one.
This means that when input has
when I do foo
when I do bar
the output will have
when I do foo
and I do bar
I didn't bother to make this configurable. I don't feel that level of
configuration is good.
The "keyword aliases" scenario is repurposed to verify this.
Sponsored-by: author
|
|
Sponsored-by: author
|
|
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
Sponsored-by: author
|
|
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
|
|
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
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>
|
|
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>
|
|
The old regex had a wrong, and weird, pattern for lines of YAML. The
new one is simpler and seems more correct: it matches lines not
staring with a dot.
Sponsored-by: author
|
|
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
|
|
Sequoia wants Rust 1.48.0 and split_once is not in that version. We
can easily accommodate Sequoia's needs here with a simple change.
Sponsored-by: author
|