jekyll-gist-1.1.0/0000755000175000017500000000000012366131467013614 5ustar uwabamiuwabamijekyll-gist-1.1.0/.rspec0000644000175000017500000000003212366131467014724 0ustar uwabamiuwabami--color --format progress jekyll-gist-1.1.0/.gitignore0000644000175000017500000000027112366131467015604 0ustar uwabamiuwabami*.gem *.rbc .bundle .config .yardoc Gemfile.lock InstalledFiles _yardoc coverage doc/ lib/bundler/man pkg rdoc spec/reports test/tmp test/version_tmp tmp *.bundle *.so *.o *.a mkmf.log jekyll-gist-1.1.0/History.markdown0000644000175000017500000000023212366131467017016 0ustar uwabamiuwabami## HEAD ## 1.1.0 / 2014-06-18 ### Minor Enhancements * Update regex to allow for new sha-ish ids in Gist. (#1) ## 1.0.0 / 2014-06-01 * Birthday! jekyll-gist-1.1.0/LICENSE.txt0000644000175000017500000000205512366131467015441 0ustar uwabamiuwabamiCopyright (c) 2014 Parker Moore MIT License 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. jekyll-gist-1.1.0/checksums.yaml.gz0000444000175000017500000000041712366131467017104 0ustar uwabamiuwabamiSe9r[A Ds `0S'2pDȧB9C{<_??yWtϻvYg,Xulcyq_+>8G{ ahw ޭ_%VY䮙\:#1H;gZeEn{WCƚ8z_+Q nNr;< C֫4C[7aMPOt'$&Ehұ+'a׵r)VdWuTpjekyll-gist-1.1.0/jekyll-gist.gemspec0000644000175000017500000000166312366131467017425 0ustar uwabamiuwabami# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'jekyll-gist/version' Gem::Specification.new do |spec| spec.name = "jekyll-gist" spec.version = Jekyll::Gist::VERSION spec.authors = ["Parker Moore"] spec.email = ["parkrmoore@gmail.com"] spec.summary = %q{Liquid tag for displaying GitHub Gists in Jekyll sites.} spec.homepage = "https://github.com/jekyll/jekyll-gist" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake" spec.add_development_dependency "rspec" spec.add_development_dependency "jekyll", "~> 2.0" end jekyll-gist-1.1.0/lib/0000755000175000017500000000000012366131467014362 5ustar uwabamiuwabamijekyll-gist-1.1.0/lib/jekyll-gist/0000755000175000017500000000000012366131467016620 5ustar uwabamiuwabamijekyll-gist-1.1.0/lib/jekyll-gist/gist_tag.rb0000644000175000017500000000217712366131467020755 0ustar uwabamiuwabamimodule Jekyll module Gist class GistTag < Liquid::Tag def render(context) if tag_contents = determine_arguments(@markup.strip) gist_id, filename = tag_contents[0], tag_contents[1] gist_script_tag(gist_id, filename) else raise ArgumentError.new <<-eos Syntax error in tag 'gist' while parsing the following markup: #{@markup} Valid syntax: {% gist user/1234567 %} {% gist user/1234567 foo.js %} {% gist 28949e1d5ee2273f9fd3 %} {% gist 28949e1d5ee2273f9fd3 best.md %} eos end end private def determine_arguments(input) matched = input.match(/\A([\S]+|.*(?=\/).+)\s?(\S*)\Z/) [matched[1].strip, matched[2].strip] if matched && matched.length >= 3 end def gist_script_tag(gist_id, filename = nil) if filename.empty? "" else "" end end end end end Liquid::Template.register_tag('gist', Jekyll::Gist::GistTag) jekyll-gist-1.1.0/lib/jekyll-gist/version.rb0000644000175000017500000000007412366131467020633 0ustar uwabamiuwabamimodule Jekyll module Gist VERSION = "1.1.0" end end jekyll-gist-1.1.0/lib/jekyll-gist.rb0000644000175000017500000000014412366131467017144 0ustar uwabamiuwabamirequire "jekyll-gist/version" require "jekyll-gist/gist_tag" module Jekyll module Gist end end jekyll-gist-1.1.0/metadata.yml0000644000175000017500000000512612366131467016123 0ustar uwabamiuwabami--- !ruby/object:Gem::Specification name: jekyll-gist version: !ruby/object:Gem::Version version: 1.1.0 platform: ruby authors: - Parker Moore autorequire: bindir: bin cert_chain: [] date: 2014-06-18 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: bundler requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '1.6' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '1.6' - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: rspec requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: jekyll requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '2.0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '2.0' description: email: - parkrmoore@gmail.com executables: [] extensions: [] extra_rdoc_files: [] files: - ".gitignore" - ".rspec" - Gemfile - History.markdown - LICENSE.txt - README.md - Rakefile - jekyll-gist.gemspec - lib/jekyll-gist.rb - lib/jekyll-gist/gist_tag.rb - lib/jekyll-gist/version.rb - spec/gist_tag_spec.rb - spec/spec_helper.rb homepage: https://github.com/jekyll/jekyll-gist licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.2.2 signing_key: specification_version: 4 summary: Liquid tag for displaying GitHub Gists in Jekyll sites. test_files: - spec/gist_tag_spec.rb - spec/spec_helper.rb jekyll-gist-1.1.0/Rakefile0000644000175000017500000000003512366131467015257 0ustar uwabamiuwabamirequire "bundler/gem_tasks" jekyll-gist-1.1.0/spec/0000755000175000017500000000000012366131467014546 5ustar uwabamiuwabamijekyll-gist-1.1.0/spec/spec_helper.rb0000644000175000017500000000212712366131467017366 0ustar uwabamiuwabamiTEST_DIR = File.dirname(__FILE__) TMP_DIR = File.expand_path("../tmp", TEST_DIR) require 'jekyll' require File.expand_path("../lib/jekyll-gist.rb", TEST_DIR) Jekyll.logger.log_level = :error STDERR.reopen(test(?e, '/dev/null') ? '/dev/null' : 'NUL:') RSpec.configure do |config| config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus config.order = 'random' def tmp_dir(*files) File.join(TMP_DIR, *files) end def source_dir(*files) tmp_dir('source', *files) end def dest_dir(*files) tmp_dir('dest', *files) end def doc_with_content(content, opts = {}) my_site = site Jekyll::Document.new(source_dir('_test/doc.md'), {site: my_site, collection: collection(my_site)}) end def collection(site, label = 'test') Jekyll::Collection.new(site, label) end def site(opts = {}) conf = Jekyll::Utils.deep_merge_hashes(Jekyll::Configuration::DEFAULTS, opts.merge({ "source" => source_dir, "destination" => dest_dir })) Jekyll::Site.new(conf) end end jekyll-gist-1.1.0/spec/gist_tag_spec.rb0000644000175000017500000000306112366131467017706 0ustar uwabamiuwabamirequire 'spec_helper' describe(Jekyll::Gist::GistTag) do let(:doc) { doc_with_content(content) } let(:content) { "{% gist #{gist} %}" } let(:output) do doc.content = content doc.output = Jekyll::Renderer.new(doc.site, doc).run end context "valid gist" do context "with user prefix" do let(:gist) { "mattr-/24081a1d93d2898ecf0f" } it "produces the correct script tag" do expect(output).to match(/ ``` You may optionally specify a `filename` after the `gist_id`: ```liquid {% gist parkr/c08ee0f2726fd0e3909d test.md %} ``` This will produce the correct URL to show just the specified file in your post rather than the entire Gist. ## Contributing 1. Fork it ( https://github.com/jekyll/jekyll-gist/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create a new Pull Request