File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,35 @@ func (c *CommonInserter) setRefs(item map[string]interface{}) map[string]interfa
92
92
reg := regexp .MustCompile (`\#\{.*?\}` )
93
93
for k , v := range item {
94
94
switch vt := v .(type ) {
95
+ case []interface {}:
96
+ new := make ([]string , len (vt ))
97
+ isStr := true
98
+ for i , vtv := range vt {
99
+ vStr , ok := vtv .(string )
100
+ if ! ok {
101
+ isStr = false
102
+ break
103
+ }
104
+ if strings .HasPrefix (vStr , "$" ) && ! reg .MatchString (vStr ) {
105
+ refID := strings .TrimPrefix (vStr , "$" )
106
+ rv , ok := c .refIDs [refID ]
107
+ if ! ok {
108
+ log .Printf ("%s was not found" , refID )
109
+ } else {
110
+ new [i ] = rv
111
+ }
112
+ continue
113
+ }
114
+ n := c .replaceMultiRefs (vStr , reg )
115
+ if n != "" {
116
+ new [i ] = n
117
+ continue
118
+ }
119
+ new [i ] = vStr
120
+ }
121
+ if isStr {
122
+ item [k ] = new
123
+ }
95
124
case map [string ]interface {}:
96
125
for vtk , vtv := range vt {
97
126
if strings .HasPrefix (vtk , "$" ) && ! reg .MatchString (vtk ) {
Original file line number Diff line number Diff line change 4
4
payload : {
5
5
defaultOption : "$Option__dummy_0" ,
6
6
optionsText : "/#{Option__dummy_0}/#{Option__dummy_0}/" ,
7
+ optionsArray : [ "$Option__dummy_0" , "#{Option__dummy_1}(default)" ] ,
8
+ point : [ 10 , 30 ] ,
9
+ postText : [ "10" , "30" ] ,
7
10
options : {
8
11
$Option__dummy_0 : true ,
9
12
$Option__dummy_1 : true ,
You can’t perform that action at this time.
0 commit comments