jekyll-truthyfalsy 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
+ SHA256:
3
+ metadata.gz: ce20b2ad4b91bbcae45e649b66cb31506e7c9f2b9ca1d1bd3fd29b7132a54980
4
+ data.tar.gz: 5b9c9746e46603ea6393f026b9f2eb5da1114bd49f341d816b178b5bf90c44ac
5
+ SHA512:
6
+ metadata.gz: 16c6dc347856c809dee82994c644a5bd55b1558fa8a280ae89458ca9d9675fe1405c2122f103c31e3ae9f0afb9c362293cf96e38af5f424cfcfc82644219819b
7
+ data.tar.gz: 607519dad1b36fc87a045b83684c9abc84e2d3512366d980618869d6908a22f159589d7bb96730dbafffe9896e3d10d2f0433b2b27a2719e278ca57f93eb446a
data/README.md ADDED
@@ -0,0 +1,84 @@
1
+ <p align="center">
2
+ <a href="https://cdn.itwcreativeworks.com/assets/itw-creative-works/images/logo/itw-creative-works-brandmark-black-x.svg">
3
+ <img src="https://cdn.itwcreativeworks.com/assets/itw-creative-works/images/logo/itw-creative-works-brandmark-black-x.svg" width="100px">
4
+ </a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <img src="https://img.shields.io/gem/v/jekyll-truthyfalsy">
9
+ <br>
10
+ <!-- <img src="https://img.shields.io/librariesio/release/npm/jekyll-truthyfalsy.svg"> -->
11
+ <img src="https://img.shields.io/github/repo-size/itw-creative-works/jekyll-truthyfalsy">
12
+ <img src="https://img.shields.io/codeclimate/maintainability-percentage/itw-creative-works/jekyll-truthyfalsy.svg">
13
+ <img src="https://img.shields.io/gem/dt/jekyll-truthyfalsy">
14
+ <!-- <img src="https://img.shields.io/node/v/jekyll-truthyfalsy.svg"> -->
15
+ <img src="https://img.shields.io/website/https/itwcreativeworks.com.svg">
16
+ <img src="https://img.shields.io/github/license/itw-creative-works/jekyll-truthyfalsy.svg">
17
+ <img src="https://img.shields.io/github/contributors/itw-creative-works/jekyll-truthyfalsy.svg">
18
+ <img src="https://img.shields.io/github/last-commit/itw-creative-works/jekyll-truthyfalsy.svg">
19
+ <br>
20
+ <br>
21
+ <a href="https://itwcreativeworks.com">Site</a> | <a href="https://www.npmjs.com/package/jekyll-truthyfalsy">NPM Module</a> | <a href="https://github.com/itw-creative-works/jekyll-truthyfalsy">GitHub Repo</a>
22
+ <br>
23
+ <br>
24
+ Meet <strong>jekyll-truthyfalsy</strong>, the Sherlock Holmes of truthy and falsy values in Liquid.
25
+ </p>
26
+
27
+ ## jekyll-truthyfalsy Works in Node AND browser environments
28
+ Yes, this module works in both Node and browser environments, including compatibility with [Webpack](https://www.npmjs.com/package/webpack) and [Browserify](https://www.npmjs.com/package/browserify)!
29
+
30
+ ## Features
31
+ * Check whether a value is **truthy** or **falsy** in a manner similar to JavaScript
32
+ * Exposes a `istruthy` function
33
+ * Exposes a `isfalsy` function
34
+
35
+ # Jekyll::truthyfalsy
36
+
37
+ Meet `jekyll-truthyfalsy`, the whimsical gem dedicated to turning the grey areas of truthiness and falsiness into black and white.
38
+
39
+ It doesn't just settle for mere booleans; oh no, it goes above and beyond, scrutinizing empty strings and null values too! Like a tenacious detective, it leaves no stone unturned, and no value unverified. Banish the verbose 'if' statements and welcome a new era of compact, expressive checks.
40
+
41
+ Because life is too short for ambiguity, embrace the certainty that comes with `jekyll-truthyfalsy`. Truthiness and falsiness: not just a philosophical quandary, but a .gem installation away!
42
+
43
+ ## Installation
44
+
45
+ Install the gem and add to the application's Gemfile by executing:
46
+ ```shell
47
+ $ bundle add jekyll-truthyfalsy
48
+ ```
49
+
50
+ If bundler is not being used to manage dependencies, install the gem by executing:
51
+ ```shell
52
+ $ gem install jekyll-truthyfalsy
53
+ ```
54
+
55
+ ## Usage
56
+ Now you can use the istruthy and isfalsy filters in your Jekyll site's templates:
57
+
58
+ ```liquid
59
+ {% if page.title | istruthy %}
60
+ <h1>{{ page.title }}</h1>
61
+ {% else %}
62
+ <h1>Untitled</h1>
63
+ {% endif %}
64
+
65
+ {% if page.description | isfalsy %}
66
+ <p>No description available</p>
67
+ {% else %}
68
+ <p>{{ page.description }}</p>
69
+ {% endif %}
70
+ ```
71
+
72
+ These examples show how you can use `istruthy` and `isfalsy` to easily check if a variable is "truthy" (not null, not an empty string, and not false) or "falsy" (null, an empty string, or false), respectively.
73
+
74
+ No more long, confusing, multi-condition 'if' statements - just simple, readable code!
75
+
76
+ ## Development
77
+
78
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
79
+
80
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
81
+
82
+ ## Contributing
83
+
84
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jekyll-truthyfalsy.
@@ -0,0 +1,13 @@
1
+ module Jekyll
2
+ module IstruthyFalsyFilter
3
+ def istruthy(input)
4
+ !(input.nil? || input == '' || input == false)
5
+ end
6
+
7
+ def isfalsy(input)
8
+ input.nil? || input == '' || input == false
9
+ end
10
+ end
11
+ end
12
+
13
+ Liquid::Template.register_filter(Jekyll::IstruthyFalsyFilter)
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-truthyfalsy
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - ITW Creative Works
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-06-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ description: A simple Jekyll plugin that adds JavaScript-like istruthy and isfalsy
34
+ filters to Liquid
35
+ email:
36
+ - hello@itwcreativeworks.com
37
+ executables: []
38
+ extensions: []
39
+ extra_rdoc_files: []
40
+ files:
41
+ - README.md
42
+ - lib/jekyll/filters/truthyfalsy.rb
43
+ homepage: https://github.com/itw-creative-works/jekyll-truthyfalsy
44
+ licenses:
45
+ - MIT
46
+ metadata: {}
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 2.6.0
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubygems_version: 3.2.3
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: A Jekyll plugin that adds JavaScript-like truthy and falsy checks
66
+ test_files: []