Skip to content

Browser editor on GitHub Pages, stateless parser, tests - #1

Open
bugracdnc wants to merge 1 commit into
mainfrom
web-editor
Open

bugracdnc wants to merge 1 commit into
mainfrom
web-editor

Conversation

@bugracdnc

Copy link
Copy Markdown
Owner

Summary

 cmd/
 ├── worksheetparser/   # CLI: warnings to stderr, exit 1 on errors
+└── wasm/              # wsp.render(text) -> {interactive, printable, warnings}
 internal/
 ├── parser/            # stateless Parse(io.Reader) -> (Worksheet, warnings)
+│   └── parser_test.go
 ├── generator/
+│   └── generator_test.go
-debug/                 # always-on debug printing
+web/                   # static editor: index.html, app.js, style.css
+.github/workflows/pages.yml   # vet + test, then `make web` -> GitHub Pages
+Makefile               # build / test / web / serve
 go.mod                 # module github.com/bugracdnc/worksheetparser (go install works)

Parser fixes:

-package-level worksheet/question vars   (2nd parse kept the 1st one's questions)
-line[1:indexOf(line, ":")]               (panic on "@key" without ":")
-question without @correct               (silently dropped)
+warnings: unknown key/type, missing @correct, correct answer not in options
+question without @type defaults to fill_blank

Evidence

  • Before: no tests; @nocolon → panic: slice bounds out of range
    After: go test ./... ok (parser + generator); all files in examples/ parse with 0 warnings

editor
printable

Merge Danger

Door: two-way

Blast Radius: small

Pages is already switched to "GitHub Actions" mode; merging deploys https://bugracdnc.github.io/worksheetparser/. main.wasm is ~7.7 MB (~2 MB gzipped) on first load. CLI output file names are unchanged.

https://claude.ai/code/session_01UzxmZqCkgEJNXBh5DzAMoa

- Parser is stateless, takes an io.Reader and returns warnings with line
  numbers instead of panicking or silently dropping questions
- cmd/wasm + web/: live editor with interactive/printable preview,
  download and print; deployed by .github/workflows/pages.yml
- Module path is github.com/bugracdnc/worksheetparser so go install works
- Remove the always-on debug package
- README with format reference and screenshots

Claude-Session: https://claude.ai/code/session_01UzxmZqCkgEJNXBh5DzAMoa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant