octopress-abort-tag 1.0.0

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: 375fc1f4db28b34fdbc71ad821a209eef311169a
4
+ data.tar.gz: 911b34b3a5adc12944efb008e502419847a89faa
5
+ SHA512:
6
+ metadata.gz: fa72df82cf9a5151931959d10a7abe213dc47f6d1e73b34b9176e35e5acf1fe18cb38a269140d57095db3358be293bdf7416c061c0eeaa4c04cd84e59e22eea8
7
+ data.tar.gz: b7d35ef01f792c63bbb0ec541182b65bea46ebcb5287f52461daa888dca60814e8bdb6e55d9c1f9292c6638f6f70027b154540ba157529161c195a8ea34b2923
@@ -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
@@ -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
@@ -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.
@@ -0,0 +1,49 @@
1
+ # Octopress Abort Tag
2
+
3
+ Conditionally prevent a page from being rendered.
4
+
5
+ [![Build Status](https://travis-ci.org/octopress/abort-tag.svg)](https://travis-ci.org/octopress/abort-tag)
6
+ [![Gem Version](http://img.shields.io/gem/v/octopress-abort-tag.svg)](https://rubygems.org/gems/octopress-abort-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-abort-tag'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install octopress-abort-tag
22
+
23
+ ## Usage
24
+
25
+ Syntax:
26
+
27
+ ```
28
+ {% abort [condition] %}
29
+ ```
30
+
31
+ Prevent a page from being rendered.
32
+
33
+ ```
34
+ {% abort %}
35
+ ```
36
+
37
+ Prevent an index page from being rendered if there are no posts.
38
+
39
+ ```
40
+ {% abort unless site.posts.size > 0 %}
41
+ ```
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it ( https://github.com/octopress/abort-tag/fork )
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 4. Push to the branch (`git push origin my-new-feature`)
49
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,32 @@
1
+ require "octopress-abort-tag/version"
2
+ require "octopress-tag-helpers"
3
+ require "jekyll"
4
+
5
+ module Octopress
6
+ module Tags
7
+ module AbortTag
8
+ class Tag < Liquid::Tag
9
+ def initialize(tag_name, markup, tokens)
10
+ super
11
+ @markup = " #{markup}"
12
+ end
13
+
14
+ def render(context)
15
+ if TagHelpers::Conditional.parse(@markup, context)
16
+ site = context.environments.first['site']
17
+ dest = site['destination']
18
+ env = context.environments.first
19
+ page_dest = File.join(dest, env['page']['url'])
20
+
21
+ context.environments.first['site']['pages'].reject! do |p|
22
+ p.destination(dest) == page_dest
23
+ end
24
+ end
25
+ ''
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ Liquid::Template.register_tag('abort', Octopress::Tags::AbortTag::Tag)
@@ -0,0 +1,7 @@
1
+ module Octopress
2
+ module Tags
3
+ module AbortTag
4
+ VERSION = "1.0.0"
5
+ end
6
+ end
7
+ end
@@ -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-abort-tag/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "octopress-abort-tag"
8
+ spec.version = Octopress::Tags::AbortTag::VERSION
9
+ spec.authors = ["Brandon Mathis"]
10
+ spec.email = ["brandon@imathis.com"]
11
+ spec.summary = %q{Conditionally render a page}
12
+ spec.description = %q{Conditionally render a page}
13
+ spec.homepage = "https://github.com/octopress/abort-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", "~> 2.0"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.6"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "clash"
27
+ end
@@ -0,0 +1,2 @@
1
+ build: true
2
+ compare: _site _expected
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'octopress-abort-tag', path: '../'
4
+ gem 'pry-debugger'
5
+ gem 'clash'
@@ -0,0 +1,13 @@
1
+ # Site settings
2
+ title: Your awesome title
3
+ email: your-email@domain.com
4
+ baseurl: ""
5
+ url: "http://yourdomain.com"
6
+
7
+ exclude:
8
+ - Gemfile*
9
+
10
+ # Build settings
11
+ markdown: kramdown
12
+ gems:
13
+ - octopress-abort-tag
@@ -0,0 +1 @@
1
+ Woohoo
@@ -0,0 +1,2 @@
1
+
2
+ something
@@ -0,0 +1,4 @@
1
+ ---
2
+ ---
3
+
4
+ Woohoo {% abort if false %}
@@ -0,0 +1,4 @@
1
+ ---
2
+ ---
3
+
4
+ {% abort if true %}
@@ -0,0 +1,5 @@
1
+ ---
2
+ ---
3
+
4
+ {% abort if site.title == 'yo' %}
5
+ something
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: octopress-abort-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-08 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: '2.0'
34
+ type: :runtime
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: 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: Conditionally render a page
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-abort-tag.rb
97
+ - lib/octopress-abort-tag/version.rb
98
+ - octopress-abort-tag.gemspec
99
+ - test/.clash.yml
100
+ - test/Gemfile
101
+ - test/_config.yml
102
+ - test/_expected/abort_fase.html
103
+ - test/_expected/abort_var.html
104
+ - test/abort_fase.html
105
+ - test/abort_true.html
106
+ - test/abort_var.html
107
+ homepage: https://github.com/octopress/abort-tag
108
+ licenses:
109
+ - MIT
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.2.2
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: Conditionally render a page
131
+ test_files:
132
+ - test/.clash.yml
133
+ - test/Gemfile
134
+ - test/_config.yml
135
+ - test/_expected/abort_fase.html
136
+ - test/_expected/abort_var.html
137
+ - test/abort_fase.html
138
+ - test/abort_true.html
139
+ - test/abort_var.html