octopress-filter-tag 1.0.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: f6bffdee8502cf4d868f79e9e2b1967f5df7b7bf
4
+ data.tar.gz: 093e97d9981da22ddd62d08054fe19e6a5c8d560
5
+ SHA512:
6
+ metadata.gz: f36528465307210d73b49ea28c16857138fc4dc679f5b4b6ba1b1a9792fd5880f133b84d81767ba73613747bc5bdea1275c4886da7ff058de91b49e0982a05c5
7
+ data.tar.gz: 0de7921b8b1e2f4164cdd0eeef874639879965efa559a86288f67c728da963a1f688e512ec6f302b911b303f2420232348fc66868279b01065d87b9661594fd7
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+ _site
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ script: cd test && bundle exec clash
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in octopress_render_tag.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Brandon Mathis
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # Octopress Filter Tag
2
+
3
+ A Liquid block tag which can conditionally filter its content.
4
+
5
+ [![Build Status](https://travis-ci.org/octopress/filter-tag.svg)](https://travis-ci.org/octopress/filter-tag)
6
+ [![Gem Version](http://img.shields.io/gem/v/octopress-filter-tag.svg)](https://rubygems.org/gems/octopress-filter-tag)
7
+ [![License](http://img.shields.io/:license-mit-blue.svg)](http://octopress.mit-license.org)
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'octopress-filter-tag'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install octopress-filter-tag
22
+
23
+ Next add it to your gems list in Jekyll's `_config.yml`
24
+
25
+ gems:
26
+ - octopress-filter-tag
27
+
28
+ ## Usage
29
+
30
+ Syntax:
31
+
32
+ {% filter [filters] %}
33
+ some sort of content
34
+ {% endfilter %}
35
+
36
+ Simple filter usage.
37
+
38
+ {% filter upcase %}
39
+ kittens.
40
+ {% endfilter %}
41
+
42
+ //=> KITTENS.
43
+
44
+ {% filter upcase | replace: "?","!" %}
45
+ kittens??
46
+ {% endfilter %}
47
+
48
+ //=> KITTENS!!
49
+
50
+ Conditional filtering
51
+
52
+ {% assign shouting = true %}
53
+
54
+ {% filter | upcase if shouting %}
55
+ What's going on?
56
+ {% endfilter %}
57
+
58
+ //=> WHAT'S GOING ON?
59
+
60
+
61
+ ## Contributing
62
+
63
+ 1. Fork it ( https://github.com/octopress/filter-tag/fork )
64
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
65
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
66
+ 4. Push to the branch (`git push origin my-new-feature`)
67
+ 5. Create a new Pull Request
68
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,7 @@
1
+ module Octopress
2
+ module Tags
3
+ module FilterTag
4
+ VERSION = "1.0.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,32 @@
1
+ require "octopress-filter-tag/version"
2
+ require "octopress-tag-helpers"
3
+ require "jekyll"
4
+
5
+ module Octopress
6
+ module Tags
7
+ module FilterTag
8
+ class Tag < Liquid::Block
9
+ def initialize(tag_name, markup, tokens)
10
+ super
11
+ unless markup.strip =~ /^\|/
12
+ markup = "| #{markup}"
13
+ end
14
+ @markup = " #{markup}"
15
+ end
16
+
17
+ def render(context)
18
+ content = super.strip
19
+
20
+ return content unless markup = TagHelpers::Conditional.parse(@markup, context)
21
+ if markup =~ TagHelpers::Var::HAS_FILTERS and !content.nil?
22
+ content = TagHelpers::Var.render_filters(content, $2, context)
23
+ end
24
+
25
+ content
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ Liquid::Template.register_tag('filter', Octopress::Tags::FilterTag::Tag)
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'octopress-filter-tag/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "octopress-filter-tag"
8
+ spec.version = Octopress::Tags::FilterTag::VERSION
9
+ spec.authors = ["Brandon Mathis"]
10
+ spec.email = ["brandon@imathis.com"]
11
+ spec.summary = %q{A Liquid block tag which can conditionally filter its content}
12
+ spec.description = %q{A Liquid block tag which can conditionally filter its content}
13
+ spec.homepage = "https://github.com/octopress/filter-tag"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "octopress-tag-helpers", "~> 1.0"
22
+ spec.add_runtime_dependency "jekyll"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.6"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "clash"
27
+ end
data/test/.clash.yml ADDED
@@ -0,0 +1,2 @@
1
+ build: true
2
+ compare: _expected _site
data/test/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'octopress-filter-tag', path: '../'
4
+ gem 'pry-debugger'
5
+ gem 'clash'
data/test/_config.yml ADDED
@@ -0,0 +1,14 @@
1
+ # Site settings
2
+ title: Your awesome title
3
+ email: your-email@domain.com
4
+ baseurl: ""
5
+ url: "http://yourdomain.com"
6
+ timezone: UTC
7
+
8
+ exclude:
9
+ - Gemfile*
10
+
11
+ # Build settings
12
+ markdown: kramdown
13
+ gems:
14
+ - octopress-filter-tag
@@ -0,0 +1,7 @@
1
+ omg → omg
2
+ OMG → OMG
3
+ BOOGIE → BOOGIE
4
+ boogie → boogie
5
+
6
+
7
+ So, I have some priceless artifacts for you.
data/test/index.html ADDED
@@ -0,0 +1,11 @@
1
+ ---
2
+ ---
3
+ omg → {% filter %}omg{% endfilter %}
4
+ OMG → {% filter upcase %}omg{% endfilter %}
5
+ BOOGIE → {% filter upcase if true %} boogie {% endfilter %}
6
+ boogie → {% filter upcase unless true %} boogie {% endfilter %}
7
+
8
+ {% assign appraisal = 'priceless artifacts' %}
9
+ {% filter replace:'junk',appraisal %}
10
+ So, I have some junk for you.
11
+ {% endfilter %}
metadata ADDED
@@ -0,0 +1,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: octopress-filter-tag
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Brandon Mathis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: octopress-tag-helpers
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.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: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: clash
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: A Liquid block tag which can conditionally filter its content
84
+ email:
85
+ - brandon@imathis.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".travis.yml"
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - lib/octopress-filter-tag.rb
97
+ - lib/octopress-filter-tag/version.rb
98
+ - octopress-filter-tag.gemspec
99
+ - test/.clash.yml
100
+ - test/Gemfile
101
+ - test/_config.yml
102
+ - test/_expected/index.html
103
+ - test/index.html
104
+ homepage: https://github.com/octopress/filter-tag
105
+ licenses:
106
+ - MIT
107
+ metadata: {}
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 2.2.2
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: A Liquid block tag which can conditionally filter its content
128
+ test_files:
129
+ - test/.clash.yml
130
+ - test/Gemfile
131
+ - test/_config.yml
132
+ - test/_expected/index.html
133
+ - test/index.html