Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- filter criticMarkdown from stdin, push result to stdout
- # {++ ++}
- # {-- --}
- # {~~ ~> ~~}
- # {>> <<}
- # {== ==}{>> <<}
- function filter_criticMD() {
- tfile=`mktemp`
- cat <&0 >${tfile}
- IFS=","
- for i in "++,++" "--,--" "~~,~~" ">>,<<" "==,==" ; do
- set -- $i
- # in all lines that contain start before endtag
- # replace tags and comment with nothing
- # in all lines between start and end tag
- # print begining of lines with start tag
- # print remainder of lines with end tag
- # delete the rest
- # all other lines are printed by default
- sed -i -e "/{$1.*$2}/{s/{$1.*$2}/ /}; /{$1/,/$2}/{ /{$1/{s/^\(.*\){$1.*$/\1/;p}; /$2}/{s/^.*$2}\(.*\)$/\1/;p};d }" ${tfile}
- done
- cat ${tfile}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement