Created
July 13, 2024 03:40
-
-
Save gedw99/6bea7f8ec0002ab34ab6eb6915ccb265 to your computer and use it in GitHub Desktop.
Incremental Rendering with Deck.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Incremental Rendering with Deck.md | |
You're right in that I want to do Incremental Rendering. | |
I walked the code and some areas I do not think will allow it yet. | |
## Use case | |
User wants to visually edit a Deck using Deck Canvas OR CLI. | |
## Fragments Concept | |
I Know Deck has the Include Block but that's not useful here. | |
We need what we can call Fragments. I can't think of a better word to describe it right now. | |
A Fragment is a line of DSH, XML or even GIO Buffer ( the best word I can think of ). | |
I am not sure if a Line is the right Scoping ? Might be things that are more like Blocks, which are multi-line ? | |
The Deck DSH and XML code has line numbers in the Functions, so maybe we can use that ? | |
I dont know yet... | |
## Code Analysis | |
DSH Level | |
The DSH Process is here: https://github.com/ajstarks/decksh/blob/master/decksh.go#L26 | |
- Process takes a full DSH. I dont see how I can slip a Fragment into that. | |
The DSH Parser is here: https://github.com/ajstarks/decksh/blob/master/parse.go#L37 | |
- Parse takes in a DSH fragment, which is good, but does it give me XML back out ? Not sure. | |
The DSH Key Parser seems to be next: https://github.com/ajstarks/decksh/blob/master/parse.go#L375 | |
- Key Parrser does select for the main key words. | |
Looks like we can access Text block directly, with what i am guessing is the line number of the DSH file. | |
```go | |
func textblock(w io.Writer, s []string, linenumber int) error { | |
``` | |
XML Level | |
The XML Rendering is here: https://github.com/ajstarks/decksh/blob/master/generate.go#L111 | |
- Each Deck Type has a line numner | |
- Text: https://github.com/ajstarks/decksh/blob/master/generate.go#L180 | |
```go | |
func text(w io.Writer, s []string, linenumber int) error { | |
``` | |
Rendering Level | |
The GIO Rendering is here: https://github.com/ajstarks/giocanvas/blob/master/gcdeck/main.go#L652 | |
- A single deck in only | |
https://github.com/ajstarks/giocanvas/blob/master/gcdeck/main.go#L301 | |
- A single slide in | |
https://github.com/ajstarks/giocanvas/blob/master/gcdeck/main.go#L451 | |
- Example of the Text Element in the big select | |
https://github.com/ajstarks/giocanvas/blob/3743fd10e60c48578bf5be8923a8987b08b5986c/gcdeck/main.go#L206 | |
- Updates the actual Canvas with the Text. | |
## Flow | |
So if a User wants to change 1 line in a DSH ( a Fragment ), whats the best way ? | |
when looking at it at a granular level, i see the following: | |
0. We presume the User has inputted a DSH Fragment into the running process. | |
- they need to tell us the Line number too. | |
1. Merge the DSH Fragment into the Master DSH. It's now Transacted. Can do Unified DIff later for git. | |
2. Pass the DSH Fragment into the DSH Processor to get the equivalent XML Fragment, and merge the Master XML with that XML Fragment. | |
3. Pass the XML Fragment into the GIO Renderer to get the GIO Fragment ( for want of a better word ) , and update the GIO Canvas with that GIO Fragment. | |
We can have the SVG and PDF system running as an Async system on the side, with the whole XML data doing into them | |
1. No changes needed. | |
## Shell aspects | |
FULL and FRAGMENTS need to be exposed in the CLI then. | |
Existing: | |
```sh | |
$ decksh # input from stdin, output to stdout | |
$ decksh -o foo.xml # input from stdin, output to foo.xml | |
$ decksh foo.sh # input from foo.sh output to stdout | |
$ decksh -o foo.xml foo.sh # input from foo.sh output to foo.xml | |
``` | |
Proposed addition: | |
```sh | |
$ decksh -o foo.xml, foo_fragment.xml foo.sh foo_frgament.sh # input from foo.sh and foo_frgament.sh output to foo.xml and foo_fragment.xml | |
``` | |
## Regression Testing Aspects | |
We want to run each of these in 2 terminals, so we can check that foo.xml is always the same. | |
```sh | |
$ decksh -o foo.xml foo.sh # input from foo.sh output to foo.xml | |
``` | |
```sh | |
$ decksh -o foo.xml, foo_fragment.xml foo.sh foo_frgament.sh # input from foo.sh and foo_frgament.sh output to foo.xml and foo_fragment.xml | |
``` | |
Then we can simulate a user editing ( and so passing in a sequence of Fragments), by just running it over and over with a seqence of: | |
```sh | |
$ decksh -o foo.xml, foo_fragment.xml foo.sh foo_frgament.sh | |
$ decksh -o foo-01.xml, foo_fragment-01.xml foo.sh foo_frgament-01.sh | |
$ decksh -o foo-02.xml, foo_fragment-02.xml foo.sh foo_frgament-02.sh | |
``` | |
Our Files on disk so we can automate this with golang testing too: | |
The inputs sequence: | |
- foo_frgament-01.sh | |
- foo_frgament-02.sh | |
The matching output seqence: | |
- foo_01.xml, foo_fragment_01.xml | |
- foo_02.xml, foo_fragment_02.xml | |
## GIO Canvas aspects | |
Then we can look at the GIO Canvas. | |
tired so leaving here for now... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment