Skip to content

Instantly share code, notes, and snippets.

@franklincm
Last active August 29, 2015 13:55
Show Gist options
  • Save franklincm/8774825 to your computer and use it in GitHub Desktop.
Save franklincm/8774825 to your computer and use it in GitHub Desktop.
# install fortune
#
# pacman -S fortune-mod
# apt-get install fortune
#
# place in _plugins/
#
# to use:
# {% fortune [args] %}
#
# ex:
# {% fortune -s %}
#
# with fortune-mod-hitchhiker:
#
# {% fortune hitchhiker -s %}
#
module Jekyll
class Fortune < Liquid::Tag
def initialize(tag_name, text, tokens)
super
@text = text
end
def render(context)
fortune = `fortune #{@text}`
"#{fortune}"
end
end
end
Liquid::Template.register_tag('fortune', Jekyll::Fortune)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment