Add $.contents for block-style nodes to allow injections

This commit is contained in:
Kristijan Husak 2021-08-25 15:55:08 +02:00 committed by GitHub
parent 3551d82a28
commit 41eac56ba9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 50102 additions and 50473 deletions

View file

@ -615,7 +615,7 @@ a
#+END_ABC
----------
(document (body (block (name) (parameters) )))
(document (body (block (name) (parameters) (contents))))
==========
Block.2 -
@ -630,7 +630,7 @@ a
(document (section
(headline (stars) (item))
(body
(block (name) (parameters))
(block (name) (parameters) (contents))
)))
=================
@ -650,7 +650,7 @@ c
#+END:
----------
(document (body (dynamic_block (name) )))
(document (body (dynamic_block (name) (contents))))
==========
Link.1 - Description only
@ -1317,7 +1317,7 @@ a
\end{1a}
----------
(document (body (latex_env )))
(document (body (latex_env (contents))))
=============
LatexEnv.3 -
@ -1327,7 +1327,7 @@ LatexEnv.3 -
\end{a}
----------
(document (body (latex_env )))
(document (body (latex_env (contents))))
=============
LatexEnv.4a -
@ -1338,7 +1338,7 @@ a
\end{a}
----------
(document (body (latex_env )))
(document (body (latex_env (contents))))
=============
LatexEnv.4b -
@ -1349,7 +1349,7 @@ a
\end{a}
----------
(document (body (latex_env )))
(document (body (latex_env (contents))))
=============
LatexEnv.4c -
@ -1361,7 +1361,7 @@ a
\end{a}
----------
(document (body (latex_env )))
(document (body (latex_env (contents))))
==================
LatexFragment.1 -

View file

@ -391,8 +391,7 @@ org_grammar = {
block: $ => seq(
optional($._directive_list),
$._block_begin,
repeat($._nl),
repeat(seq(repeat1($._text), repeat1($._nl))),
optional($.contents),
$._block_end,
),
@ -415,8 +414,7 @@ org_grammar = {
dynamic_block: $ => seq(
optional($._directive_list),
$._dynamic_begin,
repeat($._nl),
repeat(seq(repeat1($._text), repeat1($._nl))),
optional($.contents),
$._dynamic_end,
),
@ -488,8 +486,7 @@ org_grammar = {
latex_env: $ => seq(
optional($._directive_list),
$._env_begin,
repeat($._nl),
repeat(seq(repeat1($._text), repeat1($._nl))),
optional($.contents),
$._env_end,
),
@ -527,6 +524,10 @@ org_grammar = {
seq($._text, token.immediate('_'), token.immediate(/[^\p{Z}]/))
)),
contents: $ => seq(
repeat($._text),
sep1(repeat1($._nl), repeat1($._text)),
),
}
};

View file

@ -2153,33 +2153,16 @@
"name": "_block_begin"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_nl"
}
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_text"
}
},
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_nl"
}
}
]
}
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "contents"
},
{
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",
@ -2273,33 +2256,16 @@
"name": "_dynamic_begin"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_nl"
}
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_text"
}
},
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_nl"
}
}
]
}
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "contents"
},
{
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",
@ -2697,33 +2663,16 @@
"name": "_env_begin"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_nl"
}
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_text"
}
},
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_nl"
}
}
]
}
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "contents"
},
{
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",
@ -2948,6 +2897,52 @@
}
]
}
},
"contents": {
"type": "SEQ",
"members": [
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_text"
}
},
{
"type": "SEQ",
"members": [
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_nl"
}
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_text"
}
},
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_nl"
}
}
]
}
}
]
}
]
}
},
"extras": [

View file

@ -7,6 +7,10 @@
"multiple": true,
"required": true,
"types": [
{
"type": "contents",
"named": true
},
{
"type": "directive",
"named": true
@ -98,6 +102,11 @@
"named": true,
"fields": {}
},
{
"type": "contents",
"named": true,
"fields": {}
},
{
"type": "date",
"named": true,
@ -218,6 +227,10 @@
"multiple": true,
"required": true,
"types": [
{
"type": "contents",
"named": true
},
{
"type": "directive",
"named": true
@ -367,6 +380,10 @@
"multiple": true,
"required": false,
"types": [
{
"type": "contents",
"named": true
},
{
"type": "directive",
"named": true

100372
src/parser.c

File diff suppressed because it is too large Load diff