#!/bin/bash
#简单渲染txt文件

if [ $# -ne 1 ];then
    echo "txt2html [filename]";
    exit 0;
fi

FILE=$1
NAME=${FILE%.*}

sed -e '1i\ <style type="text/css">body{margin:0; text-indent:1em; font-size:18px; background-color:#f5f5f5; font-family: "ubuntu","Tahoma","Microsoft YaHei",Arial,Serif;}</style><body>' -e 's/^/<p>&/g' -e 's/$/<\/p>&/g' -e '$a</body>' ${FILE} > ${NAME}.html
