jekyll-liquify 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e80eb9009967ace3d3ff381e5c23d51dd09e8312
4
+ data.tar.gz: c0425aa10482444e60bc7224689ace636ac1e289
5
+ SHA512:
6
+ metadata.gz: 0ad26069b47cae267daf50a819bc154618e41868edd8574edc5514386014d412c18f2bb6f80e862f754a89916e838add207897d04d66fb89c55c1cfe6ed524c8
7
+ data.tar.gz: 01ecce03f82116ca59dec9c036d24d617cfc154e4545298ea4c858f44db90264186ef7e716d26ac9f35ea5d9307a772d352ba3457f40ee0242742428fe601b9c
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ Gemfile.lock
3
+ spec/dest
4
+ .bundle
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1
4
+ - 2.0
5
+ - 1.9.3
6
+ script: "script/cibuild"
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,34 @@
1
+ This project includes a mix of the following:
2
+
3
+ * Open source works that are not in the public domain
4
+ * Open source work by the U.S. government that is in the public domain
5
+
6
+ ## Parts of this project that are not in the public domain
7
+
8
+ This site is based on the Draft U.S. Web Design Standards (WDS), which also includes works under the SIL Open Font License, MIT license, and public domain. Files from the WDS are in `_sass/_libs/wds/`, and the full license details for those assets are described in the [WDS license file](https://github.com/18F/web-design-standards/blob/staging/LICENSE.md).
9
+
10
+ This site also includes a number of images that have various copyright statuses, including Creative Commons licenses and public domain. These images are in the `assets` directory, and license details are available on the posts and pages that display the images.
11
+
12
+ ## The rest of this project is in the worldwide public domain
13
+
14
+ As a work of the United States government, this project is in the public domain within the United States.
15
+
16
+ Additionally, we waive copyright and related rights in the work worldwide through the [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/).
17
+
18
+ ### CC0 1.0 Universal Summary
19
+
20
+ This is a human-readable summary of the
21
+ [Legal Code (read the full text)](https://creativecommons.org/publicdomain/zero/1.0/legalcode).
22
+
23
+ #### No copyright
24
+
25
+ The person who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law.
26
+
27
+ You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
28
+
29
+ #### Other information
30
+
31
+ In no way are the patent or trademark rights of any person affected by CC0, nor are the rights that other persons may have in the work or in how the work is used, such as publicity or privacy rights.
32
+
33
+ Unless expressly stated otherwise, the person who associated a work with this deed makes no warranties about the work, and disclaims liability for all uses of the work, to the fullest extent permitted by applicable law. When using or citing the work, you should not imply endorsement by the author or the affirmer.
34
+
@@ -0,0 +1,30 @@
1
+ # Jekyll Liquify
2
+
3
+ *A Jekyll filter that can parse Liquid in front matter
4
+ *
5
+
6
+ [![Gem Version](https://img.shields.io/gem/v/jekyll-liquify.svg)](https://rubygems.org/gems/jekyll-liquify)
7
+ [![Build Status](https://img.shields.io/travis/gemfarmer/jekyll-liquify/master.svg)](https://travis-ci.org/gemfarmer/jekyll-liquify)
8
+ [![Dependency Status](https://img.shields.io/gemnasium/gemfarmer/jekyll-liquify.svg)](https://gemnasium.com/gemfarmer/jekyll-liquify)
9
+
10
+ ## Usage
11
+
12
+ 1. Add `gem 'jekyll-liquify'` to your site's Gemfile and run `bundle`
13
+ 2. Add the following to your site's `_config.yml`:
14
+
15
+ ```yml
16
+ gems:
17
+ - jekyll-liquify
18
+ ```
19
+
20
+ ## Testing
21
+
22
+ 1. `script/bootstrap`
23
+ 2. `script/cibuild`
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork the project
28
+ 2. Create a descriptively named feature branch
29
+ 3. Add your feature
30
+ 4. Submit a pull request
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "jekyll-liquify"
5
+ spec.summary = "A Jekyll filter that can parse Liquid in front matter."
6
+ spec.version = "0.0.1"
7
+ spec.authors = ["Brian Hedberg"]
8
+ spec.email = "briansheahedberg@gmail.com"
9
+ spec.homepage = "https://github.com/gemfarmer/jekyll-liquify"
10
+ spec.licenses = ["MIT"]
11
+
12
+ spec.files = `git ls-files -z`.split("\x0")
13
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
14
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.require_paths = ["lib"]
16
+
17
+ spec.add_runtime_dependency "redcarpet", "~> 3.1"
18
+ spec.add_runtime_dependency "liquid", [">= 2.5", "< 4.0"]
19
+
20
+ spec.add_development_dependency "jekyll", [">= 2.0", "< 4.0"]
21
+ spec.add_development_dependency "rspec", "~> 3.0"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "bundler", "~> 1.6"
24
+ end
@@ -0,0 +1,9 @@
1
+ require 'redcarpet'
2
+
3
+ module LiquidFilter
4
+ def liquify(input)
5
+ Liquid::Template.parse(input).render(@context)
6
+ end
7
+ end
8
+
9
+ Liquid::Template.register_filter(LiquidFilter)
@@ -0,0 +1,3 @@
1
+ #! /bin/bash
2
+
3
+ bundle install
@@ -0,0 +1,3 @@
1
+ #! /bin/bash
2
+
3
+ bundle exec rspec
@@ -0,0 +1,34 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ def relative_to_root(path)
4
+ File.expand_path(path, File.dirname(File.dirname(__FILE__)))
5
+ end
6
+
7
+ require 'jekyll'
8
+ require relative_to_root('lib/jekyll-liquify.rb')
9
+ require 'pry-debugger'
10
+
11
+ SOURCE_DIR = relative_to_root('spec/fixtures')
12
+ DEST_DIR = relative_to_root('spec/dest')
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
+
22
+ def config(overrides = {})
23
+ Jekyll.configuration({
24
+ "source" => source_dir,
25
+ "destination" => dest_dir,
26
+ "url" => "http://example.org"
27
+ }).merge(overrides)
28
+ end
29
+
30
+ def site(configuration = config)
31
+ Jekyll::Site.new(configuration)
32
+ end
33
+
34
+ binding.pry
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+ # Tag and push a release.
3
+
4
+ set -e
5
+
6
+ script/cibuild
7
+ bundle exec rake release
@@ -0,0 +1,9 @@
1
+ timezone: UTC
2
+
3
+ defaults:
4
+ -
5
+ scope:
6
+ path: ""
7
+ type: page
8
+ values:
9
+ layout: some_default
@@ -0,0 +1,8 @@
1
+ ---
2
+
3
+ ---
4
+
5
+ Using `liquify`: {{ page.with_filter | liquify }}
6
+ Without using `liquify`: {{ page.without_filter }}
7
+ Using `markdownify` first: {{ page.markdownify_first | markdownify | liquify }}
8
+ Using `markdownify` second: {{ page.markdownify_second | liquify | markdownify }}
@@ -0,0 +1,10 @@
1
+ ---
2
+ first_president: George Washington
3
+ second_president: John Adams
4
+ google_link: "**Hello**"
5
+ with_filter: "The first president of the United States was {{ page.first_president }}."
6
+ without_filter: The second president of the United States was {{ page.second_president }}.
7
+ markdownify_first: Google's URL is {{ page.google_link }}
8
+ markdownify_second: Visit google at {{ page.google_link }}
9
+ ---
10
+
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ describe(Jekyll) do
4
+ let(:overrides) do
5
+ {
6
+ "source" => source_dir,
7
+ "destination" => dest_dir,
8
+ "url" => "http://example.org",
9
+ }
10
+ end
11
+ let(:config) do
12
+ Jekyll.configuration(overrides)
13
+ end
14
+ let(:site) { Jekyll::Site.new(config) }
15
+ let(:contents) { File.read(dest_dir("index.html")) }
16
+
17
+ before(:each) do
18
+ site.process
19
+ end
20
+
21
+ context 'the `liquify` filter is used' do
22
+ it "parses Liquid in the front matter" do
23
+ expect(contents).to match /The first president of the United States was George Washington./
24
+ expect(contents).to_not match /The first president of the United States was {{ page.first_president }}./
25
+ end
26
+ end
27
+
28
+ context 'the `liquify` filter is not used' do
29
+ it "does not parse Liquid in the front matter" do
30
+ expect(contents).to match /The second president of the United States was {{ page.second_president }}./
31
+ expect(contents).to_not match /The second president of the United States was John Adams./
32
+ end
33
+ end
34
+
35
+ context "it is used in conjunction with the `markdownify` filter" do
36
+ it 'works with markdownify first' do
37
+ expect(contents).to match /Google’s URL is \*\*Hello\*\*/
38
+ end
39
+
40
+ it 'does not work with markdownify second' do
41
+ expect(contents).to match /Visit google at <strong>Hello<\/strong>/
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,21 @@
1
+ require 'jekyll'
2
+ require File.expand_path('../lib/jekyll-liquify', 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__)
12
+ DEST_DIR = File.expand_path("../dest", __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,161 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-liquify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Brian Hedberg
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-08-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: redcarpet
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: liquid
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '2.5'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '4.0'
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '2.5'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '4.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: jekyll
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '2.0'
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: '4.0'
57
+ type: :development
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '2.0'
64
+ - - "<"
65
+ - !ruby/object:Gem::Version
66
+ version: '4.0'
67
+ - !ruby/object:Gem::Dependency
68
+ name: rspec
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '3.0'
74
+ type: :development
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '3.0'
81
+ - !ruby/object:Gem::Dependency
82
+ name: rake
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: bundler
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '1.6'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: '1.6'
109
+ description:
110
+ email: briansheahedberg@gmail.com
111
+ executables: []
112
+ extensions: []
113
+ extra_rdoc_files: []
114
+ files:
115
+ - ".gitignore"
116
+ - ".travis.yml"
117
+ - Gemfile
118
+ - LICENSE
119
+ - README.md
120
+ - Rakefile
121
+ - jekyll-liquify.gemspec
122
+ - lib/jekyll-liquify.rb
123
+ - script/bootstrap
124
+ - script/cibuild
125
+ - script/console
126
+ - script/release
127
+ - spec/fixtures/_config.yml
128
+ - spec/fixtures/_layouts/some_default.html
129
+ - spec/fixtures/index.html
130
+ - spec/jekyll-liquify_spec.rb
131
+ - spec/spec_helper.rb
132
+ homepage: https://github.com/gemfarmer/jekyll-liquify
133
+ licenses:
134
+ - MIT
135
+ metadata: {}
136
+ post_install_message:
137
+ rdoc_options: []
138
+ require_paths:
139
+ - lib
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ required_rubygems_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ requirements: []
151
+ rubyforge_project:
152
+ rubygems_version: 2.6.8
153
+ signing_key:
154
+ specification_version: 4
155
+ summary: A Jekyll filter that can parse Liquid in front matter.
156
+ test_files:
157
+ - spec/fixtures/_config.yml
158
+ - spec/fixtures/_layouts/some_default.html
159
+ - spec/fixtures/index.html
160
+ - spec/jekyll-liquify_spec.rb
161
+ - spec/spec_helper.rb