You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							41 lines
						
					
					
						
							1.0 KiB
						
					
					
				
			
		
		
	
	
							41 lines
						
					
					
						
							1.0 KiB
						
					
					
				#!/bin/sh
 | 
						|
 | 
						|
lnr="1"
 | 
						|
 | 
						|
while getopts n opt ; do
 | 
						|
    case "$opt" in
 | 
						|
        n) lnr="0" ;;
 | 
						|
        \-) break ;;
 | 
						|
    esac
 | 
						|
done
 | 
						|
 | 
						|
shift $(expr $OPTIND - 1)
 | 
						|
file=$(mktemp)
 | 
						|
 | 
						|
if [ -z "$2" ] ; then
 | 
						|
    title="No Title"
 | 
						|
else
 | 
						|
    title="$2"
 | 
						|
fi
 | 
						|
 | 
						|
cat > $file
 | 
						|
 | 
						|
vim -nEs $file +"syntax on"                    \
 | 
						|
            +"set t_Co=256 ft=$1 tabstop=4 fileencodings=ucs-bom,utf-8,latin,windows-1252"    \
 | 
						|
            +"colorscheme wombat256_thomasba"  \
 | 
						|
            +"let html_no_progress=1"          \
 | 
						|
            +"let html_use_css=1"              \
 | 
						|
            +"let html_number_lines=$lnr"      \
 | 
						|
            +"let html_use_xhtml=1"            \
 | 
						|
            +"run! syntax/2html.vim"           \
 | 
						|
            +"w! $file.html"                   \
 | 
						|
            +"qall!" &>/dev/null
 | 
						|
 | 
						|
sed -i 's_<title>/tmp/.*</title>_<title>'"$title"'</title>_' $file.html
 | 
						|
sed -i '/^<style type="text\/css">/,/^<\/style>/d' $file.html
 | 
						|
sed -i 's/^<\/head>/<link href="vim.css" type="text\/css" rel="stylesheet"\/>\n<\/head>/' $file.html
 | 
						|
 | 
						|
rm $file
 | 
						|
cat $file.html
 | 
						|
rm $file.html
 |