Skip to content

Commit

Permalink
Turn ansi escape sequences into html tags
Browse files Browse the repository at this point in the history
  • Loading branch information
albfan committed Sep 25, 2022
1 parent c515ea8 commit 28b843b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/w3mman/w3mman2html.cgi.in
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ EOF
next;
}

my $printchar='[\w^ÁÉÍÓÚáéíóú /\'.:;,&()\\"~=%*\[\]\$\?|!#\`\@\{\}\<\>+_-]';
s@\[1m($printchar+)\[0m@<b>$1</b>@g;
s@\[4m($printchar+)\[24m@<u>$1</u>@g;
s@\[1m($printchar+)\[0m@<b>$1</b>@g;
s@\[1m($printchar+)\[22m@<b>$1</b>@g;
s@\[1m($printchar+)\[4m@<b>$1</b>@g;
s@\[22m($printchar+)\[0m@<u>$1</u>@g;
s@\[22m($printchar+)\[24m@<u>$1</u>@g;
s@\[4m($printchar+)\[0m@<u>$1</u>@g;
s@(http|ftp)://[\w.\-/~]+[\w/]@<a href="$&">$&</a>@g;
s@\b(mailto:|)(\w[\w.\-]*\@\w[\w.\-]*\.[\w.\-]*\w)@<a href="mailto:$2">$1$2</a>@g;
s@(\W)(\~?/[\w.][\w.\-/~]*)@$1 . &file_ref($2)@ge;
Expand Down

0 comments on commit 28b843b

Please sign in to comment.