mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
feat(gantt.jison): update parser to accept a inclusive end date arg
if a line contains inclusiveEndDates then it will toggle the chart to use inclusive end dates
This commit is contained in:
parent
0a567a3ef9
commit
16f3338b3d
@ -55,6 +55,7 @@ that id.
|
||||
|
||||
"gantt" return 'gantt';
|
||||
"dateFormat"\s[^#\n;]+ return 'dateFormat';
|
||||
"inclusiveEndDates" return 'inclusiveEndDates';
|
||||
"axisFormat"\s[^#\n;]+ return 'axisFormat';
|
||||
"excludes"\s[^#\n;]+ return 'excludes';
|
||||
\d\d\d\d"-"\d\d"-"\d\d return 'date';
|
||||
@ -91,9 +92,10 @@ line
|
||||
;
|
||||
|
||||
statement
|
||||
: 'dateFormat' {yy.setDateFormat($1.substr(11));$$=$1.substr(11);}
|
||||
| 'axisFormat' {yy.setAxisFormat($1.substr(11));$$=$1.substr(11);}
|
||||
| 'excludes' {yy.setExcludes($1.substr(9));$$=$1.substr(9);}
|
||||
: dateFormat {yy.setDateFormat($1.substr(11));$$=$1.substr(11);}
|
||||
| inclusiveEndDates {yy.enableInclusiveEndDates();$$=$1.substr(18);}
|
||||
| axisFormat {yy.setAxisFormat($1.substr(11));$$=$1.substr(11);}
|
||||
| excludes {yy.setExcludes($1.substr(9));$$=$1.substr(9);}
|
||||
| title {yy.setTitle($1.substr(6));$$=$1.substr(6);}
|
||||
| section {yy.addSection($1.substr(8));$$=$1.substr(8);}
|
||||
| clickStatement
|
||||
|
@ -15,8 +15,8 @@ describe('when parsing a gantt diagram it', function () {
|
||||
parser.parse(str)
|
||||
})
|
||||
|
||||
it('should handle a dateFormat definition with inclusivity specified', function () {
|
||||
const str = 'gantt\ndateFormat yyyy-mm-dd inclusive'
|
||||
it('should handle a inclusive end date definition', function () {
|
||||
const str = 'gantt\ndateFormat yyyy-mm-dd\ninclusiveEndDates'
|
||||
|
||||
parser.parse(str)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user