Sha256: 8b3b1137941fdb8eed8620a95b4888d102767df41bd4035475f200a5ea0c0542
Contents?: true
Size: 1021 Bytes
Versions: 2
Compression:
Stored size: 1021 Bytes
Contents
module Middleman module Hatenastar class Generator def initialize(option) @token = option[:token] @uri = option[:uri] @title = option[:title] @container = option[:container] @entry_node = option[:entry_node] end def generate(uri: nil, title: nil, container: nil, entry_node: nil) _uri = uri || @uri _title = title || @title _container = container || @container _entry_node = entry_node || @entry_node <<~TAG <script type="text/javascript" src="//s.hatena.ne.jp/js/HatenaStar.js"></script> <script type="text/javascript"> Hatena.Star.Token = '#{@token}'; Hatena.Star.SiteConfig = { entryNodes: { "#{_entry_node}": { uri: "#{_uri}", title: "#{_title}", container: "#{_container}" } } }; </script> TAG end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
middleman-hatenastar-0.2.0 | lib/middleman-hatenastar/generator.rb |
middleman-hatenastar-0.1.0 | lib/middleman-hatenastar/generator.rb |