When I blog, sometimes I write in reStructuredText if the post is about technical topic involving programming codes, otherwise I just write in Blogger's editor.
Oftentimes, I was lazy when the post is very short like this one you are reading, so Blogger's editor was. If there is some HTML code or code like
Since I use Pentadactyl (fork of Vimperator), by pressing Ctrl+I, I can use external editor Vim when I need to do some re-indentation or mass replacement using regular expression. If you have done some reviewing on Stack Overflow, you definitely need to take care of a lot re-indentation, some code's spaces or tabs were eaten randomly, mysteriously, by the posters.
I adapted a code from Vim wiki, so I can also do escaping.
Blogger is fine with some situations with characters like
And, yes, I know there is an option to tell Blogger not to interpret HTML code. But who uses that option, I would guess it's someone who doesn't even know what HTML is or never need to paste code into their posts. I am a programmer and I know what I want. For me, if I need italics style, most times, I wrap the text in
Oftentimes, I was lazy when the post is very short like this one you are reading, so Blogger's editor was. If there is some HTML code or code like
a >= b
, I'll have to use escape tool or manually escape by hand.Since I use Pentadactyl (fork of Vimperator), by pressing Ctrl+I, I can use external editor Vim when I need to do some re-indentation or mass replacement using regular expression. If you have done some reviewing on Stack Overflow, you definitely need to take care of a lot re-indentation, some code's spaces or tabs were eaten randomly, mysteriously, by the posters.
I adapted a code from Vim wiki, so I can also do escaping.
" ========================================================================== " HTML Encode/Decode " ========================================================================== " ref: http://vim.wikia.com/wiki/HTML_entities#Perl_HTML::Entities function! HTMLEncode() perl << EOF use HTML::Entities; @pos = $curwin->Cursor(); $line = $curbuf->Get($pos[0]); $encvalue = encode_entities($line); $curbuf->Set($pos[0],$encvalue) EOF endfunction function! HTMLDecode() perl << EOF use HTML::Entities; @pos = $curwin->Cursor(); $line = $curbuf->Get($pos[0]); $encvalue = decode_entities($line); $curbuf->Set($pos[0],$encvalue) EOF endfunction vmap <Leader>h :call HTMLEncode()<CR> vmap <Leader>H :call HTMLDecode()<CR>Only difference is the key mapping, it's most likely I only use escaping in Visual mode, because the code needs to be escaped is only a part of post. Certainly, I would select the part and escape them. If I need to escape the whole file, I can just type
:%call HTMLEncode()
or select all and use the key mapping.Blogger is fine with some situations with characters like
<
or >
, but definitely not HTML or XML element tag, you will have to escape them or it may think you actually want to use those HTML for your post.And, yes, I know there is an option to tell Blogger not to interpret HTML code. But who uses that option, I would guess it's someone who doesn't even know what HTML is or never need to paste code into their posts. I am a programmer and I know what I want. For me, if I need italics style, most times, I wrap the text in
<i/>
by hand, it's much faster than moving mouse cursor to the button.
0 comments:
Post a Comment