wok-current rev 24569

sokojs: add shrink.sh (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 26 18:46:53 2022 +0000 (2022-02-26)
parents 4495814243a2
children 06980172e40b
files sokojs/stuff/shrink.sh
line diff
     1.1 --- a/sokojs/stuff/shrink.sh	Sat Feb 26 16:37:15 2022 +0000
     1.2 +++ b/sokojs/stuff/shrink.sh	Sat Feb 26 18:46:53 2022 +0000
     1.3 @@ -26,8 +26,11 @@
     1.4  }
     1.5  function flush() {
     1.6    for (i=0;i<row;i++) {
     1.7 -    if (i == row-1) tail="\"); //!"; else tail="\",  //!"
     1.8 -    print "\"" tab substr(line[i],begin+2,length(line[i])-end-begin-3) tail line[i]
     1.9 +    l=length(line[i])-end-begin-3
    1.10 +    if (i == row-1) { tail="\"); //!"
    1.11 +      if (end==0) l--
    1.12 +    } else tail="\",  //!"
    1.13 +    print "\"" tab substr(line[i],begin+2,l) tail line[i]
    1.14    }
    1.15    for (i=0;i<cut;i++) print "//!" line2[i]
    1.16  }