Google Blogger/Blogspot new line conversion
Google blogger/blogspot provides an option to let users decide whether hard-returns in the post are converted to <br/>
Set it by clicking: Your blog admin page –> Settings -> Formatting -> Convert line breaks
Originally, I set it to "yes". Latter I decided to manually insert <br/> instead of using automatical hard-return conversion. So I set the option to "no". As a result, my previous posts were messed up because different lines were concatenated into a single line.
I used vim to convert those posts to new format.
Append <br/> to each line %s/$/<br\/>/g
Sometimes, you don't want to append new lines to block-level elements such as div
, ol
.
Use following vim commands:
%s/\(<\/div>\s*\)\@<!$/<br\/>/g %s/\(<\/ul>\s*\)\@<!$/<br\/>/g %s/\(<\/ol>\s*\)\@<!$/<br\/>/g %s/\(<\/dl>\s*\)\@<!$/<br\/>/g ......
Vim regular expression: http://vimdoc.sourceforge.net/htmldoc/pattern.html#pattern-overview
Another option is to write a script to download posts, adjust returns/newlines, and publish them.
No comments:
Post a Comment