Skip to content

render-ltml and serve-ltml#24

Merged
rowland merged 6 commits intomasterfrom
claude/execute-serve-ltml-0QEj5
Mar 28, 2026
Merged

render-ltml and serve-ltml#24
rowland merged 6 commits intomasterfrom
claude/execute-serve-ltml-0QEj5

Conversation

@rowland
Copy link
Copy Markdown
Owner

@rowland rowland commented Mar 28, 2026

No description provided.

claude and others added 6 commits March 28, 2026 04:49
- Add SetAssetFS/AssetFS to ltml.Scope with per-scope storage and parent
  inheritance, so concurrent documents can carry different asset filesystems
  without sharing global state.
- Add per-document rootScope to ltml.Doc; Doc.SetAssetFS sets the FS on this
  root scope, which all parsed element scopes inherit via the parent chain.
- Update ltml.HasScope interface to include SetAssetFS and AssetFS.
- Extend StdImage to resolve image bytes via the scope's asset filesystem when
  one is set and the Writer implements the data-based image methods; falls back
  to the file-path Writer methods for backward compatibility.
- Add github.com/namsral/flag dependency for env-variable-aware flag parsing.
- Implement ltml/server (package main):
  - config.go: Config struct + parseConfig using namsral/flag
  - overlayfs.go: per-request overlay FS (upper=uploads, lower=base-path)
  - render.go: LTML parse → SetAssetFS → ltpdf render → temp PDF
  - handler.go: multipart streaming, upload validation, lifecycle cleanup
  - main.go: http.Server wiring and startup
- Add tests covering handler behaviour, overlay FS semantics, LTML FS
  threading, and request-temp-dir cleanup.

https://claude.ai/code/session_01Fr7DT5rkqVCraSSSEFrWbV
overlayfs: sort ReadDir results by name (fs.ReadDirFS contract requires it)
overlayfs: remove unused overlayFile type
handler: require Content-Type multipart/form-data exactly, not multipart/*
main: replace Go 1.22 method-routing syntax with a plain /render pattern;
  renderHandler already enforces POST and returns 405 for other methods

https://claude.ai/code/session_01Fr7DT5rkqVCraSSSEFrWbV
Extract overlayfs.FS to internal/overlayfs so both commands share it.

Rewrite cmd/render-ltml to use doc.SetAssetFS instead of os.Chdir:
- Extra files are still symlinked into a temp dir, but the dir is presented
  as an fs.FS upper layer rather than the process working directory.
- When an extra file has the same base name as an assets-dir file, the extra
  file silently shadows it (last -e flag wins on true name collisions).
- No asset filesystem is set when neither -a nor -e are given, preserving
  backward-compatible behaviour for plain file-path rendering.

Update cmd/serve-ltml/overlayfs.go to delegate to internal/overlayfs.
Move detailed overlay tests from cmd/serve-ltml to internal/overlayfs.

https://claude.ai/code/session_01Fr7DT5rkqVCraSSSEFrWbV
@rowland rowland merged commit 189112f into master Mar 28, 2026
2 checks passed
@rowland rowland deleted the claude/execute-serve-ltml-0QEj5 branch March 28, 2026 18:06
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.

2 participants