mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-15 21:39:40 +02: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:
@@ -55,6 +55,7 @@ that id.
|
|||||||
|
|
||||||
"gantt" return 'gantt';
|
"gantt" return 'gantt';
|
||||||
"dateFormat"\s[^#\n;]+ return 'dateFormat';
|
"dateFormat"\s[^#\n;]+ return 'dateFormat';
|
||||||
|
"inclusiveEndDates" return 'inclusiveEndDates';
|
||||||
"axisFormat"\s[^#\n;]+ return 'axisFormat';
|
"axisFormat"\s[^#\n;]+ return 'axisFormat';
|
||||||
"excludes"\s[^#\n;]+ return 'excludes';
|
"excludes"\s[^#\n;]+ return 'excludes';
|
||||||
\d\d\d\d"-"\d\d"-"\d\d return 'date';
|
\d\d\d\d"-"\d\d"-"\d\d return 'date';
|
||||||
@@ -91,9 +92,10 @@ line
|
|||||||
;
|
;
|
||||||
|
|
||||||
statement
|
statement
|
||||||
: 'dateFormat' {yy.setDateFormat($1.substr(11));$$=$1.substr(11);}
|
: dateFormat {yy.setDateFormat($1.substr(11));$$=$1.substr(11);}
|
||||||
| 'axisFormat' {yy.setAxisFormat($1.substr(11));$$=$1.substr(11);}
|
| inclusiveEndDates {yy.enableInclusiveEndDates();$$=$1.substr(18);}
|
||||||
| 'excludes' {yy.setExcludes($1.substr(9));$$=$1.substr(9);}
|
| 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);}
|
| title {yy.setTitle($1.substr(6));$$=$1.substr(6);}
|
||||||
| section {yy.addSection($1.substr(8));$$=$1.substr(8);}
|
| section {yy.addSection($1.substr(8));$$=$1.substr(8);}
|
||||||
| clickStatement
|
| clickStatement
|
||||||
|
@@ -15,8 +15,8 @@ describe('when parsing a gantt diagram it', function () {
|
|||||||
parser.parse(str)
|
parser.parse(str)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should handle a dateFormat definition with inclusivity specified', function () {
|
it('should handle a inclusive end date definition', function () {
|
||||||
const str = 'gantt\ndateFormat yyyy-mm-dd inclusive'
|
const str = 'gantt\ndateFormat yyyy-mm-dd\ninclusiveEndDates'
|
||||||
|
|
||||||
parser.parse(str)
|
parser.parse(str)
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user