Skip to content

Commit

Permalink
fix(headline): be more flexible
Browse files Browse the repository at this point in the history
Fix #4
  • Loading branch information
vigoux committed Jul 28, 2022
1 parent 1de3ea0 commit 3564c33
Show file tree
Hide file tree
Showing 5 changed files with 613 additions and 405 deletions.
12 changes: 12 additions & 0 deletions corpus/headline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,15 @@ Text
(word)))
(line
(word)))


=====================
Headline with tag at the start
=====================

==============================================================================
*03.1* Word movement

Text

---------------
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = grammar({
seq(
field('delimiter', choice(/===.*===/, /---.*---/)),
'\n',
seq(repeat1($.word), $.tag),
repeat1($._atom),
'\n',
),

Expand Down
19 changes: 5 additions & 14 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,11 @@
"value": "\n"
},
{
"type": "SEQ",
"members": [
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "word"
}
},
{
"type": "SYMBOL",
"name": "tag"
}
]
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_atom"
}
},
{
"type": "STRING",
Expand Down
16 changes: 16 additions & 0 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@
"multiple": true,
"required": true,
"types": [
{
"type": "argument",
"named": true
},
{
"type": "backtick",
"named": true
},
{
"type": "hotlink",
"named": true
},
{
"type": "option",
"named": true
},
{
"type": "tag",
"named": true
Expand Down
Loading

0 comments on commit 3564c33

Please sign in to comment.