jekyll-pants 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 937c218b14420def96bf1b9bfea8ed597435ffb6
4
+ data.tar.gz: 69ab767f91cd8f89636d6f63af0d05351c5c156c
5
+ SHA512:
6
+ metadata.gz: 537a616a5077e5c3f6c73b9e70530bc2c1ff745229ca175071ca9e7cf8c70494eb4b61bedd5ff8c8758be671f20b514bb99899ec662685a3e7e6cf83e6980275
7
+ data.tar.gz: e501349f08242354c6a629ef06e2eae7e0acc3bda4c794a5ef8b1800868582898be2279a305fa1a3a3add05e3b78d16977be4ccfdd4015853464b23d8561f8a9
data/.gitignore ADDED
@@ -0,0 +1,50 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ Gemfile.lock
46
+ .ruby-version
47
+ .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
data/.travis.yml ADDED
@@ -0,0 +1,23 @@
1
+ sudo: false
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.0
6
+ - 2.1
7
+ - 2.2
8
+ matrix:
9
+ include:
10
+ - # GitHub Pages
11
+ rvm: 2.1.1
12
+ env: JEKYLL_VERSION=2.4.0
13
+ - rvm: 1.9.3
14
+ env: JEKYLL_VERSION=2.5
15
+ env:
16
+ matrix:
17
+ - JEKYLL_VERSION=2.5
18
+ - JEKYLL_VERSION=3.0
19
+ - JEKYLL_VERSION=3.2.0.pre.beta1
20
+ install:
21
+ - bundle install
22
+ script:
23
+ - bundle exec rspec
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source "https://rubygems.org"
2
+ gemspec
3
+
4
+ if ENV["JEKYLL_VERSION"]
5
+ gem "jekyll", "~> #{ENV["JEKYLL_VERSION"]}"
6
+ end
7
+
8
+ if RUBY_VERSION >= "2"
9
+ gem "json"
10
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Aron Griffis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # jekyll-pants
2
+
3
+ [![build status](https://img.shields.io/travis/agriffis/jekyll-pants/master.svg?style=plastic)](https://travis-ci.org/agriffis/jekyll-pants?branch=master)
4
+ [![gem](https://img.shields.io/gem/v/jekyll-pants.svg)]()
@@ -0,0 +1,19 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "jekyll-pants"
3
+ spec.summary = "Jekyll plugin to run rubypants on generated HTML"
4
+ spec.version = "0.1.0"
5
+ spec.authors = ["Aron Griffis"]
6
+ spec.email = "aron@scampersand.com"
7
+ spec.homepage = "https://github.com/agriffis/jekyll-pants"
8
+ spec.licenses = ["MIT"]
9
+
10
+ spec.files = `git ls-files -z`.split("\x0")
11
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
12
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
13
+ spec.require_paths = ["lib"]
14
+
15
+ spec.add_runtime_dependency "rubypants"
16
+
17
+ spec.add_development_dependency "jekyll", ">= 2.0"
18
+ spec.add_development_dependency "rspec", "~> 3.0"
19
+ end
@@ -0,0 +1 @@
1
+ require 'jekyll/jekyll-pants'
@@ -0,0 +1,11 @@
1
+ require 'rubypants'
2
+
3
+ module Jekyll
4
+ module PantsFilter
5
+ def pants(input)
6
+ RubyPants.new(input, options=[1]).to_html
7
+ end
8
+ end
9
+ end
10
+
11
+ Liquid::Template.register_filter(Jekyll::PantsFilter)
@@ -0,0 +1,8 @@
1
+ <p>
2
+ Makin&#8217; it purty&#8212;don&#8217;t you think?
3
+ </p>
4
+
5
+ <pre>
6
+ But not this! This shouldn't be pretty--because it's code.
7
+ </pre>
8
+
@@ -0,0 +1,8 @@
1
+ <p>
2
+ It ain't purty--without pants.
3
+ </p>
4
+
5
+ <pre>
6
+ Nor this--it ain't no better.
7
+ </pre>
8
+
@@ -0,0 +1,6 @@
1
+ <p>Makin’ it purty–don’t you think?</p>
2
+
3
+ <div class="highlighter-rouge"><pre class="highlight"><code>But not this! This shouldn't be pretty--because it's code.
4
+ </code></pre>
5
+ </div>
6
+
@@ -0,0 +1,6 @@
1
+ <p>It ain’t purty–without pants.</p>
2
+
3
+ <div class="highlighter-rouge"><pre class="highlight"><code>Nor this--it ain't no better.
4
+ </code></pre>
5
+ </div>
6
+
@@ -0,0 +1,10 @@
1
+ timezone: UTC
2
+
3
+ gems:
4
+ - jekyll-pants
5
+
6
+ defaults:
7
+ -
8
+ scope:
9
+ path: ""
10
+ type: page
@@ -0,0 +1,4 @@
1
+ ---
2
+ ---
3
+
4
+ {{content|pants}}
@@ -0,0 +1,4 @@
1
+ ---
2
+ ---
3
+
4
+ {{content}}
@@ -0,0 +1,11 @@
1
+ ---
2
+ layout: with-pants
3
+ ---
4
+
5
+ <p>
6
+ Makin' it purty--don't you think?
7
+ </p>
8
+
9
+ <pre>
10
+ But not this! This shouldn't be pretty--because it's code.
11
+ </pre>
@@ -0,0 +1,11 @@
1
+ ---
2
+ layout: without-pants
3
+ ---
4
+
5
+ <p>
6
+ It ain't purty--without pants.
7
+ </p>
8
+
9
+ <pre>
10
+ Nor this--it ain't no better.
11
+ </pre>
@@ -0,0 +1,9 @@
1
+ ---
2
+ layout: with-pants
3
+ ---
4
+
5
+ Makin' it purty--don't you think?
6
+
7
+ ```
8
+ But not this! This shouldn't be pretty--because it's code.
9
+ ```
@@ -0,0 +1,9 @@
1
+ ---
2
+ layout: without-pants
3
+ ---
4
+
5
+ It ain't purty--without pants.
6
+
7
+ ```
8
+ Nor this--it ain't no better.
9
+ ```
@@ -0,0 +1,73 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe(Jekyll::PantsFilter) do
6
+ let(:overrides) do
7
+ {
8
+ "source" => source_dir,
9
+ "destination" => dest_dir,
10
+ "url" => "http://example.org",
11
+ }
12
+ end
13
+ let(:config) { Jekyll.configuration(overrides) }
14
+ let(:site) { Jekyll::Site.new(config) }
15
+ before(:each) { site.process }
16
+ let(:html_output) { File.read(dest_dir("html/with-pants.html")) }
17
+ let(:markdown_output) { File.read(dest_dir("markdown/with-pants.html")) }
18
+
19
+ it "makes HTML pretty" do
20
+ expect(html_output).to match /#{Regexp.quote "Makin&#8217; it purty&#8212;don&#8217;t you think?"}/
21
+ expect(html_output).to_not match /Makin'|purty--don|don't/
22
+ end
23
+
24
+ it "preserves HTML pre" do
25
+ expect(html_output).to match /#{Regexp.quote "But not this! This shouldn't be pretty--because it's code."}/
26
+ expect(html_output).to_not match /shouldn\&#8217;t|pretty\&#8212;because/
27
+ end
28
+
29
+ it "preserves kramdown smart quotes" do
30
+ expect(markdown_output).to match /#{Regexp.quote "Makin’ it purty–don’t you think?"}/
31
+ expect(markdown_output).to_not match /Makin'|purty--don|don't/
32
+ end
33
+
34
+ it "preserves code in markdown" do
35
+ expect(markdown_output).to match /#{Regexp.quote "But not this! This shouldn't be pretty--because it's code."}/
36
+ expect(markdown_output).to_not match /shouldn\&#8217;t|pretty\&#8212;because/
37
+ end
38
+
39
+ context "without kramdown smart quotes" do
40
+ let(:config) do
41
+ dumb_kramdown = {"kramdown" => {"smart_quotes" => ["apos", "apos", "quot", "quot"]}}
42
+ Jekyll.configuration(Jekyll::Utils.deep_merge_hashes(overrides, dumb_kramdown))
43
+ end
44
+
45
+ # There's no way to prevent kramdown from replacing dashes, so this ends up
46
+ # being a mix of kramdown dashes (UTF-8) and rubypants entities.
47
+ it "makes markdown pretty" do
48
+ expect(markdown_output).to match /#{Regexp.quote "Makin&#8217; it purty–don&#8217;t you think?"}/
49
+ expect(markdown_output).to_not match /Makin'|purty--don|don't/
50
+ end
51
+ end
52
+
53
+ context "without pants" do
54
+ let(:html_output) { File.read(dest_dir("html/without-pants.html")) }
55
+ let(:markdown_output) { File.read(dest_dir("markdown/without-pants.html")) }
56
+
57
+ it "leaves HTML alone" do
58
+ expect(html_output).to match /#{Regexp.quote "It ain't purty--without pants."}/
59
+ expect(html_output).to_not match /\&/ # no entities
60
+ end
61
+
62
+ it "leaves HTML pre alone" do
63
+ expect(html_output).to match /#{Regexp.quote "Nor this--it ain't no better."}/
64
+ expect(html_output).to_not match /\&/ # no entities
65
+ end
66
+
67
+ it "leaves kramdown smart quotes alone" do
68
+ expect(markdown_output).to match /#{Regexp.quote "It ain’t purty–without pants."}/
69
+ expect(markdown_output).to_not match /ain't purty|purty--without/
70
+ end
71
+ end
72
+
73
+ end
@@ -0,0 +1,21 @@
1
+ require 'jekyll'
2
+ require File.expand_path('../lib/jekyll-pants', File.dirname(__FILE__))
3
+
4
+ Jekyll.logger.log_level = :error
5
+
6
+ RSpec.configure do |config|
7
+ config.run_all_when_everything_filtered = true
8
+ config.filter_run :focus
9
+ config.order = 'random'
10
+
11
+ SOURCE_DIR = File.expand_path("./fixtures", File.dirname(__FILE__))
12
+ DEST_DIR = File.expand_path("./dest", File.dirname(__FILE__))
13
+
14
+ def source_dir(*files)
15
+ File.join(SOURCE_DIR, *files)
16
+ end
17
+
18
+ def dest_dir(*files)
19
+ File.join(DEST_DIR, *files)
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-pants
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Aron Griffis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-07-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubypants
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: jekyll
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description:
56
+ email: aron@scampersand.com
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files: []
60
+ files:
61
+ - ".gitignore"
62
+ - ".travis.yml"
63
+ - Gemfile
64
+ - LICENSE
65
+ - README.md
66
+ - jekyll-pants.gemspec
67
+ - lib/jekyll-pants.rb
68
+ - lib/jekyll/jekyll-pants.rb
69
+ - spec/dest/html/with-pants.html
70
+ - spec/dest/html/without-pants.html
71
+ - spec/dest/markdown/with-pants.html
72
+ - spec/dest/markdown/without-pants.html
73
+ - spec/fixtures/_config.yml
74
+ - spec/fixtures/_layouts/with-pants.html
75
+ - spec/fixtures/_layouts/without-pants.html
76
+ - spec/fixtures/html/with-pants.html
77
+ - spec/fixtures/html/without-pants.html
78
+ - spec/fixtures/markdown/with-pants.md
79
+ - spec/fixtures/markdown/without-pants.md
80
+ - spec/jekyll-pants_spec.rb
81
+ - spec/spec_helper.rb
82
+ homepage: https://github.com/agriffis/jekyll-pants
83
+ licenses:
84
+ - MIT
85
+ metadata: {}
86
+ post_install_message:
87
+ rdoc_options: []
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubyforge_project:
102
+ rubygems_version: 2.4.8
103
+ signing_key:
104
+ specification_version: 4
105
+ summary: Jekyll plugin to run rubypants on generated HTML
106
+ test_files:
107
+ - spec/dest/html/with-pants.html
108
+ - spec/dest/html/without-pants.html
109
+ - spec/dest/markdown/with-pants.html
110
+ - spec/dest/markdown/without-pants.html
111
+ - spec/fixtures/_config.yml
112
+ - spec/fixtures/_layouts/with-pants.html
113
+ - spec/fixtures/_layouts/without-pants.html
114
+ - spec/fixtures/html/with-pants.html
115
+ - spec/fixtures/html/without-pants.html
116
+ - spec/fixtures/markdown/with-pants.md
117
+ - spec/fixtures/markdown/without-pants.md
118
+ - spec/jekyll-pants_spec.rb
119
+ - spec/spec_helper.rb