jekyll-gist-1.5.0/ 0000755 0000041 0000041 00000000000 13302705610 014000 5 ustar www-data www-data jekyll-gist-1.5.0/.travis.yml 0000644 0000041 0000041 00000000415 13302705610 016111 0 ustar www-data www-data language: ruby
script : script/cibuild
sudo: false
notifications:
email: false
branches:
only:
- master
rvm:
- 2.4
- 2.3
- 2.2
- 2.1
env:
- ""
- JEKYLL_VERSION=3.6.2
matrix:
include:
- # GitHub Pages
rvm: 2.4.0
env: GH_PAGES=true
jekyll-gist-1.5.0/.rspec 0000644 0000041 0000041 00000000032 13302705610 015110 0 ustar www-data www-data --color
--format progress
jekyll-gist-1.5.0/README.md 0000644 0000041 0000041 00000003631 13302705610 015262 0 ustar www-data www-data # Jekyll::Gist
Liquid tag for displaying GitHub Gists in Jekyll sites: `{% gist %}`.
[](https://travis-ci.org/jekyll/jekyll-gist)
## Installation
Add this line to your application's Gemfile:
$ gem 'jekyll-gist'
And then execute:
$ bundle
Or install it yourself as:
$ gem install jekyll-gist
Then add the following to your site's `_config.yml`:
```
plugins:
- jekyll-gist
```
💡 If you are using a Jekyll version less than 3.5.0, use the `gems` key instead of `plugins`.
## Usage
Use the tag as follows in your Jekyll pages, posts and collections:
```liquid
{% gist c08ee0f2726fd0e3909d %}
```
This will create the associated script tag:
```html
```
You may optionally specify a `filename` after the `gist_id`:
```liquid
{% gist c08ee0f2726fd0e3909d test.md %}
```
This will produce the correct URL to show just the specified file in your post rather than the entire Gist.
**Pro-tip**: If you provide a personal access token with Gist scope, as the environmental variable `JEKYLL_GITHUB_TOKEN`, Jekyll Gist will use the Gist API to speed up site generation.
## Disabling `noscript` support
By default, Jekyll Gist will make an HTTP call per Gist to retrieve the raw content of the Gist. This information is used to propagate `noscript` tags for search engines and browsers without Javascript support. If you'd like to disable this feature, for example, to speed up builds locally, add the following to your site's `_config.yml`:
```yml
gist:
noscript: false
```
## 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
jekyll-gist-1.5.0/spec/ 0000755 0000041 0000041 00000000000 13302705610 014732 5 ustar www-data www-data jekyll-gist-1.5.0/spec/gist_tag_spec.rb 0000644 0000041 0000041 00000015350 13302705610 020076 0 ustar www-data www-data require "spec_helper"
describe(Jekyll::Gist::GistTag) do
let(:http_output) { "true" }
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
before(:each) { ENV["JEKYLL_GITHUB_TOKEN"] = nil }
context "valid gist" do
context "with user prefix" do
before { stub_request(:get, "https://gist.githubusercontent.com/#{gist}/raw").to_return(:body => http_output) }
let(:gist) { "mattr-/24081a1d93d2898ecf0f" }
it "produces the correct script tag" do
expect(output).to match(%r!"
end
def gist_noscript_tag(gist_id, filename = nil)
return if @settings && @settings["noscript"] == false
code = fetch_raw_code(gist_id, filename)
if !code.nil?
code = code.force_encoding(@encoding)
code = CGI.escapeHTML(code)
# CGI.escapeHTML behavior differs in Ruby < 2.0
# See https://github.com/jekyll/jekyll-gist/pull/28
code = code.gsub("'", "'") if RUBY_VERSION < "2.0"
""
else
Jekyll.logger.warn "Warning:", "The