ceradoc-markdown 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/grammar/ceradoc-markdown.artifact.json +1 -0
- data/grammar/ceradoc-markdown.bindings.yml +13 -0
- data/grammar/ceradoc-markdown.parg +159 -0
- data/lib/ceradoc/markdown/behaviors/admonition.rb +21 -0
- data/lib/ceradoc/markdown/behaviors/attribute_list.rb +81 -0
- data/lib/ceradoc/markdown/behaviors/document.rb +34 -0
- data/lib/ceradoc/markdown/behaviors/extension.rb +69 -0
- data/lib/ceradoc/markdown/behaviors/heading.rb +33 -0
- data/lib/ceradoc/markdown/behaviors/math.rb +32 -0
- data/lib/ceradoc/markdown/behaviors/text.rb +14 -0
- data/lib/ceradoc/markdown/behaviors.rb +18 -0
- data/lib/ceradoc/markdown/bindings/captures.rb +151 -0
- data/lib/ceradoc/markdown/bindings/scope.rb +31 -0
- data/lib/ceradoc/markdown/bindings.rb +327 -0
- data/lib/ceradoc/markdown/errors.rb +28 -0
- data/lib/ceradoc/markdown/lint/registrations.rb +38 -0
- data/lib/ceradoc/markdown/lint.rb +16 -0
- data/lib/ceradoc/markdown/metanorma_inline_parser.rb +23 -0
- data/lib/ceradoc/markdown/metanorma_input.rb +135 -0
- data/lib/ceradoc/markdown/model/abbreviation.rb +27 -0
- data/lib/ceradoc/markdown/model/admonition.rb +33 -0
- data/lib/ceradoc/markdown/model/attribute_list.rb +25 -0
- data/lib/ceradoc/markdown/model/base.rb +54 -0
- data/lib/ceradoc/markdown/model/blockquote.rb +16 -0
- data/lib/ceradoc/markdown/model/code.rb +11 -0
- data/lib/ceradoc/markdown/model/code_block.rb +18 -0
- data/lib/ceradoc/markdown/model/comment.rb +14 -0
- data/lib/ceradoc/markdown/model/cross_reference.rb +10 -0
- data/lib/ceradoc/markdown/model/definition_item.rb +26 -0
- data/lib/ceradoc/markdown/model/definition_list.rb +35 -0
- data/lib/ceradoc/markdown/model/definition_term.rb +29 -0
- data/lib/ceradoc/markdown/model/document.rb +33 -0
- data/lib/ceradoc/markdown/model/emphasis.rb +11 -0
- data/lib/ceradoc/markdown/model/example_block.rb +21 -0
- data/lib/ceradoc/markdown/model/extension.rb +23 -0
- data/lib/ceradoc/markdown/model/footnote.rb +31 -0
- data/lib/ceradoc/markdown/model/footnote_reference.rb +17 -0
- data/lib/ceradoc/markdown/model/hard_line_break.rb +18 -0
- data/lib/ceradoc/markdown/model/heading.rb +17 -0
- data/lib/ceradoc/markdown/model/highlight.rb +13 -0
- data/lib/ceradoc/markdown/model/horizontal_rule.rb +11 -0
- data/lib/ceradoc/markdown/model/image.rb +19 -0
- data/lib/ceradoc/markdown/model/link.rb +19 -0
- data/lib/ceradoc/markdown/model/list.rb +22 -0
- data/lib/ceradoc/markdown/model/list_item.rb +14 -0
- data/lib/ceradoc/markdown/model/literal.rb +16 -0
- data/lib/ceradoc/markdown/model/math.rb +21 -0
- data/lib/ceradoc/markdown/model/named_value.rb +18 -0
- data/lib/ceradoc/markdown/model/open_block.rb +17 -0
- data/lib/ceradoc/markdown/model/paragraph.rb +15 -0
- data/lib/ceradoc/markdown/model/pass.rb +16 -0
- data/lib/ceradoc/markdown/model/sidebar.rb +18 -0
- data/lib/ceradoc/markdown/model/strikethrough.rb +13 -0
- data/lib/ceradoc/markdown/model/strong.rb +11 -0
- data/lib/ceradoc/markdown/model/subscript.rb +9 -0
- data/lib/ceradoc/markdown/model/superscript.rb +9 -0
- data/lib/ceradoc/markdown/model/table.rb +13 -0
- data/lib/ceradoc/markdown/model/text.rb +13 -0
- data/lib/ceradoc/markdown/model/underline.rb +9 -0
- data/lib/ceradoc/markdown/model/verse.rb +20 -0
- data/lib/ceradoc/markdown/parser/ast_processor.rb +565 -0
- data/lib/ceradoc/markdown/parser/attribute_lists.rb +48 -0
- data/lib/ceradoc/markdown/parser/block_parser.rb +735 -0
- data/lib/ceradoc/markdown/parser/frontmatter_parser.rb +23 -0
- data/lib/ceradoc/markdown/parser/grammar.rb +56 -0
- data/lib/ceradoc/markdown/parser/grammar_runtime.rb +164 -0
- data/lib/ceradoc/markdown/parser/html_entities.rb +2149 -0
- data/lib/ceradoc/markdown/parser/inline_parser.rb +314 -0
- data/lib/ceradoc/markdown/parser/parsanol_atoms.rb +36 -0
- data/lib/ceradoc/markdown/parser.rb +11 -0
- data/lib/ceradoc/markdown/parser_util.rb +90 -0
- data/lib/ceradoc/markdown/schema/definition.rb +81 -0
- data/lib/ceradoc/markdown/schema/loader.rb +68 -0
- data/lib/ceradoc/markdown/schema/parity.rb +101 -0
- data/lib/ceradoc/markdown/schema.rb +53 -0
- data/lib/ceradoc/markdown/serializer/builder.rb +57 -0
- data/lib/ceradoc/markdown/serializer/config.rb +71 -0
- data/lib/ceradoc/markdown/serializer/context.rb +66 -0
- data/lib/ceradoc/markdown/serializer/element_serializer.rb +46 -0
- data/lib/ceradoc/markdown/serializer/flavor.rb +82 -0
- data/lib/ceradoc/markdown/serializer/registrations.rb +113 -0
- data/lib/ceradoc/markdown/serializer/registry.rb +62 -0
- data/lib/ceradoc/markdown/serializer/runner.rb +84 -0
- data/lib/ceradoc/markdown/serializer/serializers/abbreviation.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/admonition.rb +20 -0
- data/lib/ceradoc/markdown/serializer/serializers/attribute_list.rb +25 -0
- data/lib/ceradoc/markdown/serializer/serializers/blockquote.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/code.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/code_block.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/comment.rb +31 -0
- data/lib/ceradoc/markdown/serializer/serializers/cross_reference.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/definition_list.rb +20 -0
- data/lib/ceradoc/markdown/serializer/serializers/document.rb +22 -0
- data/lib/ceradoc/markdown/serializer/serializers/emphasis.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/example_block.rb +48 -0
- data/lib/ceradoc/markdown/serializer/serializers/extension.rb +30 -0
- data/lib/ceradoc/markdown/serializer/serializers/footnote.rb +20 -0
- data/lib/ceradoc/markdown/serializer/serializers/footnote_reference.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/hard_line_break.rb +22 -0
- data/lib/ceradoc/markdown/serializer/serializers/heading.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/highlight.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/horizontal_rule.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/image.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/link.rb +29 -0
- data/lib/ceradoc/markdown/serializer/serializers/list.rb +43 -0
- data/lib/ceradoc/markdown/serializer/serializers/literal.rb +26 -0
- data/lib/ceradoc/markdown/serializer/serializers/math.rb +23 -0
- data/lib/ceradoc/markdown/serializer/serializers/open_block.rb +38 -0
- data/lib/ceradoc/markdown/serializer/serializers/paragraph.rb +23 -0
- data/lib/ceradoc/markdown/serializer/serializers/pass.rb +30 -0
- data/lib/ceradoc/markdown/serializer/serializers/sidebar.rb +33 -0
- data/lib/ceradoc/markdown/serializer/serializers/strikethrough.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/strong.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/subscript.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/superscript.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/table.rb +37 -0
- data/lib/ceradoc/markdown/serializer/serializers/text.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/underline.rb +19 -0
- data/lib/ceradoc/markdown/serializer/serializers/verse.rb +31 -0
- data/lib/ceradoc/markdown/serializer/strategies/admonition/base.rb +41 -0
- data/lib/ceradoc/markdown/serializer/strategies/admonition/container.rb +34 -0
- data/lib/ceradoc/markdown/serializer/strategies/admonition/gfm_alert.rb +28 -0
- data/lib/ceradoc/markdown/serializer/strategies/admonition/github.rb +27 -0
- data/lib/ceradoc/markdown/serializer/strategies/admonition/html.rb +25 -0
- data/lib/ceradoc/markdown/serializer/strategies/admonition/registry.rb +50 -0
- data/lib/ceradoc/markdown/serializer/strategies/autolink/angle.rb +35 -0
- data/lib/ceradoc/markdown/serializer/strategies/autolink/bare.rb +23 -0
- data/lib/ceradoc/markdown/serializer/strategies/autolink/base.rb +33 -0
- data/lib/ceradoc/markdown/serializer/strategies/autolink/none.rb +27 -0
- data/lib/ceradoc/markdown/serializer/strategies/autolink/registry.rb +58 -0
- data/lib/ceradoc/markdown/serializer/strategies/definition_list/base.rb +37 -0
- data/lib/ceradoc/markdown/serializer/strategies/definition_list/flat.rb +64 -0
- data/lib/ceradoc/markdown/serializer/strategies/definition_list/nested_html.rb +54 -0
- data/lib/ceradoc/markdown/serializer/strategies/definition_list/registry.rb +37 -0
- data/lib/ceradoc/markdown/serializer.rb +48 -0
- data/lib/ceradoc/markdown/toc_generator.rb +209 -0
- data/lib/ceradoc/markdown/transform/block_transformer.rb +163 -0
- data/lib/ceradoc/markdown/transform/from_core_model.rb +613 -0
- data/lib/ceradoc/markdown/transform/image_transformer.rb +21 -0
- data/lib/ceradoc/markdown/transform/inline_transformer.rb +78 -0
- data/lib/ceradoc/markdown/transform/list_transformer.rb +58 -0
- data/lib/ceradoc/markdown/transform/structural_transformer.rb +94 -0
- data/lib/ceradoc/markdown/transform/table_transformer.rb +40 -0
- data/lib/ceradoc/markdown/transform/text_extraction.rb +19 -0
- data/lib/ceradoc/markdown/transform/to_core_model.rb +304 -0
- data/lib/ceradoc/markdown/transformer.rb +48 -0
- data/lib/ceradoc/markdown/version.rb +7 -0
- data/lib/ceradoc/markdown.rb +218 -0
- data/schemas/blocks.yml +73 -0
- data/schemas/document.yml +55 -0
- data/schemas/inline.yml +57 -0
- data/schemas/lists.yml +35 -0
- data/schemas/tables.yml +11 -0
- metadata +284 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e220d49559fc25c8c71442310e14b9fd48d88547eb47fecd712c9267c1c14920
|
|
4
|
+
data.tar.gz: 7cce101f832777dc1ea41cf1c9fce78cea35daa367fc2b83e7d4bc91fe92cd23
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 7f77e19e0f8420db0bfdccb4186be27115159b90898ab8a19b8ee5ce47702db7e4a48232352c24decfccfcbe515e8cfd6541d56282c2c413b36240d17ad144c1
|
|
7
|
+
data.tar.gz: a6932e78aeb3a4df23473acb84e3873a409dcbf0724e886471ebc977bc947bdd632a2e254bc05fede5a440150510fc97b89931d885aae1271d681e37b6492ac8
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Abu Nashir
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"bindings":null,"version":"0.1.0","grammar":"CeradocMarkdown","shape":"parsanol-tree/v2","binding_version":1,"entries":{"document":{"root":"document","grammar":{"atoms":[{"Entity":{"atom":730}},{"CustomRef":{"name":"blank_line"}},{"Entity":{"atom":17}},{"Entity":{"atom":6}},{"Str":{"pattern":" "}},{"Re":{"pattern":"[\\x09]"}},{"Alternative":{"atoms":[4,5]}},{"Repetition":{"atom":3,"min":0,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"^"}},{"Entity":{"atom":6}},{"Repetition":{"atom":9,"min":0,"max":null,"tag":"Repetition"}},{"Entity":{"atom":16}},{"CustomRef":{"name":"line_ending"}},{"Entity":{"atom":14}},{"Re":{"pattern":"[\\x00-\\u{10ffff}]"}},{"Lookahead":{"atom":13,"positive":false}},{"Alternative":{"atoms":[12,15]}},{"Sequence":{"atoms":[7,8,10,11]}},{"Entity":{"atom":62}},{"Entity":{"atom":21}},{"Str":{"pattern":" "}},{"Repetition":{"atom":20,"min":0,"max":3,"tag":"Repetition"}},{"Entity":{"atom":25}},{"Str":{"pattern":"\\"}},{"Str":{"pattern":"#"}},{"Sequence":{"atoms":[23,24]}},{"Lookahead":{"atom":22,"positive":false}},{"Str":{"pattern":"#"}},{"Repetition":{"atom":27,"min":1,"max":6,"tag":"Repetition"}},{"Named":{"name":"heading","atom":28}},{"Str":{"pattern":"#"}},{"Lookahead":{"atom":30,"positive":false}},{"Entity":{"atom":47}},{"Entity":{"atom":6}},{"Repetition":{"atom":33,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"#"}},{"Repetition":{"atom":35,"min":0,"max":null,"tag":"Repetition"}},{"Entity":{"atom":6}},{"Repetition":{"atom":37,"min":0,"max":null,"tag":"Repetition"}},{"Entity":{"atom":45}},{"Str":{"pattern":"\r"}},{"Str":{"pattern":"\n"}},{"Alternative":{"atoms":[40,41]}},{"Lookahead":{"atom":42,"positive":false}},{"Entity":{"atom":14}},{"Sequence":{"atoms":[43,44]}},{"Lookahead":{"atom":39,"positive":false}},{"Sequence":{"atoms":[34,36,38,46]}},{"Lookahead":{"atom":32,"positive":false}},{"Str":{"pattern":" "}},{"Repetition":{"atom":49,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":47}},{"Lookahead":{"atom":51,"positive":false}},{"Entity":{"atom":45}},{"Sequence":{"atoms":[52,53]}},{"Repetition":{"atom":54,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"text","atom":55}},{"Sequence":{"atoms":[48,50,56]}},{"Repetition":{"atom":57,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":47}},{"Repetition":{"atom":59,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":16}},{"Sequence":{"atoms":[19,26,29,31,58,60,61]}},{"Entity":{"atom":68}},{"Entity":{"atom":21}},{"CustomRef":{"name":"ign_thematic_chars"}},{"CustomRef":{"name":"const_hr"}},{"Entity":{"atom":16}},{"Sequence":{"atoms":[64,65,66,67]}},{"Entity":{"atom":107}},{"Entity":{"atom":78}},{"Str":{"pattern":" "}},{"Entity":{"atom":77}},{"Entity":{"atom":45}},{"Repetition":{"atom":73,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"ln","atom":74}},{"Entity":{"atom":16}},{"Sequence":{"atoms":[75,76]}},{"Sequence":{"atoms":[71,72]}},{"CustomRef":{"name":"continuation"}},{"Entity":{"atom":78}},{"Entity":{"atom":102}},{"CustomRef":{"name":"ign_blank_line_verbatim"}},{"CustomRef":{"name":"const_ln_empty"}},{"CustomRef":{"name":"continuation"}},{"Str":{"pattern":" "}},{"Entity":{"atom":98}},{"Entity":{"atom":6}},{"Repetition":{"atom":87,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"ln","atom":88}},{"Entity":{"atom":14}},{"Lookahead":{"atom":90,"positive":false}},{"Sequence":{"atoms":[89,91]}},{"Entity":{"atom":6}},{"Repetition":{"atom":93,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"ln","atom":94}},{"CustomRef":{"name":"line_ending"}},{"Sequence":{"atoms":[95,96]}},{"Alternative":{"atoms":[92,97]}},{"Alternative":{"atoms":[85,86]}},{"Sequence":{"atoms":[84,99]}},{"Lookahead":{"atom":100,"positive":true}},{"Sequence":{"atoms":[82,83,101]}},{"Alternative":{"atoms":[80,81]}},{"Sequence":{"atoms":[79,103]}},{"Repetition":{"atom":104,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[70,105]}},{"Named":{"name":"code_block","atom":106}},{"Entity":{"atom":145}},{"Entity":{"atom":120}},{"Entity":{"atom":21}},{"StateSet":{"slot":"fence_indent","expr":110}},{"Str":{"pattern":"`"}},{"Repetition":{"atom":112,"min":3,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"~"}},{"Repetition":{"atom":114,"min":3,"max":null,"tag":"Repetition"}},{"Alternative":{"atoms":[113,115]}},{"StateSet":{"slot":"fence","expr":116}},{"CustomRef":{"name":"fence_info"}},{"Entity":{"atom":16}},{"Sequence":{"atoms":[111,117,118,119]}},{"CustomRef":{"name":"continuation"}},{"Entity":{"atom":126}},{"Entity":{"atom":21}},{"CustomRef":{"name":"fence_close_marker"}},{"Entity":{"atom":16}},{"Sequence":{"atoms":[123,124,125]}},{"Lookahead":{"atom":122,"positive":false}},{"CustomRef":{"name":"consume_fenced_indent"}},{"Entity":{"atom":77}},{"CustomRef":{"name":"ign_blank_line_verbatim"}},{"CustomRef":{"name":"const_ln_empty"}},{"Sequence":{"atoms":[130,131]}},{"Alternative":{"atoms":[129,132]}},{"Sequence":{"atoms":[121,127,128,133]}},{"Repetition":{"atom":134,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"code_block","atom":135}},{"CustomRef":{"name":"continuation"}},{"Entity":{"atom":126}},{"Sequence":{"atoms":[137,138]}},{"CustomRef":{"name":"continuation"}},{"Entity":{"atom":14}},{"Sequence":{"atoms":[140,141]}},{"Lookahead":{"atom":142,"positive":false}},{"Alternative":{"atoms":[139,143]}},{"Sequence":{"atoms":[109,136,144]}},{"Entity":{"atom":154}},{"Entity":{"atom":152}},{"Entity":{"atom":21}},{"Str":{"pattern":">"}},{"Str":{"pattern":" "}},{"Repetition":{"atom":150,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[148,149,151]}},{"CustomRef":{"name":"bq_scope"}},{"Sequence":{"atoms":[147,153]}},{"Entity":{"atom":375}},{"Entity":{"atom":348}},{"Entity":{"atom":334}},{"CustomRef":{"name":"blank_line"}},{"Entity":{"atom":62}},{"Entity":{"atom":68}},{"Entity":{"atom":120}},{"Entity":{"atom":154}},{"Entity":{"atom":243}},{"Entity":{"atom":6}},{"Repetition":{"atom":164,"min":0,"max":3,"tag":"Repetition"}},{"Entity":{"atom":226}},{"Str":{"pattern":"{:"}},{"Entity":{"atom":223}},{"Entity":{"atom":6}},{"Repetition":{"atom":169,"min":0,"max":null,"tag":"Repetition"}},{"Entity":{"atom":183}},{"Str":{"pattern":"."}},{"Entity":{"atom":181}},{"Entity":{"atom":179}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Str":{"pattern":"_"}},{"Alternative":{"atoms":[175,176,177,178]}},{"Str":{"pattern":"-"}},{"Alternative":{"atoms":[174,180]}},{"Repetition":{"atom":173,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[172,182]}},{"Entity":{"atom":188}},{"Str":{"pattern":"#"}},{"Entity":{"atom":181}},{"Repetition":{"atom":186,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[185,187]}},{"Entity":{"atom":220}},{"Entity":{"atom":181}},{"Repetition":{"atom":190,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"="}},{"Str":{"pattern":"\""}},{"Str":{"pattern":"\""}},{"Lookahead":{"atom":194,"positive":false}},{"Entity":{"atom":14}},{"Sequence":{"atoms":[195,196]}},{"Repetition":{"atom":197,"min":0,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"\""}},{"Sequence":{"atoms":[193,198,199]}},{"Str":{"pattern":"'"}},{"Str":{"pattern":"'"}},{"Lookahead":{"atom":202,"positive":false}},{"Entity":{"atom":14}},{"Sequence":{"atoms":[203,204]}},{"Repetition":{"atom":205,"min":0,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"'"}},{"Sequence":{"atoms":[201,206,207]}},{"Entity":{"atom":212}},{"Re":{"pattern":"[ ]"}},{"Re":{"pattern":"[\\x09-\\x0d]"}},{"Alternative":{"atoms":[210,211]}},{"Str":{"pattern":"}"}},{"Alternative":{"atoms":[209,213]}},{"Lookahead":{"atom":214,"positive":false}},{"Entity":{"atom":14}},{"Sequence":{"atoms":[215,216]}},{"Repetition":{"atom":217,"min":1,"max":null,"tag":"Repetition"}},{"Alternative":{"atoms":[200,208,218]}},{"Sequence":{"atoms":[191,192,219]}},{"Alternative":{"atoms":[171,184,189]}},{"Sequence":{"atoms":[170,221]}},{"Repetition":{"atom":222,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"ial","atom":168}},{"Str":{"pattern":"}"}},{"Sequence":{"atoms":[167,224,225]}},{"Entity":{"atom":240}},{"Str":{"pattern":"{:"}},{"Entity":{"atom":233}},{"Entity":{"atom":179}},{"Repetition":{"atom":230,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":":"}},{"Sequence":{"atoms":[231,232]}},{"Named":{"name":"ald_name","atom":229}},{"Entity":{"atom":6}},{"Repetition":{"atom":235,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":223}},{"Named":{"name":"ial","atom":237}},{"Str":{"pattern":"}"}},{"Sequence":{"atoms":[228,234,236,238,239]}},{"Alternative":{"atoms":[166,227]}},{"Entity":{"atom":16}},{"Sequence":{"atoms":[165,241,242]}},{"Entity":{"atom":307}},{"Entity":{"atom":290}},{"Str":{"pattern":"{::"}},{"Entity":{"atom":249}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Repetition":{"atom":248,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"ext_name","atom":247}},{"Entity":{"atom":285}},{"Entity":{"atom":6}},{"Repetition":{"atom":252,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":283}},{"Entity":{"atom":181}},{"Repetition":{"atom":255,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"="}},{"Str":{"pattern":"\""}},{"Str":{"pattern":"\""}},{"Lookahead":{"atom":259,"positive":false}},{"Entity":{"atom":14}},{"Sequence":{"atoms":[260,261]}},{"Repetition":{"atom":262,"min":0,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"\""}},{"Sequence":{"atoms":[258,263,264]}},{"Str":{"pattern":"'"}},{"Str":{"pattern":"'"}},{"Lookahead":{"atom":267,"positive":false}},{"Entity":{"atom":14}},{"Sequence":{"atoms":[268,269]}},{"Repetition":{"atom":270,"min":0,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"'"}},{"Sequence":{"atoms":[266,271,272]}},{"Entity":{"atom":212}},{"Str":{"pattern":"/"}},{"Str":{"pattern":"}"}},{"Alternative":{"atoms":[274,275,276]}},{"Lookahead":{"atom":277,"positive":false}},{"Entity":{"atom":14}},{"Sequence":{"atoms":[278,279]}},{"Repetition":{"atom":280,"min":1,"max":null,"tag":"Repetition"}},{"Alternative":{"atoms":[265,273,281]}},{"Sequence":{"atoms":[256,257,282]}},{"Sequence":{"atoms":[253,254]}},{"Repetition":{"atom":284,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"ext_options","atom":251}},{"Entity":{"atom":6}},{"Repetition":{"atom":287,"min":0,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"/}"}},{"Sequence":{"atoms":[246,250,286,288,289]}},{"Entity":{"atom":305}},{"Str":{"pattern":"{::"}},{"Entity":{"atom":249}},{"Named":{"name":"ext_name","atom":293}},{"Entity":{"atom":285}},{"Named":{"name":"ext_options","atom":295}},{"Str":{"pattern":"}"}},{"Str":{"pattern":"{:/"}},{"Lookahead":{"atom":298,"positive":false}},{"Entity":{"atom":14}},{"Sequence":{"atoms":[299,300]}},{"Repetition":{"atom":301,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"ext_body","atom":302}},{"Str":{"pattern":"{:/}"}},{"Sequence":{"atoms":[292,294,296,297,303,304]}},{"Alternative":{"atoms":[245,291]}},{"Named":{"name":"extension","atom":306}},{"Entity":{"atom":316}},{"Entity":{"atom":21}},{"Str":{"pattern":"-"}},{"Str":{"pattern":"*"}},{"Str":{"pattern":"+"}},{"Alternative":{"atoms":[310,311,312]}},{"Str":{"pattern":" "}},{"Repetition":{"atom":314,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[309,313,315]}},{"Entity":{"atom":327}},{"Entity":{"atom":21}},{"Re":{"pattern":"[\\x31-\\x39]"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":320,"min":0,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Str":{"pattern":")"}},{"Alternative":{"atoms":[322,323]}},{"Str":{"pattern":" "}},{"Repetition":{"atom":325,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[318,319,321,324,326]}},{"Entity":{"atom":333}},{"Entity":{"atom":21}},{"Str":{"pattern":":"}},{"Str":{"pattern":" "}},{"Repetition":{"atom":331,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[329,330,332]}},{"Alternative":{"atoms":[158,159,160,161,162,163,244,308,317,328]}},{"Lookahead":{"atom":157,"positive":false}},{"Entity":{"atom":346}},{"Entity":{"atom":21}},{"Str":{"pattern":"-"}},{"Repetition":{"atom":338,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"="}},{"Repetition":{"atom":340,"min":1,"max":null,"tag":"Repetition"}},{"Alternative":{"atoms":[339,341]}},{"Named":{"name":"heading","atom":342}},{"CustomRef":{"name":"ign_ws_rep"}},{"Entity":{"atom":16}},{"Sequence":{"atoms":[337,343,344,345]}},{"Lookahead":{"atom":336,"positive":false}},{"Sequence":{"atoms":[335,347]}},{"Entity":{"atom":21}},{"Entity":{"atom":362}},{"Entity":{"atom":45}},{"Repetition":{"atom":351,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"ln","atom":352}},{"Entity":{"atom":14}},{"Lookahead":{"atom":354,"positive":false}},{"Sequence":{"atoms":[353,355]}},{"Entity":{"atom":45}},{"Repetition":{"atom":357,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"ln","atom":358}},{"CustomRef":{"name":"line_ending"}},{"Sequence":{"atoms":[359,360]}},{"Alternative":{"atoms":[356,361]}},{"CustomRef":{"name":"continuation"}},{"Entity":{"atom":348}},{"Entity":{"atom":368}},{"CustomRef":{"name":"ign_ws_rep"}},{"Entity":{"atom":362}},{"Sequence":{"atoms":[366,367]}},{"Sequence":{"atoms":[363,364,365]}},{"Repetition":{"atom":369,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[350,370]}},{"Named":{"name":"text","atom":371}},{"CustomRef":{"name":"continuation"}},{"Entity":{"atom":346}},{"Sequence":{"atoms":[156,349,372,373,374]}},{"Entity":{"atom":501}},{"Entity":{"atom":491}},{"Entity":{"atom":316}},{"StateSet":{"slot":"list_marker","expr":378}},{"CustomRef":{"name":"ign_thematic_in_list"}},{"CustomRef":{"name":"const_hr"}},{"Sequence":{"atoms":[380,381]}},{"Named":{"name":"li","atom":382}},{"Entity":{"atom":488}},{"Entity":{"atom":438}},{"Entity":{"atom":77}},{"CustomRef":{"name":"continuation"}},{"Entity":{"atom":397}},{"CustomRef":{"name":"blank_line"}},{"Repetition":{"atom":389,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":62}},{"Entity":{"atom":68}},{"Entity":{"atom":120}},{"Entity":{"atom":154}},{"Entity":{"atom":316}},{"Entity":{"atom":327}},{"Alternative":{"atoms":[390,391,392,393,394,395,396]}},{"Lookahead":{"atom":388,"positive":false}},{"Entity":{"atom":420}},{"Str":{"pattern":" "}},{"Str":{"pattern":"\t"}},{"Alternative":{"atoms":[400,401]}},{"Str":{"pattern":"-"}},{"Str":{"pattern":"*"}},{"Str":{"pattern":"+"}},{"Alternative":{"atoms":[403,404,405]}},{"Str":{"pattern":" "}},{"Repetition":{"atom":407,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[406,408]}},{"Re":{"pattern":"[\\x31-\\x39]"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":411,"min":0,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Str":{"pattern":")"}},{"Alternative":{"atoms":[413,414]}},{"Str":{"pattern":" "}},{"Repetition":{"atom":416,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[410,412,415,417]}},{"Alternative":{"atoms":[409,418]}},{"Sequence":{"atoms":[402,419]}},{"Lookahead":{"atom":399,"positive":false}},{"Entity":{"atom":434}},{"Str":{"pattern":" "}},{"Str":{"pattern":"\t"}},{"Alternative":{"atoms":[423,424]}},{"Entity":{"atom":420}},{"Lookahead":{"atom":426,"positive":false}},{"Entity":{"atom":77}},{"Sequence":{"atoms":[425,427,428]}},{"Entity":{"atom":420}},{"Lookahead":{"atom":430,"positive":false}},{"Entity":{"atom":77}},{"Sequence":{"atoms":[431,432]}},{"Alternative":{"atoms":[429,433]}},{"Sequence":{"atoms":[387,398,421,422]}},{"Repetition":{"atom":435,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[386,436]}},{"Named":{"name":"p","atom":437}},{"CustomRef":{"name":"continuation"}},{"Entity":{"atom":397}},{"Lookahead":{"atom":440,"positive":false}},{"Entity":{"atom":485}},{"Str":{"pattern":" "}},{"Str":{"pattern":"\t"}},{"Alternative":{"atoms":[443,444]}},{"Entity":{"atom":464}},{"Entity":{"atom":455}},{"Entity":{"atom":316}},{"Entity":{"atom":453}},{"Entity":{"atom":45}},{"Repetition":{"atom":450,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":16}},{"Sequence":{"atoms":[451,452]}},{"Named":{"name":"li","atom":449}},{"Sequence":{"atoms":[448,454]}},{"CustomRef":{"name":"continuation"}},{"Str":{"pattern":" "}},{"Str":{"pattern":"\t"}},{"Alternative":{"atoms":[457,458]}},{"Entity":{"atom":455}},{"Sequence":{"atoms":[456,459,460]}},{"Repetition":{"atom":461,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[447,462]}},{"Named":{"name":"ul","atom":463}},{"Sequence":{"atoms":[445,446]}},{"Str":{"pattern":" "}},{"Str":{"pattern":"\t"}},{"Alternative":{"atoms":[466,467]}},{"Entity":{"atom":483}},{"Entity":{"atom":474}},{"Entity":{"atom":327}},{"Entity":{"atom":453}},{"Named":{"name":"li","atom":472}},{"Sequence":{"atoms":[471,473]}},{"CustomRef":{"name":"continuation"}},{"Str":{"pattern":" "}},{"Str":{"pattern":"\t"}},{"Alternative":{"atoms":[476,477]}},{"Entity":{"atom":474}},{"Sequence":{"atoms":[475,478,479]}},{"Repetition":{"atom":480,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[470,481]}},{"Named":{"name":"ol","atom":482}},{"Sequence":{"atoms":[468,469]}},{"Alternative":{"atoms":[465,484]}},{"Sequence":{"atoms":[439,441,442]}},{"Repetition":{"atom":486,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[385,487]}},{"Named":{"name":"li","atom":384}},{"Alternative":{"atoms":[383,489]}},{"Sequence":{"atoms":[379,490]}},{"CustomRef":{"name":"continuation"}},{"Entity":{"atom":68}},{"Lookahead":{"atom":493,"positive":false}},{"CustomRef":{"name":"blank_line"}},{"Repetition":{"atom":495,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":491}},{"Sequence":{"atoms":[492,494,496,497]}},{"Repetition":{"atom":498,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[377,499]}},{"Named":{"name":"ul","atom":500}},{"Entity":{"atom":517}},{"Entity":{"atom":507}},{"Entity":{"atom":327}},{"Entity":{"atom":488}},{"Named":{"name":"li","atom":505}},{"Sequence":{"atoms":[504,506]}},{"CustomRef":{"name":"continuation"}},{"Entity":{"atom":68}},{"Lookahead":{"atom":509,"positive":false}},{"CustomRef":{"name":"blank_line"}},{"Repetition":{"atom":511,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":507}},{"Sequence":{"atoms":[508,510,512,513]}},{"Repetition":{"atom":514,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[503,515]}},{"Named":{"name":"ol","atom":516}},{"Entity":{"atom":567}},{"Entity":{"atom":559}},{"Entity":{"atom":536}},{"Entity":{"atom":526}},{"Entity":{"atom":21}},{"Str":{"pattern":":"}},{"Lookahead":{"atom":523,"positive":false}},{"Entity":{"atom":77}},{"Sequence":{"atoms":[522,524,525]}},{"CustomRef":{"name":"continuation"}},{"Entity":{"atom":333}},{"Lookahead":{"atom":528,"positive":false}},{"CustomRef":{"name":"blank_line"}},{"Lookahead":{"atom":530,"positive":false}},{"Entity":{"atom":526}},{"Sequence":{"atoms":[527,529,531,532]}},{"Repetition":{"atom":533,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[521,534]}},{"Named":{"name":"def_term","atom":535}},{"CustomRef":{"name":"continuation"}},{"Entity":{"atom":556}},{"Entity":{"atom":333}},{"Entity":{"atom":555}},{"Entity":{"atom":77}},{"CustomRef":{"name":"continuation"}},{"Entity":{"atom":333}},{"Lookahead":{"atom":543,"positive":false}},{"CustomRef":{"name":"blank_line"}},{"Lookahead":{"atom":545,"positive":false}},{"Str":{"pattern":" "}},{"Str":{"pattern":"\t"}},{"Alternative":{"atoms":[547,548]}},{"Repetition":{"atom":549,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":77}},{"Sequence":{"atoms":[542,544,546,550,551]}},{"Repetition":{"atom":552,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[541,553]}},{"Named":{"name":"def_content","atom":554}},{"Sequence":{"atoms":[539,540]}},{"Sequence":{"atoms":[537,538]}},{"Repetition":{"atom":557,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[520,558]}},{"CustomRef":{"name":"continuation"}},{"CustomRef":{"name":"blank_line"}},{"Repetition":{"atom":561,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":559}},{"Sequence":{"atoms":[560,562,563]}},{"Repetition":{"atom":564,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[519,565]}},{"Named":{"name":"dl","atom":566}},{"Entity":{"atom":594}},{"Entity":{"atom":21}},{"Entity":{"atom":579}},{"Str":{"pattern":"[^"}},{"Str":{"pattern":"]"}},{"Lookahead":{"atom":572,"positive":false}},{"Entity":{"atom":14}},{"Sequence":{"atoms":[573,574]}},{"Repetition":{"atom":575,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"fn_id","atom":576}},{"Str":{"pattern":"]"}},{"Sequence":{"atoms":[571,577,578]}},{"Str":{"pattern":":"}},{"Entity":{"atom":6}},{"Repetition":{"atom":581,"min":0,"max":null,"tag":"Repetition"}},{"Entity":{"atom":77}},{"Named":{"name":"fn_content","atom":583}},{"CustomRef":{"name":"continuation"}},{"Str":{"pattern":" "}},{"Str":{"pattern":"\t"}},{"Alternative":{"atoms":[586,587]}},{"Repetition":{"atom":588,"min":1,"max":4,"tag":"Repetition"}},{"Entity":{"atom":77}},{"Sequence":{"atoms":[585,589,590]}},{"Repetition":{"atom":591,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"fn_content_continued","atom":592}},{"Sequence":{"atoms":[569,570,580,582,584,593]}},{"Entity":{"atom":614}},{"Entity":{"atom":21}},{"Entity":{"atom":606}},{"Str":{"pattern":"*["}},{"Str":{"pattern":"]"}},{"Lookahead":{"atom":599,"positive":false}},{"Entity":{"atom":14}},{"Sequence":{"atoms":[600,601]}},{"Repetition":{"atom":602,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"abbr_term","atom":603}},{"Str":{"pattern":"]"}},{"Sequence":{"atoms":[598,604,605]}},{"Str":{"pattern":":"}},{"Entity":{"atom":6}},{"Repetition":{"atom":608,"min":0,"max":null,"tag":"Repetition"}},{"Entity":{"atom":45}},{"Repetition":{"atom":610,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"abbr_def","atom":611}},{"Entity":{"atom":16}},{"Sequence":{"atoms":[596,597,607,609,612,613]}},{"Entity":{"atom":243}},{"Entity":{"atom":307}},{"Entity":{"atom":627}},{"Str":{"pattern":"$$"}},{"CustomRef":{"name":"line_ending"}},{"Str":{"pattern":"$$"}},{"Lookahead":{"atom":620,"positive":false}},{"Entity":{"atom":14}},{"Sequence":{"atoms":[621,622]}},{"Repetition":{"atom":623,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"math_content","atom":624}},{"Str":{"pattern":"$$"}},{"Sequence":{"atoms":[618,619,625,626]}},{"Entity":{"atom":725}},{"Entity":{"atom":669}},{"Str":{"pattern":"|"}},{"Entity":{"atom":6}},{"Repetition":{"atom":631,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":639}},{"Str":{"pattern":"|"}},{"Lookahead":{"atom":634,"positive":false}},{"Entity":{"atom":45}},{"Sequence":{"atoms":[635,636]}},{"Repetition":{"atom":637,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"cell","atom":638}},{"Entity":{"atom":6}},{"Repetition":{"atom":640,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"|"}},{"Entity":{"atom":6}},{"Repetition":{"atom":643,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[633,641,642,644]}},{"Repetition":{"atom":645,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"row","atom":646}},{"Sequence":{"atoms":[630,632,647]}},{"Entity":{"atom":639}},{"Entity":{"atom":6}},{"Repetition":{"atom":650,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"|"}},{"Entity":{"atom":6}},{"Repetition":{"atom":653,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":639}},{"Entity":{"atom":6}},{"Repetition":{"atom":656,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"|"}},{"Entity":{"atom":6}},{"Repetition":{"atom":659,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[655,657,658,660]}},{"Repetition":{"atom":661,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"row_rest","atom":662}},{"Entity":{"atom":639}},{"Repetition":{"atom":664,"min":0,"max":1,"tag":"Maybe"}},{"Named":{"name":"last_cell","atom":665}},{"Sequence":{"atoms":[649,651,652,654,663,666]}},{"Named":{"name":"row","atom":667}},{"Alternative":{"atoms":[648,668]}},{"Named":{"name":"table_header","atom":629}},{"CustomRef":{"name":"line_ending"}},{"Entity":{"atom":713}},{"Str":{"pattern":"|"}},{"Entity":{"atom":6}},{"Repetition":{"atom":674,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":683}},{"Str":{"pattern":":"}},{"Repetition":{"atom":677,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"-"}},{"Repetition":{"atom":679,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":":"}},{"Repetition":{"atom":681,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[678,680,682]}},{"Named":{"name":"sep","atom":676}},{"Entity":{"atom":6}},{"Repetition":{"atom":685,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"|"}},{"Entity":{"atom":6}},{"Repetition":{"atom":688,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[684,686,687,689]}},{"Repetition":{"atom":690,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[673,675,691]}},{"Entity":{"atom":683}},{"Named":{"name":"sep","atom":693}},{"Entity":{"atom":6}},{"Repetition":{"atom":695,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"|"}},{"Entity":{"atom":6}},{"Repetition":{"atom":698,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":683}},{"Named":{"name":"sep","atom":700}},{"Entity":{"atom":6}},{"Repetition":{"atom":702,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"|"}},{"Entity":{"atom":6}},{"Repetition":{"atom":705,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[701,703,704,706]}},{"Repetition":{"atom":707,"min":0,"max":null,"tag":"Repetition"}},{"Entity":{"atom":683}},{"Named":{"name":"sep","atom":709}},{"Repetition":{"atom":710,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[694,696,697,699,708,711]}},{"Alternative":{"atoms":[692,712]}},{"Named":{"name":"table_separator","atom":672}},{"CustomRef":{"name":"line_ending"}},{"Entity":{"atom":669}},{"Named":{"name":"table_body_row","atom":716}},{"CustomRef":{"name":"line_ending"}},{"Entity":{"atom":14}},{"Lookahead":{"atom":719,"positive":false}},{"Alternative":{"atoms":[718,720]}},{"Sequence":{"atoms":[717,721]}},{"Repetition":{"atom":722,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"table_body","atom":723}},{"Sequence":{"atoms":[670,671,714,715,724]}},{"Entity":{"atom":729}},{"Entity":{"atom":21}},{"CustomRef":{"name":"p_scope"}},{"Sequence":{"atoms":[727,728]}},{"Alternative":{"atoms":[1,2,18,63,69,108,146,155,376,502,518,568,595,615,616,617,628,726]}},{"Repetition":{"atom":0,"min":0,"max":null,"tag":"Repetition"}}],"root":731},"bindings":[]}},"preprocess":{},"tables":{},"lint":{"order_warnings":["rule line_ending_raw: branches 2 and 3 are order-dependent (shared first bytes; ordered choice is decisive)","rule line_ending_or_eof: branches 1 and 2 are order-dependent (first set not statically known)","rule blank_line_raw: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)","rule blank_line_verbatim: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)","rule block_quote_item: branches 1 and 2 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 1 and 2 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 1 and 3 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_interrupt: branches 1 and 4 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 2 and 3 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 2 and 4 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 2 and 5 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 2 and 6 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 2 and 7 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 2 and 8 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 2 and 9 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 2 and 10 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 3 and 4 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 3 and 5 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_interrupt: branches 3 and 6 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_interrupt: branches 3 and 8 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_interrupt: branches 3 and 9 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_interrupt: branches 3 and 10 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_interrupt: branches 4 and 5 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 4 and 6 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 4 and 7 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 4 and 8 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 4 and 9 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 4 and 10 are order-dependent (first set not statically known)","rule paragraph_interrupt: branches 5 and 6 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_interrupt: branches 5 and 8 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_interrupt: branches 5 and 9 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_interrupt: branches 5 and 10 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_interrupt: branches 6 and 7 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_interrupt: branches 6 and 8 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_interrupt: branches 6 and 9 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_interrupt: branches 6 and 10 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_interrupt: branches 8 and 9 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_interrupt: branches 8 and 10 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_interrupt: branches 9 and 10 are order-dependent (shared first bytes; ordered choice is decisive)","rule paragraph_line: branches 1 and 2 are order-dependent (first set not statically known)","rule table_row: branches 1 and 2 are order-dependent (first set not statically known)","rule block: branches 1 and 3 are order-dependent (first set not statically known)","rule block: branches 1 and 4 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 1 and 6 are order-dependent (first set not statically known)","rule block: branches 1 and 8 are order-dependent (first set not statically known)","rule block: branches 1 and 9 are order-dependent (first set not statically known)","rule block: branches 1 and 11 are order-dependent (first set not statically known)","rule block: branches 1 and 17 are order-dependent (first set not statically known)","rule block: branches 1 and 18 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 2 and 3 are order-dependent (first set not statically known)","rule block: branches 2 and 4 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 2 and 5 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 2 and 6 are order-dependent (first set not statically known)","rule block: branches 2 and 7 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 2 and 8 are order-dependent (first set not statically known)","rule block: branches 2 and 9 are order-dependent (first set not statically known)","rule block: branches 2 and 10 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 2 and 11 are order-dependent (first set not statically known)","rule block: branches 2 and 12 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 2 and 13 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 2 and 14 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 2 and 17 are order-dependent (first set not statically known)","rule block: branches 2 and 18 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 3 and 4 are order-dependent (first set not statically known)","rule block: branches 3 and 5 are order-dependent (first set not statically known)","rule block: branches 3 and 6 are order-dependent (first set not statically known)","rule block: branches 3 and 7 are order-dependent (first set not statically known)","rule block: branches 3 and 8 are order-dependent (first set not statically known)","rule block: branches 3 and 9 are order-dependent (first set not statically known)","rule block: branches 3 and 10 are order-dependent (first set not statically known)","rule block: branches 3 and 11 are order-dependent (first set not statically known)","rule block: branches 3 and 12 are order-dependent (first set not statically known)","rule block: branches 3 and 13 are order-dependent (first set not statically known)","rule block: branches 3 and 14 are order-dependent (first set not statically known)","rule block: branches 3 and 15 are order-dependent (first set not statically known)","rule block: branches 3 and 16 are order-dependent (first set not statically known)","rule block: branches 3 and 17 are order-dependent (first set not statically known)","rule block: branches 3 and 18 are order-dependent (first set not statically known)","rule block: branches 4 and 5 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 4 and 6 are order-dependent (first set not statically known)","rule block: branches 4 and 7 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 4 and 8 are order-dependent (first set not statically known)","rule block: branches 4 and 9 are order-dependent (first set not statically known)","rule block: branches 4 and 10 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 4 and 11 are order-dependent (first set not statically known)","rule block: branches 4 and 12 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 4 and 13 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 4 and 14 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 4 and 17 are order-dependent (first set not statically known)","rule block: branches 4 and 18 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 5 and 6 are order-dependent (first set not statically known)","rule block: branches 5 and 7 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 5 and 8 are order-dependent (first set not statically known)","rule block: branches 5 and 9 are order-dependent (first set not statically known)","rule block: branches 5 and 10 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 5 and 11 are order-dependent (first set not statically known)","rule block: branches 5 and 12 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 5 and 13 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 5 and 14 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 5 and 17 are order-dependent (first set not statically known)","rule block: branches 5 and 18 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 6 and 7 are order-dependent (first set not statically known)","rule block: branches 6 and 8 are order-dependent (first set not statically known)","rule block: branches 6 and 9 are order-dependent (first set not statically known)","rule block: branches 6 and 10 are order-dependent (first set not statically known)","rule block: branches 6 and 11 are order-dependent (first set not statically known)","rule block: branches 6 and 12 are order-dependent (first set not statically known)","rule block: branches 6 and 13 are order-dependent (first set not statically known)","rule block: branches 6 and 14 are order-dependent (first set not statically known)","rule block: branches 6 and 15 are order-dependent (first set not statically known)","rule block: branches 6 and 16 are order-dependent (first set not statically known)","rule block: branches 6 and 17 are order-dependent (first set not statically known)","rule block: branches 6 and 18 are order-dependent (first set not statically known)","rule block: branches 7 and 8 are order-dependent (first set not statically known)","rule block: branches 7 and 9 are order-dependent (first set not statically known)","rule block: branches 7 and 10 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 7 and 11 are order-dependent (first set not statically known)","rule block: branches 7 and 12 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 7 and 13 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 7 and 14 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 7 and 17 are order-dependent (first set not statically known)","rule block: branches 7 and 18 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 8 and 9 are order-dependent (first set not statically known)","rule block: branches 8 and 10 are order-dependent (first set not statically known)","rule block: branches 8 and 11 are order-dependent (first set not statically known)","rule block: branches 8 and 12 are order-dependent (first set not statically known)","rule block: branches 8 and 13 are order-dependent (first set not statically known)","rule block: branches 8 and 14 are order-dependent (first set not statically known)","rule block: branches 8 and 15 are order-dependent (first set not statically known)","rule block: branches 8 and 16 are order-dependent (first set not statically known)","rule block: branches 8 and 17 are order-dependent (first set not statically known)","rule block: branches 8 and 18 are order-dependent (first set not statically known)","rule block: branches 9 and 10 are order-dependent (first set not statically known)","rule block: branches 9 and 11 are order-dependent (first set not statically known)","rule block: branches 9 and 12 are order-dependent (first set not statically known)","rule block: branches 9 and 13 are order-dependent (first set not statically known)","rule block: branches 9 and 14 are order-dependent (first set not statically known)","rule block: branches 9 and 15 are order-dependent (first set not statically known)","rule block: branches 9 and 16 are order-dependent (first set not statically known)","rule block: branches 9 and 17 are order-dependent (first set not statically known)","rule block: branches 9 and 18 are order-dependent (first set not statically known)","rule block: branches 10 and 11 are order-dependent (first set not statically known)","rule block: branches 10 and 12 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 10 and 13 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 10 and 14 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 10 and 17 are order-dependent (first set not statically known)","rule block: branches 10 and 18 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 11 and 12 are order-dependent (first set not statically known)","rule block: branches 11 and 13 are order-dependent (first set not statically known)","rule block: branches 11 and 14 are order-dependent (first set not statically known)","rule block: branches 11 and 15 are order-dependent (first set not statically known)","rule block: branches 11 and 16 are order-dependent (first set not statically known)","rule block: branches 11 and 17 are order-dependent (first set not statically known)","rule block: branches 11 and 18 are order-dependent (first set not statically known)","rule block: branches 12 and 13 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 12 and 14 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 12 and 17 are order-dependent (first set not statically known)","rule block: branches 12 and 18 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 13 and 14 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 13 and 17 are order-dependent (first set not statically known)","rule block: branches 13 and 18 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 14 and 15 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 14 and 17 are order-dependent (first set not statically known)","rule block: branches 14 and 18 are order-dependent (shared first bytes; ordered choice is decisive)","rule block: branches 15 and 17 are order-dependent (first set not statically known)","rule block: branches 16 and 17 are order-dependent (first set not statically known)","rule block: branches 17 and 18 are order-dependent (first set not statically known)","rule list_interrupt: branches 1 and 2 are order-dependent (first set not statically known)","rule list_interrupt: branches 1 and 3 are order-dependent (shared first bytes; ordered choice is decisive)","rule list_interrupt: branches 1 and 4 are order-dependent (first set not statically known)","rule list_interrupt: branches 2 and 3 are order-dependent (first set not statically known)","rule list_interrupt: branches 2 and 4 are order-dependent (first set not statically known)","rule list_interrupt: branches 2 and 5 are order-dependent (first set not statically known)","rule list_interrupt: branches 2 and 6 are order-dependent (first set not statically known)","rule list_interrupt: branches 2 and 7 are order-dependent (first set not statically known)","rule list_interrupt: branches 3 and 4 are order-dependent (first set not statically known)","rule list_interrupt: branches 3 and 5 are order-dependent (shared first bytes; ordered choice is decisive)","rule list_interrupt: branches 3 and 6 are order-dependent (shared first bytes; ordered choice is decisive)","rule list_interrupt: branches 3 and 7 are order-dependent (shared first bytes; ordered choice is decisive)","rule list_interrupt: branches 4 and 5 are order-dependent (first set not statically known)","rule list_interrupt: branches 4 and 6 are order-dependent (first set not statically known)","rule list_interrupt: branches 4 and 7 are order-dependent (first set not statically known)","rule list_interrupt: branches 5 and 6 are order-dependent (shared first bytes; ordered choice is decisive)","rule list_interrupt: branches 5 and 7 are order-dependent (shared first bytes; ordered choice is decisive)","rule list_interrupt: branches 6 and 7 are order-dependent (shared first bytes; ordered choice is decisive)","rule list_continuation_line: branches 1 and 2 are order-dependent (first set not statically known)","rule nested_block: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)"]},"default_entry":"document","render":{},"derive":{},"tests":[],"docs":{},"source":"# Ceradoc Markdown block grammar — PARG single source of truth (M2).\n#\n# Port of lib/ceradoc/markdown/parser/block_parser.rb (the Ruby DSL\n# grammar stays as the parity reference; grammar_parity_spec asserts\n# identical trees over the markdown corpus). Compile with\n# `rake grammar:compile`; `rake grammar:check` fails on a stale artifact.\n#\n# Context-sensitive machinery that PARG cannot express as data lives in\n# Ruby-tier custom atoms (parser/grammar_runtime.rb), the same escape\n# hatch the PARG state vocabulary provides:\n# continuation / bq_scope / p_scope block-nesting stack\n# (scope + continuation)\n# fence_info / fence_close / fence_indent_consume fence-aware rules\n# ign_* / const_* Parslet `.ignore` and\n# `.output(value)`\n# Everything else is plain PEG.\n\ngrammar CeradocMarkdown version \"0.1.0\" {\n\n any_char = %x00-10FFFF\n\n # ---- terminals ----\n line_ending_raw = (\"\\n\" / \"\\r\\n\" / \"\\r\")\n custom line_ending = \"Ceradoc::Markdown::Parser::Ign::LineEnding\"\n line_ending_or_eof = (line_ending / !any_char)\n whitespace = (\" \" / %x09)\n blank_line_raw = ((1*whitespace !any_char) / (*whitespace line_ending_raw))\n custom blank_line = \"Ceradoc::Markdown::Parser::Ign::BlankLine\"\n blank_line_verbatim = (((1*whitespace) as ln !any_char) / ((*whitespace) as ln line_ending))\n line_char = (!(\"\\r\" / \"\\n\") any_char)\n line_verbatim = ((1*line_char) as ln line_ending_or_eof)\n non_indent_space = *3\" \"\n whitespace_repeat = *whitespace\n any_char_present = &any_char\n space_char = (%x20 / %x09-0D)\n word_char = (%x41-5A / %x61-7A / %x30-39 / \"_\")\n word_dash_char = (word_char / \"-\")\n\n custom ign_ws_rep = \"Ceradoc::Markdown::Parser::Ign::WhitespaceRepeat\"\n custom ign_thematic_chars = \"Ceradoc::Markdown::Parser::Ign::ThematicChars\"\n custom ign_thematic_in_list = \"Ceradoc::Markdown::Parser::Ign::ThematicInList\"\n custom ign_blank_line_verbatim = \"Ceradoc::Markdown::Parser::Ign::BlankLineVerbatim\"\n custom const_hr = \"Ceradoc::Markdown::Parser::Const::Hr\"\n custom const_ln_empty = \"Ceradoc::Markdown::Parser::Const::LnEmpty\"\n custom const_empty = \"Ceradoc::Markdown::Parser::Const::Empty\"\n\n # ---- block nesting (scope + continuation) ----\n custom continuation = \"Ceradoc::Markdown::Parser::Nesting::Continuation\"\n custom bq_scope = \"Ceradoc::Markdown::Parser::Nesting::BlockQuoteScope\"\n custom p_scope = \"Ceradoc::Markdown::Parser::Nesting::ParagraphScope\"\n\n # ---- ATX heading / thematic break ----\n atx_ending_seq = (1*whitespace *\"#\" *whitespace !line_char)\n escaped_hash = (\"\\\\\" \"#\")\n atx_heading = (non_indent_space !escaped_hash ((1*6\"#\") as heading) !\"#\" [(!atx_ending_seq 1*\" \" ((1*(!atx_ending_seq line_char)) as text))] [atx_ending_seq] line_ending_or_eof)\n thematic_break_chars = (3*(\"-\" *whitespace) / 3*(\"_\" *whitespace) / 3*(\"*\" *whitespace))\n thematic_break = (non_indent_space ign_thematic_chars const_hr line_ending_or_eof)\n\n # ---- code blocks ----\n indented_code_line = (\" \" line_verbatim)\n indented_code_blank_line = (ign_blank_line_verbatim const_ln_empty &(continuation (\" \" / blank_line_verbatim)))\n indented_code_block = ((indented_code_line *(continuation (indented_code_line / indented_code_blank_line))) as code_block)\n\n state fence: string\n state fence_indent: string\n fence_info_backtick = [((1*(!\"`\" line_char)) as info)]\n fence_info_tilde = [((1*line_char) as info)]\n custom fence_info = \"Ceradoc::Markdown::Parser::Nesting::FenceInfo\"\n custom fence_close_marker = \"Ceradoc::Markdown::Parser::Nesting::FenceClose\"\n custom consume_fenced_indent = \"Ceradoc::Markdown::Parser::Nesting::ConsumeFencedIndent\"\n code_fence_open = ((set fence_indent = (non_indent_space)) (set fence = ((3*\"`\") / (3*\"~\"))) fence_info line_ending_or_eof)\n code_fence_close = (non_indent_space fence_close_marker line_ending_or_eof)\n fenced_code_block = (code_fence_open ((*(continuation !code_fence_close consume_fenced_indent (line_verbatim / (ign_blank_line_verbatim const_ln_empty)))) as code_block) ((continuation code_fence_close) / !(continuation any_char)))\n\n # ---- block quote / paragraph / setext ----\n block_quote_marker = (non_indent_space \">\" [\" \"])\n block_quote_item = (block / (!any_char const_empty))\n block_quote_body = (((block_quote_item *(continuation block_quote_item))) as block_quote)\n block_quote = (block_quote_marker bq_scope)\n\n ial_block = (*3whitespace (ial / ald) line_ending_or_eof)\n paragraph_interrupt = (blank_line / atx_heading / thematic_break / code_fence_open / block_quote / ial_block / extension / unordered_list_marker / ordered_list_marker / definition_marker)\n paragraph_line = (((1*line_char) as ln !any_char) / ((*line_char) as ln line_ending))\n paragraph_continued_line = (ign_ws_rep paragraph_line)\n paragraph_cont = !paragraph_interrupt\n lazy_continuation = (!paragraph_interrupt ¶graph_continued_line)\n paragraph_body = ((paragraph_line *(continuation paragraph_continued_line)) as p)\n paragraph = (non_indent_space p_scope)\n\n setext_underline = (non_indent_space (((1*\"-\") / (1*\"=\")) as heading) ign_ws_rep line_ending_or_eof)\n setext_check = (!paragraph_interrupt !setext_underline)\n setext_heading = (setext_check non_indent_space ((paragraph_line *(continuation setext_check paragraph_continued_line)) as text) continuation setext_underline)\n\n # ---- kramdown attribute lists ----\n ial_class = (\".\" 1*word_dash_char)\n ial_id = (\"#\" 1*word_dash_char)\n ial_key_value = (1*word_dash_char \"=\" ((\"\\\"\" *(!\"\\\"\" any_char) \"\\\"\") / (\"'\" *(!\"'\" any_char) \"'\") / 1*(!(space_char / \"}\") any_char)))\n ial_content = 1*(*whitespace (ial_class / ial_id / ial_key_value))\n ial = (\"{:\" (ial_content as ial) \"}\")\n ald_name = (1*word_char \":\")\n ald = (\"{:\" (ald_name as ald_name) 1*whitespace (ial_content as ial) \"}\")\n\n # ---- kramdown extensions / math ----\n extension_name = 1*%x61-7A\n extension_option = (1*word_dash_char \"=\" ((\"\\\"\" *(!\"\\\"\" any_char) \"\\\"\") / (\"'\" *(!\"'\" any_char) \"'\") / 1*(!(space_char / \"/\" / \"}\") any_char)))\n extension_options = *(1*whitespace extension_option)\n extension_self_closing = (\"{::\" (extension_name as ext_name) (extension_options as ext_options) *whitespace \"/}\")\n extension_with_body = (\"{::\" (extension_name as ext_name) (extension_options as ext_options) \"}\" ((*(!\"{:/\" any_char)) as ext_body) \"{:/}\")\n extension = ((extension_self_closing / extension_with_body) as extension)\n block_math = (\"$$\" line_ending ((*(!\"$$\" any_char)) as math_content) \"$$\")\n\n # ---- GFM tables ----\n table_cell = ((*(!\"|\" line_char)) as cell)\n table_row = ((\"|\" [whitespace] ((1*(table_cell [whitespace] \"|\" [whitespace])) as row)) / ((table_cell [whitespace] \"|\" [whitespace] ((*(table_cell [whitespace] \"|\" [whitespace])) as row_rest) ([table_cell] as last_cell)) as row))\n table_separator_cell = ([\":\"] 1*\"-\" [\":\"])\n table_separator_row = ((\"|\" [whitespace] 1*((table_separator_cell as sep) [whitespace] \"|\" [whitespace])) / ((table_separator_cell as sep) [whitespace] \"|\" [whitespace] *((table_separator_cell as sep) [whitespace] \"|\" [whitespace]) [(table_separator_cell as sep)]))\n table = ((table_row as table_header) line_ending (table_separator_row as table_separator) line_ending ((1*((table_row as table_body_row) (line_ending / !any_char))) as table_body))\n\n block = (blank_line / eob_marker / atx_heading / thematic_break / indented_code_block / fenced_code_block / block_quote / setext_heading / unordered_list / ordered_list / definition_list / footnote_definition / abbreviation_definition / ial_block / extension / block_math / table / paragraph)\n\n # ---- lists ----\n list_interrupt = (1*blank_line / atx_heading / thematic_break / code_fence_open / block_quote / unordered_list_marker / ordered_list_marker)\n unordered_list_marker = (non_indent_space (\"-\" / \"*\" / \"+\") 1*\" \")\n ordered_list_marker = (non_indent_space %x31-39 *%x30-39 (\".\" / \")\") 1*\" \")\n nested_list_marker = ((\" \" / \"\\t\") (((\"-\" / \"*\" / \"+\") 1*\" \") / (%x31-39 *%x30-39 (\".\" / \")\") 1*\" \")))\n list_continuation_line = (((\" \" / \"\\t\") !nested_list_marker line_verbatim) / (!nested_list_marker line_verbatim))\n thematic_break_in_list = (((\"*\" *whitespace \"*\" *whitespace \"*\") / (\"-\" *whitespace \"-\" *whitespace \"-\") / (\"_\" *whitespace \"_\" *whitespace \"_\")) *whitespace line_ending_or_eof)\n unordered_list_item = ((set list_marker = (unordered_list_marker)) ((ign_thematic_in_list const_hr) as li / (list_item_content as li)))\n list_item_content = (list_item_paragraph *(continuation !list_interrupt nested_block))\n nested_block = (((\" \" / \"\\t\") nested_unordered_list) / ((\" \" / \"\\t\") nested_ordered_list))\n nested_unordered_list = ((nested_unordered_list_item *(continuation (\" \" / \"\\t\") nested_unordered_list_item)) as ul)\n nested_ordered_list = ((nested_ordered_list_item *(continuation (\" \" / \"\\t\") nested_ordered_list_item)) as ol)\n line_text = (1*line_char line_ending_or_eof)\n nested_unordered_list_item = (unordered_list_marker (line_text as li))\n nested_ordered_list_item = (ordered_list_marker (line_text as li))\n list_item_paragraph = ((line_verbatim *(continuation !list_interrupt !nested_list_marker list_continuation_line)) as p)\n ordered_list_item = (ordered_list_marker (list_item_content as li))\n unordered_list = ((unordered_list_item *(continuation !thematic_break [blank_line] unordered_list_item)) as ul)\n ordered_list = ((ordered_list_item *(continuation !thematic_break [blank_line] ordered_list_item)) as ol)\n\n # ---- kramdown definition lists ----\n definition_marker = (non_indent_space \":\" 1*\" \")\n definition_term_line = (non_indent_space !\":\" line_verbatim)\n definition_term = ((definition_term_line *(continuation !definition_marker !blank_line definition_term_line)) as def_term)\n definition_content = ((line_verbatim *(continuation !definition_marker !blank_line [(\" \" / \"\\t\")] line_verbatim)) as def_content)\n definition_item = (definition_marker definition_content)\n definition_list_item = (definition_term 1*(continuation definition_item))\n definition_list = ((definition_list_item *(continuation [blank_line] definition_list_item)) as dl)\n\n # ---- kramdown footnotes / abbreviations / EOB ----\n footnote_id = (\"[^\" ((1*(!\"]\" any_char)) as fn_id) \"]\")\n footnote_definition = (non_indent_space footnote_id \":\" *whitespace (line_verbatim as fn_content) ((*(continuation 1*4(\" \" / \"\\t\") line_verbatim)) as fn_content_continued))\n abbreviation_term = (\"*[\" ((1*(!\"]\" any_char)) as abbr_term) \"]\")\n abbreviation_definition = (non_indent_space abbreviation_term \":\" *whitespace ((*line_char) as abbr_def) line_ending_or_eof)\n eob_marker = (*whitespace \"^\" *whitespace line_ending_or_eof)\n\n document = *block\n entry document: document\n}\n","source_hash":"3a50863046d213352c586d81adfe545190a6ae22f2b75e3b0361f8c6e0333204","unicode_tables":"onigmo (Ruby 4.0.7)","compiler_version":"1.3.151","edition":2,"customs":{"line_ending":"Ceradoc::Markdown::Parser::Ign::LineEnding","blank_line":"Ceradoc::Markdown::Parser::Ign::BlankLine","ign_ws_rep":"Ceradoc::Markdown::Parser::Ign::WhitespaceRepeat","ign_thematic_chars":"Ceradoc::Markdown::Parser::Ign::ThematicChars","ign_thematic_in_list":"Ceradoc::Markdown::Parser::Ign::ThematicInList","ign_blank_line_verbatim":"Ceradoc::Markdown::Parser::Ign::BlankLineVerbatim","const_hr":"Ceradoc::Markdown::Parser::Const::Hr","const_ln_empty":"Ceradoc::Markdown::Parser::Const::LnEmpty","const_empty":"Ceradoc::Markdown::Parser::Const::Empty","continuation":"Ceradoc::Markdown::Parser::Nesting::Continuation","bq_scope":"Ceradoc::Markdown::Parser::Nesting::BlockQuoteScope","p_scope":"Ceradoc::Markdown::Parser::Nesting::ParagraphScope","fence_info":"Ceradoc::Markdown::Parser::Nesting::FenceInfo","fence_close_marker":"Ceradoc::Markdown::Parser::Nesting::FenceClose","consume_fenced_indent":"Ceradoc::Markdown::Parser::Nesting::ConsumeFencedIndent"},"states":{"fence":"string","fence_indent":"string"},"dynamic":true,"semantics_hash":"sha256:a4a9b69c283a0462d6e7c641be60fc5428a57620d9f3334c94dc134b3b99888c","checksum":"sha256:389854bb8786ccca80c2e009cdbea6ecfd073f860f5a06e40c1a359720cabe43","validated":{"lint_errors":0,"lint_warnings":187,"tests_total":0,"tests_failures":0,"self_test":true},"model_bindings":{"version":1,"rules":{"thematic_break":{"keys":["hr"],"model":"HorizontalRule","captures":{},"children":{},"defaults":{"style":"---"}}}},"byte_checksum":"sha256:3d701ebf2d57865557faa1dd3052a8c155c22afe0cb61105e0e1ac13905d4fe3"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Rule -> model bindings for the Markdown block grammar (ceradoc#307 M4).
|
|
2
|
+
# `rake grammar:compile` embeds this table in the artifact under
|
|
3
|
+
# `model_bindings`; Ceradoc::BindingInflater reads it from there.
|
|
4
|
+
# Thematic break: `{hr: true}` -> HorizontalRule(style: '---').
|
|
5
|
+
version: 1
|
|
6
|
+
rules:
|
|
7
|
+
thematic_break:
|
|
8
|
+
keys: [hr]
|
|
9
|
+
model: HorizontalRule
|
|
10
|
+
captures: {}
|
|
11
|
+
children: {}
|
|
12
|
+
defaults:
|
|
13
|
+
style: '---'
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Ceradoc Markdown block grammar — PARG single source of truth (M2).
|
|
2
|
+
#
|
|
3
|
+
# Port of lib/ceradoc/markdown/parser/block_parser.rb (the Ruby DSL
|
|
4
|
+
# grammar stays as the parity reference; grammar_parity_spec asserts
|
|
5
|
+
# identical trees over the markdown corpus). Compile with
|
|
6
|
+
# `rake grammar:compile`; `rake grammar:check` fails on a stale artifact.
|
|
7
|
+
#
|
|
8
|
+
# Context-sensitive machinery that PARG cannot express as data lives in
|
|
9
|
+
# Ruby-tier custom atoms (parser/grammar_runtime.rb), the same escape
|
|
10
|
+
# hatch the PARG state vocabulary provides:
|
|
11
|
+
# continuation / bq_scope / p_scope block-nesting stack
|
|
12
|
+
# (scope + continuation)
|
|
13
|
+
# fence_info / fence_close / fence_indent_consume fence-aware rules
|
|
14
|
+
# ign_* / const_* Parslet `.ignore` and
|
|
15
|
+
# `.output(value)`
|
|
16
|
+
# Everything else is plain PEG.
|
|
17
|
+
|
|
18
|
+
grammar CeradocMarkdown version "0.1.0" {
|
|
19
|
+
|
|
20
|
+
any_char = %x00-10FFFF
|
|
21
|
+
|
|
22
|
+
# ---- terminals ----
|
|
23
|
+
line_ending_raw = ("\n" / "\r\n" / "\r")
|
|
24
|
+
custom line_ending = "Ceradoc::Markdown::Parser::Ign::LineEnding"
|
|
25
|
+
line_ending_or_eof = (line_ending / !any_char)
|
|
26
|
+
whitespace = (" " / %x09)
|
|
27
|
+
blank_line_raw = ((1*whitespace !any_char) / (*whitespace line_ending_raw))
|
|
28
|
+
custom blank_line = "Ceradoc::Markdown::Parser::Ign::BlankLine"
|
|
29
|
+
blank_line_verbatim = (((1*whitespace) as ln !any_char) / ((*whitespace) as ln line_ending))
|
|
30
|
+
line_char = (!("\r" / "\n") any_char)
|
|
31
|
+
line_verbatim = ((1*line_char) as ln line_ending_or_eof)
|
|
32
|
+
non_indent_space = *3" "
|
|
33
|
+
whitespace_repeat = *whitespace
|
|
34
|
+
any_char_present = &any_char
|
|
35
|
+
space_char = (%x20 / %x09-0D)
|
|
36
|
+
word_char = (%x41-5A / %x61-7A / %x30-39 / "_")
|
|
37
|
+
word_dash_char = (word_char / "-")
|
|
38
|
+
|
|
39
|
+
custom ign_ws_rep = "Ceradoc::Markdown::Parser::Ign::WhitespaceRepeat"
|
|
40
|
+
custom ign_thematic_chars = "Ceradoc::Markdown::Parser::Ign::ThematicChars"
|
|
41
|
+
custom ign_thematic_in_list = "Ceradoc::Markdown::Parser::Ign::ThematicInList"
|
|
42
|
+
custom ign_blank_line_verbatim = "Ceradoc::Markdown::Parser::Ign::BlankLineVerbatim"
|
|
43
|
+
custom const_hr = "Ceradoc::Markdown::Parser::Const::Hr"
|
|
44
|
+
custom const_ln_empty = "Ceradoc::Markdown::Parser::Const::LnEmpty"
|
|
45
|
+
custom const_empty = "Ceradoc::Markdown::Parser::Const::Empty"
|
|
46
|
+
|
|
47
|
+
# ---- block nesting (scope + continuation) ----
|
|
48
|
+
custom continuation = "Ceradoc::Markdown::Parser::Nesting::Continuation"
|
|
49
|
+
custom bq_scope = "Ceradoc::Markdown::Parser::Nesting::BlockQuoteScope"
|
|
50
|
+
custom p_scope = "Ceradoc::Markdown::Parser::Nesting::ParagraphScope"
|
|
51
|
+
|
|
52
|
+
# ---- ATX heading / thematic break ----
|
|
53
|
+
atx_ending_seq = (1*whitespace *"#" *whitespace !line_char)
|
|
54
|
+
escaped_hash = ("\\" "#")
|
|
55
|
+
atx_heading = (non_indent_space !escaped_hash ((1*6"#") as heading) !"#" [(!atx_ending_seq 1*" " ((1*(!atx_ending_seq line_char)) as text))] [atx_ending_seq] line_ending_or_eof)
|
|
56
|
+
thematic_break_chars = (3*("-" *whitespace) / 3*("_" *whitespace) / 3*("*" *whitespace))
|
|
57
|
+
thematic_break = (non_indent_space ign_thematic_chars const_hr line_ending_or_eof)
|
|
58
|
+
|
|
59
|
+
# ---- code blocks ----
|
|
60
|
+
indented_code_line = (" " line_verbatim)
|
|
61
|
+
indented_code_blank_line = (ign_blank_line_verbatim const_ln_empty &(continuation (" " / blank_line_verbatim)))
|
|
62
|
+
indented_code_block = ((indented_code_line *(continuation (indented_code_line / indented_code_blank_line))) as code_block)
|
|
63
|
+
|
|
64
|
+
state fence: string
|
|
65
|
+
state fence_indent: string
|
|
66
|
+
fence_info_backtick = [((1*(!"`" line_char)) as info)]
|
|
67
|
+
fence_info_tilde = [((1*line_char) as info)]
|
|
68
|
+
custom fence_info = "Ceradoc::Markdown::Parser::Nesting::FenceInfo"
|
|
69
|
+
custom fence_close_marker = "Ceradoc::Markdown::Parser::Nesting::FenceClose"
|
|
70
|
+
custom consume_fenced_indent = "Ceradoc::Markdown::Parser::Nesting::ConsumeFencedIndent"
|
|
71
|
+
code_fence_open = ((set fence_indent = (non_indent_space)) (set fence = ((3*"`") / (3*"~"))) fence_info line_ending_or_eof)
|
|
72
|
+
code_fence_close = (non_indent_space fence_close_marker line_ending_or_eof)
|
|
73
|
+
fenced_code_block = (code_fence_open ((*(continuation !code_fence_close consume_fenced_indent (line_verbatim / (ign_blank_line_verbatim const_ln_empty)))) as code_block) ((continuation code_fence_close) / !(continuation any_char)))
|
|
74
|
+
|
|
75
|
+
# ---- block quote / paragraph / setext ----
|
|
76
|
+
block_quote_marker = (non_indent_space ">" [" "])
|
|
77
|
+
block_quote_item = (block / (!any_char const_empty))
|
|
78
|
+
block_quote_body = (((block_quote_item *(continuation block_quote_item))) as block_quote)
|
|
79
|
+
block_quote = (block_quote_marker bq_scope)
|
|
80
|
+
|
|
81
|
+
ial_block = (*3whitespace (ial / ald) line_ending_or_eof)
|
|
82
|
+
paragraph_interrupt = (blank_line / atx_heading / thematic_break / code_fence_open / block_quote / ial_block / extension / unordered_list_marker / ordered_list_marker / definition_marker)
|
|
83
|
+
paragraph_line = (((1*line_char) as ln !any_char) / ((*line_char) as ln line_ending))
|
|
84
|
+
paragraph_continued_line = (ign_ws_rep paragraph_line)
|
|
85
|
+
paragraph_cont = !paragraph_interrupt
|
|
86
|
+
lazy_continuation = (!paragraph_interrupt ¶graph_continued_line)
|
|
87
|
+
paragraph_body = ((paragraph_line *(continuation paragraph_continued_line)) as p)
|
|
88
|
+
paragraph = (non_indent_space p_scope)
|
|
89
|
+
|
|
90
|
+
setext_underline = (non_indent_space (((1*"-") / (1*"=")) as heading) ign_ws_rep line_ending_or_eof)
|
|
91
|
+
setext_check = (!paragraph_interrupt !setext_underline)
|
|
92
|
+
setext_heading = (setext_check non_indent_space ((paragraph_line *(continuation setext_check paragraph_continued_line)) as text) continuation setext_underline)
|
|
93
|
+
|
|
94
|
+
# ---- kramdown attribute lists ----
|
|
95
|
+
ial_class = ("." 1*word_dash_char)
|
|
96
|
+
ial_id = ("#" 1*word_dash_char)
|
|
97
|
+
ial_key_value = (1*word_dash_char "=" (("\"" *(!"\"" any_char) "\"") / ("'" *(!"'" any_char) "'") / 1*(!(space_char / "}") any_char)))
|
|
98
|
+
ial_content = 1*(*whitespace (ial_class / ial_id / ial_key_value))
|
|
99
|
+
ial = ("{:" (ial_content as ial) "}")
|
|
100
|
+
ald_name = (1*word_char ":")
|
|
101
|
+
ald = ("{:" (ald_name as ald_name) 1*whitespace (ial_content as ial) "}")
|
|
102
|
+
|
|
103
|
+
# ---- kramdown extensions / math ----
|
|
104
|
+
extension_name = 1*%x61-7A
|
|
105
|
+
extension_option = (1*word_dash_char "=" (("\"" *(!"\"" any_char) "\"") / ("'" *(!"'" any_char) "'") / 1*(!(space_char / "/" / "}") any_char)))
|
|
106
|
+
extension_options = *(1*whitespace extension_option)
|
|
107
|
+
extension_self_closing = ("{::" (extension_name as ext_name) (extension_options as ext_options) *whitespace "/}")
|
|
108
|
+
extension_with_body = ("{::" (extension_name as ext_name) (extension_options as ext_options) "}" ((*(!"{:/" any_char)) as ext_body) "{:/}")
|
|
109
|
+
extension = ((extension_self_closing / extension_with_body) as extension)
|
|
110
|
+
block_math = ("$$" line_ending ((*(!"$$" any_char)) as math_content) "$$")
|
|
111
|
+
|
|
112
|
+
# ---- GFM tables ----
|
|
113
|
+
table_cell = ((*(!"|" line_char)) as cell)
|
|
114
|
+
table_row = (("|" [whitespace] ((1*(table_cell [whitespace] "|" [whitespace])) as row)) / ((table_cell [whitespace] "|" [whitespace] ((*(table_cell [whitespace] "|" [whitespace])) as row_rest) ([table_cell] as last_cell)) as row))
|
|
115
|
+
table_separator_cell = ([":"] 1*"-" [":"])
|
|
116
|
+
table_separator_row = (("|" [whitespace] 1*((table_separator_cell as sep) [whitespace] "|" [whitespace])) / ((table_separator_cell as sep) [whitespace] "|" [whitespace] *((table_separator_cell as sep) [whitespace] "|" [whitespace]) [(table_separator_cell as sep)]))
|
|
117
|
+
table = ((table_row as table_header) line_ending (table_separator_row as table_separator) line_ending ((1*((table_row as table_body_row) (line_ending / !any_char))) as table_body))
|
|
118
|
+
|
|
119
|
+
block = (blank_line / eob_marker / atx_heading / thematic_break / indented_code_block / fenced_code_block / block_quote / setext_heading / unordered_list / ordered_list / definition_list / footnote_definition / abbreviation_definition / ial_block / extension / block_math / table / paragraph)
|
|
120
|
+
|
|
121
|
+
# ---- lists ----
|
|
122
|
+
list_interrupt = (1*blank_line / atx_heading / thematic_break / code_fence_open / block_quote / unordered_list_marker / ordered_list_marker)
|
|
123
|
+
unordered_list_marker = (non_indent_space ("-" / "*" / "+") 1*" ")
|
|
124
|
+
ordered_list_marker = (non_indent_space %x31-39 *%x30-39 ("." / ")") 1*" ")
|
|
125
|
+
nested_list_marker = ((" " / "\t") ((("-" / "*" / "+") 1*" ") / (%x31-39 *%x30-39 ("." / ")") 1*" ")))
|
|
126
|
+
list_continuation_line = (((" " / "\t") !nested_list_marker line_verbatim) / (!nested_list_marker line_verbatim))
|
|
127
|
+
thematic_break_in_list = ((("*" *whitespace "*" *whitespace "*") / ("-" *whitespace "-" *whitespace "-") / ("_" *whitespace "_" *whitespace "_")) *whitespace line_ending_or_eof)
|
|
128
|
+
unordered_list_item = ((set list_marker = (unordered_list_marker)) ((ign_thematic_in_list const_hr) as li / (list_item_content as li)))
|
|
129
|
+
list_item_content = (list_item_paragraph *(continuation !list_interrupt nested_block))
|
|
130
|
+
nested_block = (((" " / "\t") nested_unordered_list) / ((" " / "\t") nested_ordered_list))
|
|
131
|
+
nested_unordered_list = ((nested_unordered_list_item *(continuation (" " / "\t") nested_unordered_list_item)) as ul)
|
|
132
|
+
nested_ordered_list = ((nested_ordered_list_item *(continuation (" " / "\t") nested_ordered_list_item)) as ol)
|
|
133
|
+
line_text = (1*line_char line_ending_or_eof)
|
|
134
|
+
nested_unordered_list_item = (unordered_list_marker (line_text as li))
|
|
135
|
+
nested_ordered_list_item = (ordered_list_marker (line_text as li))
|
|
136
|
+
list_item_paragraph = ((line_verbatim *(continuation !list_interrupt !nested_list_marker list_continuation_line)) as p)
|
|
137
|
+
ordered_list_item = (ordered_list_marker (list_item_content as li))
|
|
138
|
+
unordered_list = ((unordered_list_item *(continuation !thematic_break [blank_line] unordered_list_item)) as ul)
|
|
139
|
+
ordered_list = ((ordered_list_item *(continuation !thematic_break [blank_line] ordered_list_item)) as ol)
|
|
140
|
+
|
|
141
|
+
# ---- kramdown definition lists ----
|
|
142
|
+
definition_marker = (non_indent_space ":" 1*" ")
|
|
143
|
+
definition_term_line = (non_indent_space !":" line_verbatim)
|
|
144
|
+
definition_term = ((definition_term_line *(continuation !definition_marker !blank_line definition_term_line)) as def_term)
|
|
145
|
+
definition_content = ((line_verbatim *(continuation !definition_marker !blank_line [(" " / "\t")] line_verbatim)) as def_content)
|
|
146
|
+
definition_item = (definition_marker definition_content)
|
|
147
|
+
definition_list_item = (definition_term 1*(continuation definition_item))
|
|
148
|
+
definition_list = ((definition_list_item *(continuation [blank_line] definition_list_item)) as dl)
|
|
149
|
+
|
|
150
|
+
# ---- kramdown footnotes / abbreviations / EOB ----
|
|
151
|
+
footnote_id = ("[^" ((1*(!"]" any_char)) as fn_id) "]")
|
|
152
|
+
footnote_definition = (non_indent_space footnote_id ":" *whitespace (line_verbatim as fn_content) ((*(continuation 1*4(" " / "\t") line_verbatim)) as fn_content_continued))
|
|
153
|
+
abbreviation_term = ("*[" ((1*(!"]" any_char)) as abbr_term) "]")
|
|
154
|
+
abbreviation_definition = (non_indent_space abbreviation_term ":" *whitespace ((*line_char) as abbr_def) line_ending_or_eof)
|
|
155
|
+
eob_marker = (*whitespace "^" *whitespace line_ending_or_eof)
|
|
156
|
+
|
|
157
|
+
document = *block
|
|
158
|
+
entry document: document
|
|
159
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ceradoc
|
|
4
|
+
module Markdown
|
|
5
|
+
module Behaviors
|
|
6
|
+
# Hand-written behavior for Admonition. Prepended (not included) so
|
|
7
|
+
# that the setter can call `super` into the attribute setter that
|
|
8
|
+
# lutaml-model defines on the class itself.
|
|
9
|
+
module Admonition
|
|
10
|
+
ALLOWED_TYPES = %w[note tip warning important caution].freeze
|
|
11
|
+
|
|
12
|
+
# Normalize type on assignment. Callers can pass "NOTE", "Note",
|
|
13
|
+
# or "note" — storage is always lowercase so downstream comparison
|
|
14
|
+
# and CSS class generation don't need to repeat the normalization.
|
|
15
|
+
def admonition_type=(value)
|
|
16
|
+
super(value.to_s.downcase)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ceradoc
|
|
4
|
+
module Markdown
|
|
5
|
+
module Behaviors
|
|
6
|
+
# Hand-written behavior for AttributeList (IAL/ALD parsing, merging).
|
|
7
|
+
module AttributeList
|
|
8
|
+
def self.prepended(base)
|
|
9
|
+
base.extend(ClassMethods)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Parsing entry points.
|
|
13
|
+
module ClassMethods
|
|
14
|
+
# Parse an IAL string into an AttributeList
|
|
15
|
+
# @param str [String] The IAL string (e.g., '{:.class #id key="val"}')
|
|
16
|
+
# @return [AttributeList] Parsed attribute list
|
|
17
|
+
def parse(str)
|
|
18
|
+
return nil if str.nil? || str.empty?
|
|
19
|
+
|
|
20
|
+
# Remove surrounding braces
|
|
21
|
+
content = str.strip.gsub(/\A\{?:?|\}?\z/, '')
|
|
22
|
+
|
|
23
|
+
attr_list = new
|
|
24
|
+
|
|
25
|
+
# Check for ALD (has a name before colon)
|
|
26
|
+
if content =~ /\A(\w+):\s*/
|
|
27
|
+
attr_list.name = ::Regexp.last_match(1)
|
|
28
|
+
content = ::Regexp.last_match.post_match
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Parse the content
|
|
32
|
+
parse_attributes(content, attr_list)
|
|
33
|
+
|
|
34
|
+
attr_list
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def parse_attributes(content, attr_list)
|
|
38
|
+
# Use shared IalParser for consistent parsing
|
|
39
|
+
ParserUtil::IalParser.tokenize(content).each do |token|
|
|
40
|
+
case token[:type]
|
|
41
|
+
when :class
|
|
42
|
+
attr_list.classes << token[:value]
|
|
43
|
+
when :id
|
|
44
|
+
attr_list.id = token[:value]
|
|
45
|
+
when :attribute
|
|
46
|
+
attr_list.attributes << NamedValue.new(name: token[:key], value: token[:value])
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Merge another AttributeList into this one
|
|
53
|
+
# @param other [AttributeList] The other attribute list to merge
|
|
54
|
+
# @return [AttributeList] self for chaining
|
|
55
|
+
def merge!(other)
|
|
56
|
+
return self unless other
|
|
57
|
+
|
|
58
|
+
self.id = other.id if other.id
|
|
59
|
+
self.classes = (classes + other.classes).uniq
|
|
60
|
+
merged = {}
|
|
61
|
+
(attributes + other.attributes).each { |nv| merged[nv.name] = nv }
|
|
62
|
+
self.attributes = merged.values
|
|
63
|
+
self
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Create a merged copy
|
|
67
|
+
# @param other [AttributeList] The other attribute list to merge
|
|
68
|
+
# @return [AttributeList] New merged attribute list
|
|
69
|
+
def merge(other)
|
|
70
|
+
dup.merge!(other)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Check if this has any attributes
|
|
74
|
+
# @return [Boolean]
|
|
75
|
+
def empty?
|
|
76
|
+
id.nil? && classes.empty? && attributes.empty?
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ceradoc
|
|
4
|
+
module Markdown
|
|
5
|
+
module Behaviors
|
|
6
|
+
# Hand-written behavior for Document: index access and construction.
|
|
7
|
+
module Document
|
|
8
|
+
def self.prepended(base)
|
|
9
|
+
base.extend(ClassMethods)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Constructors for Document.
|
|
13
|
+
module ClassMethods
|
|
14
|
+
# Create a document from an array of blocks
|
|
15
|
+
def from_ast(elements)
|
|
16
|
+
new(blocks: elements)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# @param [Integer] index The index of the block to retrieve
|
|
21
|
+
# @return [Ceradoc::Markdown::Base] The block at the specified index
|
|
22
|
+
def [](index)
|
|
23
|
+
blocks[index]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# @param [Integer] index The index of the block to set
|
|
27
|
+
# @param [Ceradoc::Markdown::Base] value The block to set
|
|
28
|
+
def []=(index, value)
|
|
29
|
+
blocks[index] = value
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ceradoc
|
|
4
|
+
module Markdown
|
|
5
|
+
module Behaviors
|
|
6
|
+
# Hand-written behavior for the kramdown Extension model.
|
|
7
|
+
module Extension
|
|
8
|
+
# Known extension types
|
|
9
|
+
TYPES = {
|
|
10
|
+
toc: :toc,
|
|
11
|
+
options: :options,
|
|
12
|
+
comment: :comment,
|
|
13
|
+
nomarkdown: :nomarkdown,
|
|
14
|
+
ignore: :ignore,
|
|
15
|
+
if: :conditional,
|
|
16
|
+
endif: :conditional
|
|
17
|
+
}.freeze
|
|
18
|
+
|
|
19
|
+
def self.prepended(base)
|
|
20
|
+
base.extend(ClassMethods)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Factory helpers for common extensions.
|
|
24
|
+
module ClassMethods
|
|
25
|
+
# @param options [Hash] TOC options (levels, etc.)
|
|
26
|
+
def toc(options = {})
|
|
27
|
+
new(name: :toc, options: hash_to_named(options))
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# @param options [Hash] Parser options
|
|
31
|
+
def options(options = {})
|
|
32
|
+
new(name: :options, options: hash_to_named(options))
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# @param content [String] Comment content
|
|
36
|
+
def comment(content = '')
|
|
37
|
+
new(name: :comment, content: content)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# @param content [String] Raw content to pass through
|
|
41
|
+
def nomarkdown(content)
|
|
42
|
+
new(name: :nomarkdown, content: content)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
def hash_to_named(hash)
|
|
48
|
+
return [] if hash.nil? || hash.empty?
|
|
49
|
+
|
|
50
|
+
hash.map { |k, v| NamedValue.new(name: k.to_s, value: v.to_s) }
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Check if this is a specific extension type
|
|
55
|
+
# @param type [Symbol] The extension type
|
|
56
|
+
# @return [Boolean]
|
|
57
|
+
def type?(type)
|
|
58
|
+
name.to_sym == type
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Check if this is a self-closing extension
|
|
62
|
+
# @return [Boolean]
|
|
63
|
+
def self_closing?
|
|
64
|
+
content.nil? || content.empty?
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ceradoc
|
|
4
|
+
module Markdown
|
|
5
|
+
module Behaviors
|
|
6
|
+
# Hand-written behavior for Heading, shared by the hand-written and
|
|
7
|
+
# the schema-generated class.
|
|
8
|
+
module Heading
|
|
9
|
+
# Generate an auto ID from the heading text
|
|
10
|
+
#
|
|
11
|
+
# @return [String] A slugified version of the text suitable for use as an ID
|
|
12
|
+
# @example
|
|
13
|
+
# Heading.new(text: "Hello World!").auto_id #=> "hello-world"
|
|
14
|
+
def auto_id
|
|
15
|
+
return '' if text.nil? || text.empty?
|
|
16
|
+
|
|
17
|
+
slug = text.to_s
|
|
18
|
+
.downcase
|
|
19
|
+
.gsub(/[^a-z0-9]+/, '-')
|
|
20
|
+
.gsub(/^-+|-+$/, '')
|
|
21
|
+
slug.empty? ? 'section' : slug
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Get the ID for this heading (uses explicit id if set, otherwise auto_id)
|
|
25
|
+
#
|
|
26
|
+
# @return [String] The ID to use for this heading
|
|
27
|
+
def heading_id
|
|
28
|
+
id || auto_id
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|