Skip to content

Instantly share code, notes, and snippets.

@astanin
Created October 12, 2010 12:52
Show Gist options
  • Select an option

  • Save astanin/622119 to your computer and use it in GitHub Desktop.

Select an option

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

astanin commented Oct 12, 2010

Copy link
Copy Markdown
Author

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

@astanin

astanin commented Oct 12, 2010

Copy link
Copy Markdown
Author

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

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