File tree Expand file tree Collapse file tree 1 file changed +25
-11
lines changed Expand file tree Collapse file tree 1 file changed +25
-11
lines changed Original file line number Diff line number Diff line change 2
2
// final parsed output for coderoad.json file
3
3
var position = {
4
4
page: - 1 ,
5
+ task: - 1 ,
5
6
};
6
7
var output = {
7
8
info: {
@@ -23,21 +24,23 @@ start
23
24
doc
24
25
= info_title
25
26
info_description *
26
- optionalBreak
27
+ break ?
27
28
page *
28
29
29
30
page
30
31
= page_title
31
32
page_description *
33
+ page_task *
32
34
33
35
page_title
34
36
= '##'
35
- optionalSpace
37
+ space ?
36
38
title : content
37
- EOL
39
+ break
38
40
{
39
41
// increment page
40
42
position .page += 1 ;
43
+ position .task = - 1 ;
41
44
// add page outline
42
45
output .pages .push ({
43
46
title: ' Page ' + position .page ,
@@ -49,37 +52,48 @@ page_title
49
52
50
53
page_description
51
54
= description : content
52
- EOL
55
+ break
53
56
{
54
57
const d = output .pages [position .page ].description ;
55
58
output .pages [position .page ].description += d .length > 0 ? ' \n ' : ' ' ;
56
59
output .pages [position .page ].description += adjust (description);
57
60
}
58
61
62
+ page_task
63
+ = '+'
64
+ space ?
65
+ description : content
66
+ break
67
+ {
68
+ position .task += 1 ;
69
+ if (! output .pages [position .page ].tasks ) {
70
+ output .pages [position .page ].tasks = [{
71
+ description: adjust (description)
72
+ }]
73
+ }
74
+ }
75
+
59
76
info_title
60
77
= '#'
61
- optionalSpace
78
+ space ?
62
79
title : content
63
80
{ output .info .title = adjust (title); }
64
81
65
82
info_description
66
83
= description : content
67
- EOL
84
+ break
68
85
{
69
86
const d = output .info .description ;
70
87
output .info .description += d .length > 0 ? ' \n ' : ' ' ;
71
88
output .info .description += adjust (description);
72
89
}
73
90
74
- content = [^#] [^\n ^\r ]+ [\n\r ]
91
+ content = [^#^@^+ ] [^\n ^\r ]+ [\n\r ]
75
92
space = [ \s ]
76
- EOL = [\n\r ]?
93
+ break = [\n\r ]?
77
94
file_path = [a-z_\-\s 0-9\. ]+
78
95
quote = [\"\'\` ]
79
96
80
- optionalBreak = EOL ?
81
- optionalSpace = space ?
82
-
83
97
{
84
98
// notes
85
99
// - break if line starts with #
You can’t perform that action at this time.
0 commit comments