@@ -83,14 +83,13 @@ class ToCiceroMarkVisitor {
8383 thing . text = null ; // Remove text
8484 delete thing . tag ;
8585 delete thing . info ;
86- }
87- else if ( tag . attributes [ 1 ] . name === 'src' &&
88- tag . attributes [ 0 ] . name === 'clauseid' ) {
86+ } else if ( tag . attributes [ 1 ] . name === 'src' &&
87+ tag . attributes [ 0 ] . name === 'clauseid' ) {
8988 thing . $classDeclaration = parameters . modelManager . getType ( ciceroMarkTag ) ;
90- thing . clauseid = tag . attributes [ 0 ] . value ;
9189 thing . src = tag . attributes [ 1 ] . value ;
90+ thing . clauseid = tag . attributes [ 0 ] . value ;
9291
93- thing . nodes = parameters . commonMark . fromMarkdown ( thing . text ) . nodes ;
92+ thing . nodes = parameters . commonMark . fromMarkdown ( clauseText ) . nodes ;
9493 ToCiceroMarkVisitor . visitNodes ( this , thing . nodes , parameters ) ;
9594 thing . text = null ; // Remove text
9695 delete thing . tag ;
@@ -103,23 +102,22 @@ class ToCiceroMarkVisitor {
103102 // Remove last new line, needed by CommonMark parser to identify ending code block (\n```)
104103 const clauseText = ToCiceroMarkVisitor . codeBlockContent ( thing . text ) ;
105104
106- thing . $classDeclaration = parameters . modelManager . getType ( ciceroMarkTag ) ;
107-
108105 const newNodes = parameters . commonMark . fromMarkdown ( clauseText ) . nodes ;
109- if ( newNodes . length !== 1 || newNodes [ 0 ] . getType ( ) !== 'List' ) {
110- throw new Error ( 'Content of list code block should be a list' ) ;
111- }
112-
113- thing . type = newNodes [ 0 ] . type ;
114- thing . start = newNodes [ 0 ] . start ;
115- thing . tight = newNodes [ 0 ] . tight ;
116- thing . delimiter = newNodes [ 0 ] . delimiter ;
117- thing . nodes = newNodes [ 0 ] . nodes ;
118- ToCiceroMarkVisitor . visitNodes ( this , thing . nodes , parameters ) ;
106+ if ( newNodes . length === 1 && newNodes [ 0 ] . getType ( ) === 'List' ) {
107+ thing . $classDeclaration = parameters . modelManager . getType ( ciceroMarkTag ) ;
108+ thing . type = newNodes [ 0 ] . type ;
109+ thing . start = newNodes [ 0 ] . start ;
110+ thing . tight = newNodes [ 0 ] . tight ;
111+ thing . delimiter = newNodes [ 0 ] . delimiter ;
112+ thing . nodes = newNodes [ 0 ] . nodes ;
113+ ToCiceroMarkVisitor . visitNodes ( this , thing . nodes , parameters ) ;
119114
120- thing . text = null ; // Remove text
121- delete thing . tag ;
122- delete thing . info ;
115+ thing . text = null ; // Remove text
116+ delete thing . tag ;
117+ delete thing . info ;
118+ } else {
119+ //console.log('List block does not contain a list');
120+ }
123121 }
124122 }
125123 break ;
@@ -139,13 +137,13 @@ class ToCiceroMarkVisitor {
139137 thing . value = decodeURIComponent ( tag . attributes [ 1 ] . value ) ;
140138 delete thing . tag ;
141139 delete thing . text ;
142- }
143- else if ( tag . attributes [ 1 ] . name === 'id' &&
144- tag . attributes [ 0 ] . name === 'value' ) {
140+ } else if ( tag . attributes [ 1 ] . name === 'id' &&
141+ tag . attributes [ 0 ] . name === 'value' ) {
145142 thing . $classDeclaration = parameters . modelManager . getType ( ciceroMarkTag ) ;
143+ thing . id = tag . attributes [ 1 ] . value ;
146144 thing . value = decodeURIComponent ( tag . attributes [ 0 ] . value ) ;
147- thing . id = tag . attributes [ 1 ] . value ;
148145 delete thing . tag ;
146+ delete thing . text ;
149147 } else {
150148 //console.log('Found Variable but without \'id\' and \'value\' attributes ');
151149 }
0 commit comments