Add WML renderer for WAP decks
Adds a `wml` renderer plugin converting Markdown into WML decks for
old WAP browsers, following the existing parser -> BlockEvent stream
-> renderer plugin architecture (see gemini/micron/ama renderers).
WML content is idiomatically short and button/link-navigated rather
than one long page, so unlike the other renderers, `wml` can split a
document into multiple <card>s -- but only opt-in:
- Manual `{.card}` / `{.card Title}` divider directives (new,
format-agnostic BlockKind.CARD_BREAK; silently ignored by every
other renderer via their existing unhandled-kind no-op path).
- Heading-level splitting via `--renderer-option split_level=N`,
ignored when manual dividers are present.
- Plain documents with neither stay a single card (the safe default).
When a document resolves to 2+ cards, a hub-and-spoke menu card is
built by default (button/link choices -> section, Back to menu), or
`menu=false` switches to a linear Next/Back chain. A byte-overflow
safety net (`max_card_bytes`, default 1400) paginates any single
section that's still too large.
Also adds GFM pipe-table support (BlockKind.TABLE) via the same
sentinel-injection preprocessing trick already used for ASCII art
blocks, so the parser's line-by-line loop needed no lookahead rework.
Rendered as `<table>` in wml, silently ignored elsewhere.
No new dependencies. No devbox/jj/test-suite additions -- decided
against for this repo (see README for the full option reference).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
b539d037c6
commit
d5046543b3
9 changed files with 641 additions and 3 deletions
14
examples/wml-manual.md
Normal file
14
examples/wml-manual.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
Live updates for the ridge trail network. Reception is spotty past the tree line, check before you go.
|
||||
|
||||
{.card Weather}
|
||||
Cold and clear. Wind: **15 mph** gusting from the *northwest*. Permit fee: $5.
|
||||
|
||||
{.card Trail Status}
|
||||
- North Loop: open
|
||||
- South Loop: closed
|
||||
- Summit Spur: open, ice above 2000m
|
||||
|
||||
{.card Contact}
|
||||
Ranger station: [call dispatch](tel:+15555550123)
|
||||
|
||||

|
||||
19
examples/wml.md
Normal file
19
examples/wml.md
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Trail Conditions
|
||||
|
||||
Live updates for the ridge trail network. Reception is spotty past the tree line, check before you go.
|
||||
|
||||
## Weather
|
||||
|
||||
Cold and clear. Wind: **15 mph** gusting from the *northwest*. Permit fee: $5.
|
||||
|
||||
## Trail Status
|
||||
|
||||
- North Loop: open
|
||||
- South Loop: closed
|
||||
- Summit Spur: open, ice above 2000m
|
||||
|
||||
## Contact
|
||||
|
||||
Ranger station: [call dispatch](tel:+15555550123)
|
||||
|
||||

|
||||
17
examples/wml.wml
Normal file
17
examples/wml.wml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">
|
||||
<wml>
|
||||
<card id="card1">
|
||||
<p><b><big>Trail Conditions</big></b></p>
|
||||
<p>Live updates for the ridge trail network. Reception is spotty past the tree line, check before you go.</p>
|
||||
<p><b>Weather</b></p>
|
||||
<p>Cold and clear. Wind: <b>15 mph</b> gusting from the <i>northwest</i>. Permit fee: $$5.</p>
|
||||
<p><b>Trail Status</b></p>
|
||||
<p>- North Loop: open</p>
|
||||
<p>- South Loop: closed</p>
|
||||
<p>- Summit Spur: open, ice above 2000m</p>
|
||||
<p><b>Contact</b></p>
|
||||
<p>Ranger station: <a href="tel:+15555550123">call dispatch</a></p>
|
||||
<p><img src="https://example.com/map.png" alt="Trail map"/></p>
|
||||
</card>
|
||||
</wml>
|
||||
Loading…
Add table
Add a link
Reference in a new issue