Allowing piecewise Ecmarkup usage in other documents
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 245
- Forks
- 80
- Avg merge
- 10h 46m
- Merged PRs (30d)
- 2
Description
For a while now I've been maintaining emu-algify, which reaches into the internals of Ecmarkup in order to add ES-style EMD processing and EMU autolinking to https://streams.spec.whatwg.org/.
Right now it's stuck on EMU 2.x, and I thought before I go upgrade it to work with EMU 3.x, I should try to get a public API for myself.
At the highest level, what I want to be able to do is, given as input a HTML document with abstract operation definitions and algorithms, process the EMD syntax within those algorithms, and then get autolinks for all terms and abstract operations defined both in ES and in the document itself.
Here is a more low-level description of how emu-algify currently goes about this:
- Creates a new EmuSpec with the HTML file as input
- Loads the "ES6" bibliography
- Finds all elements matching
[aoid], and force-feeds the element's ID and AOID values into the EmuSpec's bibliography - Runs emu's steps to build emu-alg, to autolink, and to build emu-xrefs, all of which mutate the EmuSpec's document
- Serializes the EmuSpec's document back out.
Currently one big problem I have is that this is over-agressive in autolinking: my table of contents gets autolinked, leading to the strange TOC you see in https://streams.spec.whatwg.org/ where only half the line is linked. (Maybe the fix here is simply to not autolink if already inside an <a> tag...)
Here is perhaps a design that would make sense:
- Create a new public API, call it EmuProcessor, which you can add custom biblios to using a relatively simple public API. Should also be able to add the ES6 biblio, of course.
- Let me feed in EMU strings (including EMD strings) and get out a string result. Or maybe this should be Node -> Node (assuming a jsdom API); that could avoid some re-serialization when in my case I'd probably be manipulating the document anyway for other reasons.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing EmuSpec workflow described in the issue, including bibliography loading, emu-alg processing, autolinking, and emu-xrefs. Define the public EmuProcessor boundary and verify how it should accept HTML or EMU/EMD input, custom and ES6 bibliographies, and return a document result. Done should include preventing autolinks inside the table of contents and documenting the chosen string-versus-Node API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100