Skip to content

Instantly share code, notes, and snippets.

@yyolk
Forked from mat813/summarize.rb
Created September 7, 2011 07:29
Show Gist options
  • Save yyolk/1199973 to your computer and use it in GitHub Desktop.
Save yyolk/1199973 to your computer and use it in GitHub Desktop.
Jekyll filter for summary text between two <!-- CUT --> tags
module Jekyll
module Filters
def summarize(str, splitstr = /<!-- CUT -->\s(.*)\s<!-- CUT -->/)
splitstr.match(str) do |m|
return m[1]
end
end
end
end
module Jekyll
module Filters
def summarize(str, splitstr = /\s*<div id="extended">/)
str.split(splitstr)[0]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment