summaryrefslogtreecommitdiff
path: root/src/lib.rs
AgeCommit message (Collapse)AuthorFilesLines
3 daysrefactor: move all typesetting (HTML generation) to src/typeset.rsLars Wirzenius1-0/+2
This paves the way for a future change where src/html.rs is replaced with the html-page crate. Signed-off-by: Lars Wirzenius <liw@liw.fi> Sponsored-by: author
2024-04-20refactor: move markdown-to-html parser into mdparse.rsLars Wirzenius1-0/+1
Signed-off-by: Lars Wirzenius <liw@liw.fi> Sponsored-by: author
2023-12-25feat: typeset scenarios by typesetting stepsLars Wirzenius1-3/+0
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-04-08chore: drop Pandoc stuff as a Rust depenendencyLars Wirzenius1-7/+0
Sponsored-by: author
2023-04-05feat: add an HTML representation using the Rust type systemLars Wirzenius1-0/+1
Sponsored-by: author
2023-01-28refactor: move visitor, panhelper, typeset modules into mdLars Wirzenius1-6/+0
This commit just moves files around and fixes references to moved modules. Sponsored-by: author
2023-01-28refactor: move YamlMetadata to src/metadata.rsLars Wirzenius1-4/+1
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
2023-01-22refactor: drop abstract syntax tree built using pulldown_cmarkLars Wirzenius1-1/+1
We'll want to use the new Markdown type instead. Sponsored-by: author
2023-01-22refactor: add module for parsed MarkdownLars Wirzenius1-0/+1
This will eventually be the only module in Subplot that uses pandoc_ast or exposes types from that crate. When we replace pandoc_ast with something pulldown_cmark, only this module will need to change. Sponsored-by: author
2022-12-28refactor: drop unused extract_metadata functionLars Wirzenius1-1/+1
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
2022-09-03refactor: expose functionality to extract embedded YAML from mdLars Wirzenius1-1/+1
Sponsored-by: author
2022-09-03refactor: rename DataFile{,s} to EmbeddedFile{,s} to be systematicLars Wirzenius1-3/+3
Sponsored-by: author
2022-09-03refactor: add a type for SVG imagesLars Wirzenius1-1/+1
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
2022-05-05refactor: drop the subplot::Result type aliasLars Wirzenius1-1/+0
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
2022-04-26refactor: use "diagram" instead of "graph"Lars Wirzenius1-2/+2
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
2022-04-10refactor: collect warnings for a document in its DocumentLars Wirzenius1-0/+2
Change places where warnings used to be written out so the warnings are pushed into the list in Document instead. Sponsored-by: author
2021-11-19various: Rework document to support multiple implementationsDaniel Silverstone1-1/+1
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-0/+1
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-0/+3
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-07-20feat: when more than one bindings match a step, list all of themLars Wirzenius1-0/+1
Sponsored-by: author
2021-06-19cli: Add flexibility in dot and plantuml locationsDaniel Silverstone1-1/+1
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-05-01pandoc_ast: Support multiple versions of pandoc_astDaniel Silverstone1-0/+8
In order to cope with multiple versions of Pandoc, we need to support various pandoc_ast versions. This patch introduces support for both 0.8 and 0.7, defaulting to the older 0.7. If you use Subplot on a system with a much newer pandoc, then switch to the 0.8 variant to cope. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-01-09resource: Step one of VFS support, redirect all opensDaniel Silverstone1-0/+2
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-11-04graphmarkup: Add pikchr rendererDaniel Silverstone1-1/+1
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-10-11chore: drop an allow for a clippy warning, buster rustc is newer nowLars Wirzenius1-4/+0
2020-09-19refactor: split src/ast.rs into src/doc.rs and src/style.rsLars Wirzenius1-3/+5
Also, fix anywhere that's affected by the change.
2020-09-11build: disable clippy::match_as_ref warningLars Wirzenius1-0/+4
2020-09-01feat(docgen): typeset links as footnotes in PDFLars Wirzenius1-0/+1
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).
2020-08-08refactor: split stuff from src/ast.rs into smaller modulesLars Wirzenius1-2/+16
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
2020-06-08refactor: export DataFile so programs can use embedded filesLars Wirzenius1-0/+1
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.
2020-05-09Change: use a base directory for relative pathsLars Wirzenius1-0/+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-1/+1
This lets sp-codegen.rs be only about the command line parsing etc.
2020-04-22Change: get Python template from templates/python/template.{yaml.py}Lars Wirzenius1-0/+3
All the language specific details are now in template.yaml, including the command for how to run the generated test program.
2020-03-30Refactor: rename OurError to SubplotErrorLars Wirzenius1-1/+1
On consideration, it's a clearer name. I've been trying to avoid using "subplot" in the identifiers, in case we ever have to rename the project again, but I think this is worth it.
2020-03-28Change: use thiserror to simplify errors.rsLars Wirzenius1-1/+1
2020-03-08Refactor: add a GraphMarkup trait, use for dot and plantumlLars Wirzenius1-0/+3
2020-01-08Change: use tera templates for generating Python codeLars Wirzenius1-0/+1
2020-01-01Add: codegen.rs moduleLars Wirzenius1-0/+3
2019-12-28Add: missing documentation commentsLars Wirzenius1-1/+1
2019-12-28Fix: use of missing_docs directiveLars Wirzenius1-1/+1
2019-12-22Add: struct ScenarioLars Wirzenius1-0/+3
2019-12-22Add: struct Document to represent a Subplot documentLars Wirzenius1-1/+1
2019-12-14Change: fix or add doc comments everywhereLars Wirzenius1-5/+3
2019-12-14Refactor: rename typeset_subplot to typeset_documentLars Wirzenius1-1/+1
2019-12-14Change: error on missing docs, add some for errorsLars Wirzenius1-0/+1
2019-12-14Refactor: move graphs.rs and typeset.rs into ast.rsLars Wirzenius1-4/+0
2019-12-14Refactor: move dot_to_svg into graphs.rsLars Wirzenius1-3/+0
2019-12-14Refactor: provide a Result typeLars Wirzenius1-0/+1
2019-12-14Refactor: introduce a custom error typeLars Wirzenius1-0/+4
2019-12-12Refactor: make unmatched, text be PartialStep constructorsLars Wirzenius1-1/+0