@@ -20,13 +20,15 @@ class ActivityListBuilder {
2020 filePath : string
2121 formatter : Formatter
2222 linkTargets : LinkTargetList
23+ regex : RegExp
2324
2425 constructor ( value : { activityTypesManager : ActivityTypeManager , configuration : Configuration , filePath : string , formatter : Formatter , linkTargets : LinkTargetList } ) {
2526 this . activityTypesManager = value . activityTypesManager
2627 this . configuration = value . configuration
2728 this . filePath = value . filePath
2829 this . formatter = value . formatter
2930 this . linkTargets = value . linkTargets
31+ this . regex = new RegExp ( ` ${ this . configuration . get ( 'classPrefix' ) } ="([^"]+)"` )
3032 }
3133
3234 build ( tree : AstNodeList ) : ActivityList {
@@ -153,16 +155,14 @@ class ActivityListBuilder {
153155 // _determineIsActiveBlockStartTag returns whether the given AstNode is the start of an active block
154156 _determineIsActiveBlockStartTag ( node : AstNode ) : boolean {
155157 if ( node . type !== 'htmltag' ) return false
156- const regex = new RegExp ( ` ${ this . configuration . get ( 'classPrefix' ) } ="([^"]+)"` )
157158 if ( ! node . content ) return false
158- return regex . test ( node . content )
159+ return this . regex . test ( node . content )
159160 }
160161
161162 // _getBlockType returns the activity type started by the given AstNode that starts an active block
162163 _getBlockType ( node : AstNode ) : string {
163- const regex = new RegExp ( ` ${ this . configuration . get ( 'classPrefix' ) } ="([^"]+)"` )
164164 if ( node . content == null ) throw new Error ( "this shouldn't happen" )
165- const matches = node . content . match ( regex )
165+ const matches = node . content . match ( this . regex )
166166 if ( ! matches ) throw new Error ( "this shouldn't happen" )
167167 return matches [ 1 ]
168168 }
0 commit comments