| #!/bin/bash # convert a text file to html using vim built-in function TOhtml # usage: # toHTML text-files # http://scriptdemo.blogspot.com if [ $# -eq 0 ]; then sed -n '3,4p' `which toHTML` exit else for mytxt in $* do if [ -e ${mytxt} ]; then vim -c 'syntax on|TOhtml' -c 'wq|q!' ${mytxt} else echo "${mytxt} is not found" fi done fi |
Showing posts with label html. Show all posts
Showing posts with label html. Show all posts
Wednesday, June 19, 2013
[Bash] text to html using vim built-in function TOhtml
Monday, January 3, 2011
Post process the html file for blogger using vi script
| "function to post-process the html file created by TOhtml for blogger "copyright @ http://scriptdemo.blogspot.com :if exists("TOblogger_loaded") : delfun TOblogger : delfun RePlaceSpace :endif :function TOblogger() :set nowrap :1,$ call RePlaceSpace() :endfunction :function RePlaceSpace() :let line = getline(".") :if line =~ "^\ " : let line = substitute(line,"^\ ",'\ ',"g") : while line =~ " " : let line = substitute(line,' \ ','\ \ ',"g") : endwhile : call setline(".",line) :endif :unlet line :endfunction :let TOblogger_loaded = 1 |
To use it, you need to open the html file first, then
:source TOblogger.vim #using the path if necessary
:call TOblogger()
and save your new html file using :w
Enjoy!
Subscribe to:
Posts (Atom)