# ReadMore.rb # # Scans your entry for and replaces it and everything after it # with a link to the entry's permalink. The full story will be shown when you're # viewing the story through its permalink. # # Requires the permalink handler. # # It also adds $fullbody to the story regardless of wether it actually modifies $body # so that you can reliably access the full contents of your post when this handler is # installed. def cb_story( args ) pathinfo = args['PATH_INFO'] story = args['entry'] body = story['body'] story['fullbody'] = body return if not pathinfo or args.isPermalink?( pathinfo ) r = Regexp::compile( '(.*)(.*)', Regexp::MULTILINE | Regexp::IGNORECASE ) m = r.match( body ) if m content = m[1] + '

(read more)

' % story['permalink'] story['body'] = content story['fullbody'] = body end return end