Skip to content

Instantly share code, notes, and snippets.

@astanin
Created October 12, 2010 12: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/622119 to your computer and use it in GitHub Desktop.
Save astanin/622119 to your computer and use it in GitHub Desktop.
Переформатировать код для вставки альбома Яндекс-фоток (поставить ссылки на оригиналы)
#!/bin/sed -f
# 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/>|\n\n|g
# add links to original images
s|<img src="\([^"]\+\)\(_[XSML]\{1,2\}.jpg\)"[^>]*>|<a href="\1_orig.jpg" target="_blank">&</a>|g
# remove the first paragraph
s|Фотографии.*на Яндекс.Фотках\n\n||
@astanin
Copy link
Author

astanin commented Oct 12, 2010

Complementary sed script for similar vim script: http://gist.github.com/488576

@astanin
Copy link
Author

astanin commented Oct 12, 2010

Аналогичный vim-скрипт: http://gist.github.com/488576

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