diff --git a/src/diagrams/gantt/ganttDb.js b/src/diagrams/gantt/ganttDb.js index f08f4dfe7..56b7ef003 100644 --- a/src/diagrams/gantt/ganttDb.js +++ b/src/diagrams/gantt/ganttDb.js @@ -294,8 +294,8 @@ export const addTask = function (descr, data) { data: data }, task: descr, - link: undefined, /* The link the rectangle will href to */ + link: undefined, classes: [] } const taskInfo = parseData(lastTaskID, data) @@ -325,8 +325,8 @@ export const addTaskOrg = function (descr, data) { type: currentSection, description: descr, task: descr, - link: undefined, /* The link the rectangle will href to */ + link: undefined, classes: [] } const taskInfo = compileData(lastTask, data) diff --git a/src/diagrams/gantt/parser/gantt.jison b/src/diagrams/gantt/parser/gantt.jison index 13f70aeb6..eb02f775f 100644 --- a/src/diagrams/gantt/parser/gantt.jison +++ b/src/diagrams/gantt/parser/gantt.jison @@ -13,8 +13,9 @@ /* a valid callback looks like this: callback(example_callback_arg) */ /* callback prefix: callback( */ /* callback suffix: ) */ -%x callback +%x href %x callbackname +%x callbackargs %% [\n]+ return 'NL'; @@ -25,11 +26,16 @@ ["] this.begin("string"); ["] this.popState(); [^"]* return 'STR'; -"call"\s this.begin("callbackname"); -\( this.popState(); this.begin("callback"); -[^(]+ return 'callbackname'; -[)] this.popState(); -[^)]* return 'callbackarguments'; + +"href"\s+ this.begin("href"); +[\s\n] this.popState(); +[^\s\n]* return 'href'; + +"call"\s+ this.begin("callbackname"); +\( this.popState(); this.begin("callbackargs"); +[^(]* return 'callbackname'; +\) this.popState(); +[^)]* return 'callbackargs'; "click" return 'click'; "gantt" return 'gantt'; @@ -78,8 +84,17 @@ statement ; clickStatement - : click STR callbackname callbackarguments {$$ = $1;yy.setClickEvent($2, $3, $4);} - | click STR STR callbackname callbackarguments {$$ = $1;yy.setLink($2, $3);yy.setClickEvent($2, $4, $5);} - | click STR STR {$$ = $1;yy.setLink($2, $3);} + : click STR callbackname callbackargs {$$ = $1;yy.setClickEvent($2, $3, $4);} + | click STR callbackname callbackargs href {$$ = $1;yy.setClickEvent($2, $3, $4);yy.setLink($2,$5);} + | click STR href callbackname callbackargs {$$ = $1;yy.setClickEvent($2, $4, $5);yy.setLink($2,$3);} + | click STR href {$$ = $1;yy.setLink($2, $3);} + ; + + +clickStatementDebug + : click STR callbackname callbackargs {$$=$1+' ' + $2 + ' ' + $3 + ' ' + $4;} + | click STR callbackname callbackargs href {$$=$1+' ' + $2 + ' ' + $3 + ' ' + $4 + ' ' + $5;} + | click STR href callbackname callbackargs {$$=$1+' ' + $2 + ' ' + $3 + ' ' + $4 + ' ' + $5;} + | click STR href {$$=$1+' ' + $2 + ' ' + $3;} ; %%