Created
July 24, 2010 09:52
-
-
Save astanin/488576 to your computer and use it in GitHub Desktop.
Скрипт для Vim: Переформатировать код для вставки альбома Яндекс-фоток (поставить ссылки на оригиналы)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Change HTML of Yandex fotki album snippet. | |
" vim: set expandtab ts=4 sw=4 ai si ci: | |
function! FixYandexFotkiSnippet() | |
" remove cuts | |
s#<lj-cut><cut><!--more-->## | |
s#</cut></lj-cut>## | |
" remove wrapping links | |
s#</\?a[^>]*>##g | |
" remove hardcoded border, replace with CSS class | |
s#border="0"#class="whitebg"#g | |
" separate by blank links | |
s#<br/><br/>#\r\r#g | |
" add links to original images | |
%s#<img src="\([^"]\+.jpg\)".*#<a href="\1" target="_blank">&</a># | |
%s#_\(XS\|S\|M\|L\|XL\)#_orig# | |
" remove the first paragraph | |
/Фотографии в альбоме.*/;+1d | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Complementary sed scrpit: http://gist.github.com/622119