Support string templating for key-level attributes

This commit is contained in:
Bán Dénes 2022-01-22 23:13:18 +01:00
parent 6225013828
commit 2b98b502d6
10 changed files with 459 additions and 47 deletions

View file

@ -19,10 +19,12 @@ matrix:
padding: 19
skip: false
asym: both
colrow: default_default
name: matrix
zone:
name: matrix
col:
rows: {}
key: {}
name: default
row: default
colrow: default_default

View file

@ -19,10 +19,16 @@ matrix_col_row:
padding: 19
skip: false
asym: both
name: matrix_col_row
col:
rows: {}
key: {}
name: col
row: row
colrow: col_row
name: matrix_col_row
zone:
columns:
col: &ref_0
rows: {}
key: {}
name: col
rows:
row: {}
name: matrix
col: *ref_0
row: row

View file

@ -124,7 +124,7 @@ for (let w of cli_what) {
const command = read(t, 'command')
const output_path = exists(t, 'path') ? read(t, 'path') : 'output'
fs.removeSync(output_path)
const version_regex = /\bv\d+\.\d+\.\d+\b/
const version_regex = /\bv\d+\.\d+\.\d+(\-develop)?\b/
// correct execution
if (exists(t, 'log')) {
const ref_log = read(t, 'log').replace(version_regex, '<version>')

View file

@ -22,14 +22,46 @@
"padding": 19,
"skip": false,
"asym": "both",
"colrow": "left_bottom",
"name": "matrix_left_bottom",
"zone": {
"columns": {
"left": null,
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": 5,
"origin": [
-9,
-9
]
},
"rows": {
"top": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {},
"key": {},
"name": "left"
},
"row": "bottom",
"colrow": "left_bottom"
"row": "bottom"
}
},
"matrix_left_top": {
@ -55,14 +87,46 @@
"padding": 19,
"skip": false,
"asym": "both",
"colrow": "left_top",
"name": "matrix_left_top",
"zone": {
"columns": {
"left": null,
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": 5,
"origin": [
-9,
-9
]
},
"rows": {
"top": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {},
"key": {},
"name": "left"
},
"row": "top",
"colrow": "left_top"
"row": "top"
}
},
"matrix_right_bottom": {
@ -88,7 +152,40 @@
"padding": 19,
"skip": false,
"asym": "both",
"colrow": "right_bottom",
"name": "matrix_right_bottom",
"zone": {
"columns": {
"left": null,
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": 5,
"origin": [
-9,
-9
]
},
"rows": {
"top": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"top": {}
},
"name": "matrix"
},
"col": {
"key": {
"stagger": 5,
@ -111,8 +208,7 @@
},
"name": "right"
},
"row": "bottom",
"colrow": "right_bottom"
"row": "bottom"
}
},
"matrix_right_top": {
@ -138,7 +234,40 @@
"padding": 19,
"skip": false,
"asym": "both",
"colrow": "right_top",
"name": "matrix_right_top",
"zone": {
"columns": {
"left": null,
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": 5,
"origin": [
-9,
-9
]
},
"rows": {
"top": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"top": {}
},
"name": "matrix"
},
"col": {
"key": {
"stagger": 5,
@ -161,8 +290,7 @@
},
"name": "right"
},
"row": "top",
"colrow": "right_top"
"row": "top"
}
}
}

View file

@ -22,14 +22,25 @@
"padding": 19,
"skip": false,
"asym": "both",
"colrow": "left_bottom",
"name": "matrix_left_bottom",
"zone": {
"columns": {
"left": null,
"right": null
},
"rows": {
"bottom": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {},
"key": {},
"name": "left"
},
"row": "bottom",
"colrow": "left_bottom"
"row": "bottom"
}
},
"matrix_left_top": {
@ -55,14 +66,25 @@
"padding": 19,
"skip": false,
"asym": "both",
"colrow": "left_top",
"name": "matrix_left_top",
"zone": {
"columns": {
"left": null,
"right": null
},
"rows": {
"bottom": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {},
"key": {},
"name": "left"
},
"row": "top",
"colrow": "left_top"
"row": "top"
}
},
"matrix_right_bottom": {
@ -88,14 +110,25 @@
"padding": 19,
"skip": false,
"asym": "both",
"colrow": "right_bottom",
"name": "matrix_right_bottom",
"zone": {
"columns": {
"left": null,
"right": null
},
"rows": {
"bottom": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {},
"key": {},
"name": "right"
},
"row": "bottom",
"colrow": "right_bottom"
"row": "bottom"
}
},
"matrix_right_top": {
@ -121,14 +154,25 @@
"padding": 19,
"skip": false,
"asym": "both",
"colrow": "right_top",
"name": "matrix_right_top",
"zone": {
"columns": {
"left": null,
"right": null
},
"rows": {
"bottom": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {},
"key": {},
"name": "right"
},
"row": "top",
"colrow": "right_top"
"row": "top"
}
}
}

View file

@ -22,14 +22,17 @@
"padding": 19,
"skip": false,
"asym": "both",
"colrow": "default_default",
"name": "matrix",
"zone": {
"name": "matrix"
},
"col": {
"rows": {},
"key": {},
"name": "default"
},
"row": "default",
"colrow": "default_default"
"row": "default"
}
}
}

View file

@ -22,14 +22,42 @@
"padding": 19,
"skip": false,
"asym": "both",
"colrow": "left_bottom",
"name": "matrix_left_bottom",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"top": {}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": "u"
},
"rows": {
"bottom": "$unset",
"home": {},
"top": {}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {}
},
"name": "matrix"
},
"col": {
"rows": {},
"key": {},
"name": "left"
},
"row": "bottom",
"colrow": "left_bottom"
"row": "bottom"
}
},
"matrix_left_home": {
@ -55,14 +83,42 @@
"padding": 19,
"skip": false,
"asym": "both",
"colrow": "left_home",
"name": "matrix_left_home",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"top": {}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": "u"
},
"rows": {
"bottom": "$unset",
"home": {},
"top": {}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {}
},
"name": "matrix"
},
"col": {
"rows": {},
"key": {},
"name": "left"
},
"row": "home",
"colrow": "left_home"
"row": "home"
}
},
"matrix_middle_bottom": {
@ -88,7 +144,36 @@
"padding": 19,
"skip": false,
"asym": "both",
"colrow": "middle_bottom",
"name": "matrix_middle_bottom",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"top": {}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": "u"
},
"rows": {
"bottom": "$unset",
"home": {},
"top": {}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {}
},
"name": "matrix"
},
"col": {
"rows": {
"top": {}
@ -96,8 +181,7 @@
"key": {},
"name": "middle"
},
"row": "bottom",
"colrow": "middle_bottom"
"row": "bottom"
}
},
"matrix_middle_home": {
@ -123,7 +207,36 @@
"padding": 19,
"skip": false,
"asym": "both",
"colrow": "middle_home",
"name": "matrix_middle_home",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"top": {}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": "u"
},
"rows": {
"bottom": "$unset",
"home": {},
"top": {}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {}
},
"name": "matrix"
},
"col": {
"rows": {
"top": {}
@ -131,8 +244,7 @@
"key": {},
"name": "middle"
},
"row": "home",
"colrow": "middle_home"
"row": "home"
}
},
"matrix_middle_top": {
@ -158,7 +270,36 @@
"padding": 19,
"skip": false,
"asym": "both",
"colrow": "middle_top",
"name": "matrix_middle_top",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"top": {}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": "u"
},
"rows": {
"bottom": "$unset",
"home": {},
"top": {}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {}
},
"name": "matrix"
},
"col": {
"rows": {
"top": {}
@ -166,8 +307,7 @@
"key": {},
"name": "middle"
},
"row": "top",
"colrow": "middle_top"
"row": "top"
}
},
"matrix_right_home": {
@ -193,7 +333,36 @@
"padding": 19,
"skip": false,
"asym": "both",
"colrow": "right_home",
"name": "matrix_right_home",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"top": {}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": "u"
},
"rows": {
"bottom": "$unset",
"home": {},
"top": {}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {}
},
"name": "matrix"
},
"col": {
"key": {
"stagger": "u"
@ -205,8 +374,7 @@
},
"name": "right"
},
"row": "home",
"colrow": "right_home"
"row": "home"
}
},
"matrix_right_top": {
@ -232,7 +400,36 @@
"padding": 19,
"skip": false,
"asym": "both",
"colrow": "right_top",
"name": "matrix_right_top",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"top": {}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": "u"
},
"rows": {
"bottom": "$unset",
"home": {},
"top": {}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {}
},
"name": "matrix"
},
"col": {
"key": {
"stagger": "u"
@ -244,8 +441,7 @@
},
"name": "right"
},
"row": "top",
"colrow": "right_top"
"row": "top"
}
}
}

View file

@ -22,6 +22,19 @@ describe('Utils', function() {
should.equal(u.deep(obj, 'non.existent.key'), undefined)
})
it('template', function() {
u.template('arst').should.equal('arst')
u.template('{arst}}').should.equal('{arst}}')
u.template('{{arst}}').should.equal('')
u.template('{{arst}}', {arst: 'neio'}).should.equal('neio')
u.template('{{a}}_{{b}}', {a: 'c', b: 'd'}).should.equal('c_d')
u.template(
'{{longlonglong}}_{{short}}',
{longlonglong: 'long', short: 'shortshortshort'}
).should.equal('long_shortshortshort')
u.template('{{a.b.c}}', {a: {b: {c: 'deep'}}}).should.equal('deep')
})
it('eq', function() {
// basic point usage
u.eq([1, 2], [1, 2]).should.equal(true)