Skip to content

Commit 124262f

Browse files
committed
remove some umlaut in id before conversion, remove undesired trailing and double underscores
1 parent 6577542 commit 124262f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

csvall.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ sed -i \
2929
-e 's#,UCH,240=off;15=on,#,onoff2,,#' \
3030
-e 's#,UCH,,,"Off=0, On=1"#,onoff,,,#' \
3131
-e 's#,UCH,240=no;15=yes,#,yesno2,,#' \
32+
-e 's#,RückmeldungB#,RueckmeldungB#' \
3233
\{\} \; \
3334
&& npm run csv2tsp \
3435
&& npm run csv2tsp-combine \

utils/src/csv2tsp.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ const normId = (id: string): string => (id || '')
197197
.replaceAll('ä','ae').replaceAll('ö','oe').replaceAll('ü','ue')
198198
.replaceAll('Ä','AE').replaceAll('Ö','OE').replaceAll('Ü','UE')
199199
.replaceAll('²', '2').replaceAll('³', '3')
200-
.replaceAll(/[^a-zA-Z0-9_]/g, '_').replace(/^([0-9])/, '_$1');
200+
.replaceAll(/[^a-zA-Z0-9_]/g, '_').replace(/^([0-9])/, '_$1')
201+
.replaceAll(/__+/g, '_').replace(/^(.+)_$/, '$1');
201202
const normType = (t: string): string => {
202203
const parts = t.split(':');
203204
parts[0] = normId(parts[0]);
@@ -789,7 +790,7 @@ const messageTrans: Trans<MessageLine> = (location, wholeLine, header, additions
789790
? direction(dirs[0]) // single model
790791
: `@inherit(${dirs.map(d=>additions.renamedDefaults[d] || (d+getSuffix(d, additions.defaultsByName))).join(', ')})`, // multi model
791792
auth&&`@auth("${auth}")` || (poll.length?`@poll(${poll[0]})`:undefined),
792-
line[4]&&`@qq(${fromHex(line[4]).join})`,
793+
line[4]&&`@qq(${fromHex(line[4]).join('')})`,
793794
zz&&`@zz(${zz==='0xfe'?'BROADCAST':zz})`,
794795
single&&idComb.length>=2
795796
? `@${isDefault?'base':'id'}(${idComb.join(', ')})`

0 commit comments

Comments
 (0)