Created
October 12, 2010 12:52
-
-
Save astanin/622119 to your computer and use it in GitHub Desktop.
Переформатировать код для вставки альбома Яндекс-фоток (поставить ссылки на оригиналы)
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
#!/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|| |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Complementary sed script for similar vim script: http://gist.github.com/488576