jekyll-gist-1.1.0/ 0000755 0001750 0001750 00000000000 12366131467 013614 5 ustar uwabami uwabami jekyll-gist-1.1.0/.rspec 0000644 0001750 0001750 00000000032 12366131467 014724 0 ustar uwabami uwabami --color
--format progress
jekyll-gist-1.1.0/.gitignore 0000644 0001750 0001750 00000000271 12366131467 015604 0 ustar uwabami uwabami *.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.markdown 0000644 0001750 0001750 00000000232 12366131467 017016 0 ustar uwabami uwabami ## 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.txt 0000644 0001750 0001750 00000002055 12366131467 015441 0 ustar uwabami uwabami Copyright (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.gz 0000444 0001750 0001750 00000000417 12366131467 017104 0 ustar uwabami uwabami Se9r[ADs`0S'2pDȧB9C{<_??yWtϻvYg,Xulcyq_+>8G{ ahwޭ_%VY䮙\:#1H;gZeEn{WCƚ8z_+Q nNr;< C֫4C[7aMPOt'$&Ehұ+'ar)VdWuTp jekyll-gist-1.1.0/jekyll-gist.gemspec 0000644 0001750 0001750 00000001663 12366131467 017425 0 ustar uwabami uwabami # 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/ 0000755 0001750 0001750 00000000000 12366131467 014362 5 ustar uwabami uwabami jekyll-gist-1.1.0/lib/jekyll-gist/ 0000755 0001750 0001750 00000000000 12366131467 016620 5 ustar uwabami uwabami jekyll-gist-1.1.0/lib/jekyll-gist/gist_tag.rb 0000644 0001750 0001750 00000002177 12366131467 020755 0 ustar uwabami uwabami module 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.rb 0000644 0001750 0001750 00000000074 12366131467 020633 0 ustar uwabami uwabami module Jekyll
module Gist
VERSION = "1.1.0"
end
end
jekyll-gist-1.1.0/lib/jekyll-gist.rb 0000644 0001750 0001750 00000000144 12366131467 017144 0 ustar uwabami uwabami require "jekyll-gist/version"
require "jekyll-gist/gist_tag"
module Jekyll
module Gist
end
end
jekyll-gist-1.1.0/metadata.yml 0000644 0001750 0001750 00000005126 12366131467 016123 0 ustar uwabami uwabami --- !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/Rakefile 0000644 0001750 0001750 00000000035 12366131467 015257 0 ustar uwabami uwabami require "bundler/gem_tasks"
jekyll-gist-1.1.0/spec/ 0000755 0001750 0001750 00000000000 12366131467 014546 5 ustar uwabami uwabami jekyll-gist-1.1.0/spec/spec_helper.rb 0000644 0001750 0001750 00000002127 12366131467 017366 0 ustar uwabami uwabami TEST_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.rb 0000644 0001750 0001750 00000003061 12366131467 017706 0 ustar uwabami uwabami require '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