Sha256: 8b9945c4e40ea86c322850c4e3d2c7797fb54814c9649c405df28abeb7fc3bdb
Contents?: true
Size: 1.66 KB
Versions: 4
Compression:
Stored size: 1.66 KB
Contents
=begin The MIT License Copyright 2017 Carl Sampson <carl.sampson@gmail.com>. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. =end require 'jekyll-clicky/clicky' CLICKY_CONFIG_KEY = "jekyll_clicky" def inject_script(site) site.site.config[CLICKY_CONFIG_KEY].keys().each{ |a| begin id = site.site.config[CLICKY_CONFIG_KEY][a]["id"] clicky = Clicky.new id site.output = site.output.gsub(/(?=<\/body>)/i, clicky.code()) rescue raise StandardError, "Unable to read clicky id" end } end #for pages and posts inject our code Jekyll::Hooks.register :pages, :post_render do |page| inject_script(page) end Jekyll::Hooks.register :posts, :post_render do |post| inject_script(post) end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
jekyll-clicky-0.1.5 | lib/jekyll-clicky.rb |
jekyll-clicky-0.1.4 | lib/jekyll-clicky.rb |
jekyll-clicky-0.1.3 | lib/jekyll-clicky.rb |
jekyll-clicky-0.1.2 | lib/jekyll-clicky.rb |