s4

changeset 346:4f06842488d3

Cat text file of attachment with pretty format with line numbers
author HIROSE Yuuji <yuuji@gentei.org>
date Tue, 25 Oct 2016 22:42:34 +0859
parents 8134b548b385
children 332765572341
files examples/common/default/pretty.m4.txt s4-funcs.sh
diffstat 2 files changed, 28 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/examples/common/default/pretty.m4.txt	Tue Oct 25 22:42:34 2016 +0859
     1.3 @@ -0,0 +1,22 @@
     1.4 +Content-type: _CONTENT_TYPE_
     1.5 +
     1.6 +<html>
     1.7 +<!-- Default style for pretty-print of text files -->
     1.8 +<head><title>_TITLE_</title>
     1.9 +<style type="text/css">
    1.10 +pre {margin-left: 8.5ex;}
    1.11 +pre span {counter-increment: linenum; text-align: right; position: relative;}
    1.12 +pre span:before {
    1.13 +    position: absolute; right: 0px;
    1.14 +    background: #ddd; text-align: right; padding: 0 0.5ex;
    1.15 +    width: 8ex; margin-right: 0.5ex;
    1.16 +    content: counter(linenum) ":";
    1.17 +}
    1.18 +</style>
    1.19 +<head>
    1.20 +<body>
    1.21 +<pre>
    1.22 +_BODY_
    1.23 +</pre>
    1.24 +</body>
    1.25 +</html>
     2.1 --- a/s4-funcs.sh	Tue Oct 25 13:11:26 2016 +0859
     2.2 +++ b/s4-funcs.sh	Tue Oct 25 22:42:34 2016 +0859
     2.3 @@ -3361,7 +3361,12 @@
     2.4        case $charset in
     2.5  	ASCII*)	charset=""	;;
     2.6        esac
     2.7 -      ct="text/plain${charset:+; charset=$charset}"
     2.8 +      ct="text/html${charset:+; charset=$charset}"
     2.9 +      cat $bin \
    2.10 +	  | sed 's,^,<span></span>,' \
    2.11 +	  | _m4 -D_TITLE_="$fn" -D_CONTENT_TYPE_="$ct" \
    2.12 +		-D_BODY_="syscmd(\`cat')" $layout/pretty.m4.txt
    2.13 +      exit $?
    2.14        ;;
    2.15    esac
    2.16    contenttype "$ct"