/web/_plugins/jal.rb

https://bitbucket.org/jlepak/csc-2012-spring · Ruby · 26 lines · 22 code · 4 blank · 0 comment · 0 complexity · 8e4c359aecd5bdea47ef81f884d0021a MD5 · raw file

  1. module Jekyll
  2. class RepoTag < Liquid::Tag
  3. def initialize(tag_name, text, tokens)
  4. super
  5. @text = text
  6. end
  7. def render(context)
  8. "https://bitbucket.org/jlepak/csc-2012-spring/src/default/#{@text}"
  9. end
  10. end
  11. class RepoTagRaw < Liquid::Tag
  12. def initialize(tag_name, text, tokens)
  13. super
  14. @text = text
  15. end
  16. def render(context)
  17. "https://bitbucket.org/jlepak/csc-2012-spring/raw/default/#{@text}"
  18. end
  19. end
  20. end
  21. Liquid::Template.register_tag('repo', Jekyll::RepoTag)
  22. Liquid::Template.register_tag('raw', Jekyll::RepoTagRaw)