File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 description
55 steps
66 conclusion?
7+ tags?
78
89headline "headline starting with ="
910 = "=" _ string ___
@@ -83,6 +84,18 @@ conclusionlines
8384conclusionline
8485 = !blockmarker string __
8586
87+ tags
88+ = "[tags]" ___
89+ "--" ___
90+ taglines
91+ "--" __
92+
93+ taglines
94+ = tagline+ { return { "taglines": text()}; }
95+
96+ tagline
97+ = !"--" string __
98+
8699string "string"
87100 = [^\r\n]+ { return text(); }
88101
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ export class Parser {
2222 result . subtitle = parseResult [ 1 ] ? parseResult [ 1 ] [ 3 ] : "" ;
2323 result . description = this . insertNewlineIntoDescription ( parseResult [ 2 ] [ 2 ] . descriptionlines ) ;
2424 result . conclusion = this . insertNewlineIntoDescription ( parseResult [ 4 ] ? parseResult [ 4 ] [ 2 ] . conclusionlines : "" ) ;
25+ result . tags = this . getTags ( parseResult ) ;
2526 for ( let index in parseResult [ 3 ] ) {
2627 let step = new Step ( ) ;
2728 step . text = this . getText ( parseResult , index ) ;
@@ -82,6 +83,24 @@ export class Parser {
8283 }
8384 }
8485
86+ getTags ( parseResult ) {
87+ let tagDict = { } ;
88+ try {
89+ let results = parseResult [ 5 ] ? parseResult [ 5 ] [ 4 ] . taglines . split ( / \r ? \n / ) : Array ( ) ;
90+ for ( let result of results ) {
91+ if ( result ) {
92+ result = result . split ( "=" )
93+ let type = result [ 0 ] ;
94+ let tags = result [ 1 ] . includes ( ";" ) ? result [ 1 ] . split ( ";" ) : Array ( result [ 1 ] ) ;
95+ tagDict [ type ] = tags ;
96+ }
97+ }
98+ } catch ( error ) {
99+ throw error ;
100+ }
101+ return tagDict ;
102+ }
103+
85104 insertNewlineIntoDescription ( description : string ) : string {
86105 let result = description ;
87106 let offset = 0 ;
Original file line number Diff line number Diff line change 11import { Step } from "./step" ;
22
3+ type Tag = Record < string , string [ ] >
4+
35export class Playbook {
46 public name : string ;
57 public path : string ;
@@ -8,4 +10,5 @@ export class Playbook{
810 public description : string ;
911 public conclusion : string ;
1012 public steps : Step [ ] = [ ] ;
13+ public tags : Tag ;
1114}
You can’t perform that action at this time.
0 commit comments