Skip to content

Instantly share code, notes, and snippets.

@astanin
Created July 24, 2010 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astanin/488576 to your computer and use it in GitHub Desktop.
Save astanin/488576 to your computer and use it in GitHub Desktop.
Скрипт для Vim: Переформатировать код для вставки альбома Яндекс-фоток (поставить ссылки на оригиналы)
" 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
@astanin
Copy link
Author

astanin commented Oct 12, 2010

Complementary sed scrpit: http://gist.github.com/622119

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment