Age | Commit message (Collapse) | Author | Files | Lines |
|
YamlMetadata was in src/ast.rs, because originally it was only used to
parse metadata out of Markdown. Markdown parsing is now in its own
module, leaving ast.rs to only contain YamlMetadata. In this
situation, it seems tidy to have both kinds of metadata in the same
module, and to drop the now-empty ast.rs module.
Sponsored-by: author
|
|
Sponsored-by: author
|
|
We don't want to use pandoc_ast outside of the md module.
Sponsored-by: author
|
|
We'll want to use the new Markdown type instead.
Sponsored-by: author
|
|
YamlMetadata::new is only used in unit tests, so disable it when not
testing.
Sponsored-by: author
|
|
This was orphaned when we dropped the functionality to extract YAML
metadata embedded in the Markdown source. Because the function was
exported, tools didn't complain that it's unused.
Sponsored-by: author
|
|
Sponsored-by: author
|
|
Rename the field "author", which takes a single string value, to
"authors", which takes a list of strings. This way we're consistent
for single- and multi-author documents.
Sponsored-by: author
|
|
Sponsored-by: author
|
|
The "pandoc" key gets added to the metadata given to Pandoc as-is.
Sponsored-by: author
|
|
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
|
|
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
|
|
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>
|
|
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>
|
|
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
|
|
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
|
|
With the new pulldown-cmark parser for codegen, we are explicit about
what fields we allow in the YAML document metadata block. We currently
don't allow the `documentclass` field. Allow it. It's a useful way for
controlling typesetting vie LaTeX to PDF.
Sponsored-by: author
|
|
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
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
|
|
Also, fix anywhere that's affected by the change.
|
|
When reading a PDF printed on paper or on a reMarkable tablet, it's
not possible to see that there even is a link in a PDF. Make this more
visible by typesetting the link URL as a footnote.
This is not done on HTML output as web pages are read on browsers that
make links easy to see.
This is the first time the AST is transformed by docgen differently
based on the output format. The decision of what should be done is a
policy decision, best done at the topmost level: in the main function
of docgen.
The result of that decidion (turn links into footnotes or not) is
communicated from docgen main into the ast.rs module via a new Style
struct. This mechanism can later be extended for other typesetting
style decisions (e.g., what fonts to use).
|
|
This only moves things around, to avoid huge source code modules. It
doesn't rename functions, add unit tests, or similar.
* src/datafiles.rs: DataFile, DataFiles
* src/metata.rs: Metadata
* src/panhelper.rs: functions for querying Pandoc Attrs
* src/policy.rs: the get_basedir_from function; place for later policy
functions
* src/typeset.rs: functions to produce Pandoc AST nodes
* srv/visitor/*: various MutVisitor implementations for traversing
ASTs, and their helper functions
|
|
Add sp-extract
Closes #41
See merge request larswirzenius/subplot!53
|
|
This will be used soon by a program to extract data files from
subplots, but I expect it to be more generally useful in the future.
|
|
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>
|
|
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.
|
|
Change: keep actual text of keyword from scenario
Closes #24
See merge request larswirzenius/subplot!38
|
|
The typesetting should preserve the actual keyword or alias in the
source. Previously, if source had this:
```
given foo
and bar
```
it got typeset as if were:
```
given foo
given bar
```
Also, change subplot.md to use alias when possible.
|
|
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.
|
|
Add known class names and lint for code blocks with unknown classes
Closes #21
See merge request larswirzenius/subplot!35
|
|
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>
|
|
Source files are:
* the markdown file
* the bindings, functions, and bibliography files listed in YAML
metadata
* any included images in the markdown
The template file is not considered: it's only relevant for codegen.
The docgen binary is not considered, either, for now, because reliably
finding the binary is difficult.
|
|
|
|
All the language specific details are now in template.yaml, including
the command for how to run the generated test program.
|
|
|
|
We switch from assuming a continuation of `Given` by default
to passing Option<StepKind> around and ensuring that we do not
succeed in parsing a step if that is None.
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
|