diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-05-12 23:02:54 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-05-12 23:02:54 -0400 |
| commit | d4f99d5be4a9329568911270bed0e64707c1ab7d (patch) | |
| tree | 492d3e1fb675411a692467e327f3ab1730a2a9e0 /test/corpus/headers_sisu.txt | |
| parent | docs: add README; adopt git.sisudoc.org/tools/ namespace (diff) | |
Until now the grammar handled only the sisudoc-spine YAML header form.
Real SiSU markup uses two textually disjoint header dialects with an
identical body grammar:
bespoke (original SiSU, ruby): yaml (sisudoc-spine):
% SiSU 4.0.0 # SiSU 8.0
@title: Alice's Adventures title: "Alice's Adventures"
@creator: creator:
:author: Carroll, Lewis author: "Carroll, Lewis"
Add bespoke-dialect rules alongside the existing yaml ones; the body
grammar is shared between the two.
grammar.js:
- version_comment widened from /# SiSU(spine)? <ver>/ to
/[#%] SiSU[^\n]*\n/. Real banners observed across both corpora
include "# SiSU 8.0", "# SiSUspine 8.0", "# SiSU master 8.0",
"# SiSU: http://...", "% SiSU 4.0.0", "% SiSU 0.72",
"% SiSU http://...", "% SiSU markup for 0.16 and later".
- Added sisu_header_field / sisu_header_key / sisu_header_value /
sisu_header_continuation.
- sisu_header_key whitelists the 14 @keys observed in the sisu
corpus (including the @links:+ additive variant), parallel to
the existing yaml header_key whitelist.
- sisu_header_continuation accepts any 1+ space indented line whose
first non-space character is not a newline. Covers " :sub: val",
" { text }url" freeform under @links:, and 3+ space wrap-line
continuations (10690 occurrences across the sisu corpus, almost
all inside @classify: :topic_register: entries).
- Wired sisu_header_field into _toplevel alongside header_field.
queries/highlights.scm:
- Added @keyword / @string captures for the new sisu_* nodes,
parallel to the existing yaml header captures.
test/corpus/headers_sisu.txt:
- 12 new cases: % SiSU banner variants, @title: with inline value,
@creator: + :author:, @date: with multiple sub-keys, @make:
mixed sub-keys, @links: with freeform { text }url continuations,
@links:+ additive, full bespoke header block, and a coexistence
case confirming yaml + bespoke at the same top level.
README.md and sisu-markup_tree-sitter.md:
- Describe dual-dialect support; add sisu corpus results table.
Test results:
- tree-sitter test: 79 / 79 pass.
- sisu-markup-samples/data/samples/ (full sisu corpus): 44 / 65
parse cleanly (was 0 / 65). current/ layout parses at 20 / 21
(95 %); the dominant failure mode is the wrapped/ layout
(7 / 21) which trips the pre-existing one-line-per-paragraph
limitation, not the new header rules.
- sisudoc-spine-samples/markup/ (full spine corpus): 37 / 46
unchanged. No regression in the yaml dialect.
Mixing the two dialects inside one document remains parseable but
non-idiomatic; enforcement is left to a future linter pass rather
than the grammar.
(assisted by Claude-Code)
Diffstat (limited to 'test/corpus/headers_sisu.txt')
| -rw-r--r-- | test/corpus/headers_sisu.txt | 201 |
1 files changed, 201 insertions, 0 deletions
diff --git a/test/corpus/headers_sisu.txt b/test/corpus/headers_sisu.txt new file mode 100644 index 0000000..21f8358 --- /dev/null +++ b/test/corpus/headers_sisu.txt @@ -0,0 +1,201 @@ +================== +SiSU bespoke banner (version) +================== + +% SiSU 4.0.0 + +--- + +(document + (version_comment)) + +================== +SiSU bespoke banner (older version) +================== + +% SiSU 0.72 + +--- + +(document + (version_comment)) + +================== +SiSU bespoke banner (URL form) +================== + +% SiSU http://www.jus.uio.no/sisu + +--- + +(document + (version_comment)) + +================== +SiSU bespoke banner (freeform note) +================== + +% SiSU markup for 0.16 and later + +--- + +(document + (version_comment)) + +================== +Bespoke @title with inline value +================== + +@title: Alice's Adventures in Wonderland + +--- + +(document + (sisu_header_field + key: (sisu_header_key) + value: (sisu_header_value))) + +================== +Bespoke @creator with :author sub-key +================== + +@creator: + :author: Carroll, Lewis + +--- + +(document + (sisu_header_field + key: (sisu_header_key) + (sisu_header_continuation))) + +================== +Bespoke @date with multiple sub-keys +================== + +@date: + :published: 1865 + :created: 1865 + :available: 1865 + :added_to_site: 2004-04-12 + +--- + +(document + (sisu_header_field + key: (sisu_header_key) + (sisu_header_continuation) + (sisu_header_continuation) + (sisu_header_continuation) + (sisu_header_continuation))) + +================== +Bespoke @make with mixed sub-keys +================== + +@make: + :headings: none; none; none; CHAPTER; + :breaks: new=3; break=4 + +--- + +(document + (sisu_header_field + key: (sisu_header_key) + (sisu_header_continuation) + (sisu_header_continuation))) + +================== +Bespoke @links with freeform link continuations +================== + +@links: + { Alice in Wonderland @ Wikipedia }http://en.wikipedia.org/wiki/Alice%27s_Adventures_in_Wonderland + { Lewis Carroll @ Wikipedia }http://en.wikipedia.org/wiki/Lewis_Carroll + +--- + +(document + (sisu_header_field + key: (sisu_header_key) + (sisu_header_continuation) + (sisu_header_continuation))) + +================== +Bespoke @links:+ additive variant +================== + +@links:+ + { ftp archive }ftp://example.org/pub + +--- + +(document + (sisu_header_field + key: (sisu_header_key) + (sisu_header_continuation))) + +================== +Full bespoke header block +================== + +% SiSU 4.0.0 + +@title: Alice's Adventures in Wonderland + +@creator: + :author: Carroll, Lewis + +@date: + :published: 1865 + +@rights: + :copyright: Lewis Carroll + :license: Public Domain + +@classify: + :topic_register: SiSU markup sample:book:novel; + book:novel:fiction:fantasy|children's fiction + +--- + +(document + (version_comment) + (sisu_header_field + key: (sisu_header_key) + value: (sisu_header_value)) + (sisu_header_field + key: (sisu_header_key) + (sisu_header_continuation)) + (sisu_header_field + key: (sisu_header_key) + (sisu_header_continuation)) + (sisu_header_field + key: (sisu_header_key) + (sisu_header_continuation) + (sisu_header_continuation)) + (sisu_header_field + key: (sisu_header_key) + (sisu_header_continuation) + (sisu_header_continuation))) + +================== +YAML and bespoke key disjoint at top level +================== + +# SiSU 8.0 + +title: "Spine document" + +@title: Sisu document + +--- + +(document + (version_comment) + (header_field + key: (header_key) + value: (header_value)) + (sisu_header_field + key: (sisu_header_key) + value: (sisu_header_value))) |
