Skip to content

Commit c4aa95d

Browse files
committed
cleanup + update
1 parent 30dab09 commit c4aa95d

16 files changed

+4979
-4373
lines changed

ack

Lines changed: 3214 additions & 2286 deletions
Large diffs are not rendered by default.

alibuild_deps_py

Lines changed: 0 additions & 10 deletions
This file was deleted.

aliphysics_rebuild

Lines changed: 0 additions & 38 deletions
This file was deleted.

aliroot_rebuild

Lines changed: 0 additions & 35 deletions
This file was deleted.

ansi2html

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@
3232
# Handle codes with combined attributes and color.
3333
# Handle isolated <bold> attributes with css.
3434
# Strip more terminal control codes.
35-
# V0.23, 28 Feb 2016
35+
# V0.26, 16 Nov 2019
3636
# http://github.com/pixelb/scripts/commits/master/scripts/ansi2html.sh
3737

3838
gawk --version >/dev/null || exit 1
3939

4040
if [ "$1" = "--version" ]; then
41-
printf '0.23\n' && exit
41+
printf '0.26\n' && exit
4242
fi
4343

4444
usage()
@@ -115,6 +115,7 @@ fi
115115
<head>
116116
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>
117117
<style type=\"text/css\">
118+
pre { white-space: pre-wrap; }
118119
"
119120
[ "$body_only" ] || printf ".ef0,.f0 { color: #$P0; } .eb0,.b0 { background-color: #$P0; }
120121
.ef1,.f1 { color: #$P1; } .eb1,.b1 { background-color: #$P1; }
@@ -235,6 +236,12 @@ sed "
235236
# escape HTML (ampersand and quote done above)
236237
s#>#\&gt;#g; s#<#\&lt;#g;
237238
239+
# handle truecolor
240+
s#${p}38;2;\([0-9]\{1,3\}\);\([0-9]\{1,3\}\);\([0-9]\{1,3\}\)m#\
241+
<span style=\"color:rgb(\1\,\2\,\3\)\">#g
242+
s#${p}48;2;\([0-9]\{1,3\}\);\([0-9]\{1,3\}\);\([0-9]\{1,3\}\)m#\
243+
<span style=\"background-color:rgb(\1\,\2\,\3\)\">#g
244+
238245
# normalize SGR codes a little
239246
240247
# split 256 colors out and mark so that they're not
@@ -310,7 +317,7 @@ s#\x0F#\"T0;#g
310317
gawk '
311318
function dump_line(l,del,c,blanks,ret) {
312319
for(c=1;c<maxX;c++) {
313-
if ((c SUBSEP l) in attr || length(cur)) {
320+
if ((c SUBSEP l) in attr || alength(cur)) {
314321
ret = ret blanks fixas(cur,attr[c,l])
315322
if(del) delete attr[c,l]
316323
blanks=""
@@ -321,7 +328,7 @@ function dump_line(l,del,c,blanks,ret) {
321328
blanks=""
322329
} else blanks=blanks " "
323330
}
324-
if(length(cur)) ret=ret blanks
331+
if(alength(cur)) ret=ret blanks
325332
return ret
326333
}
327334
@@ -332,12 +339,18 @@ function dump_screen(l,ret) {
332339
}
333340
334341
function atos(a,i,ret) {
335-
for(i=1;i<=length(a);i++) if(i in a) ret=ret a[i]
342+
for(i=1;i<=alength(a);i++) if(i in a) ret=ret a[i]
336343
return ret
337344
}
338345
346+
function alength(a, i, k) {
347+
k = 0
348+
for(i in a) k++
349+
return k
350+
}
351+
339352
function fixas(a,s,spc,i,attr,rm,ret) {
340-
spc=length(a)
353+
spc=alength(a)
341354
l=split(s,attr,">")
342355
for(i=1;i<=spc;i++) {
343356
rm=rm?rm:(a[i]!=attr[i]">")

0 commit comments

Comments
 (0)