jekyll-web_monetization 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a26bb61c7ad97c32462eff966235ee259b18fe851c0ddc68ea9dd395609dc794
4
- data.tar.gz: '0213983c7ff52d7fbf830bf7d31a27c55efdd7a0015ee0370c145e05d37466f1'
3
+ metadata.gz: cb404e9e9e1084c07cf05d07d9e967c99754bd01dbfdb116f946b707b452435a
4
+ data.tar.gz: f5a6eb905cea2c627182a30394bb3836179c8b38d5b4b30b548a2f6266f4d280
5
5
  SHA512:
6
- metadata.gz: 8bcb264668de2d62b92ff8ea951b5816f4b506dcb3caeda80395fe1fe114a27235f6691baf2701edbb3567de81b1d2d4ab2614125d57d3071637fe81cf31c31a
7
- data.tar.gz: 93fc971c1ebf79afa4a3448505dddbe8258193221c8d3ca94518896b791bd7c7a828891a5b7ff470039f370c80683444b3d268875f86b26e0a315e04fb3ac838
6
+ metadata.gz: 48be3b374d73a1e6ce9a5149781f9346272d87ffa282e18b2bf52f7d1e8d4d08d511c095c349f20ff279178692adbdce0dabb800b4b552bd237d46eb310e849c
7
+ data.tar.gz: 2c10b5c4cd28b61508903ef1c31d33623c7bd58d3efd8db3605ef3db69b5359f394c17e3aa1d10294a6b16be5f2c64df86cf120c4dea99ce79f34f80d0187808
data/.editorconfig ADDED
@@ -0,0 +1,13 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
10
+ spaces_around_operators = true
11
+
12
+ [*.md]
13
+ trim_trailing_whitespace = false
@@ -0,0 +1,25 @@
1
+ name: tests
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby: [2.5, 2.6, 2.7, "3.0", 3.1, head]
12
+ jekyll: ["~> 4.0", "~> 3.0"]
13
+ continue-on-error: ${{ endsWith(matrix.ruby, 'head') }}
14
+ env:
15
+ JEKYLL_VERSION: ${{ matrix.jekyll }}
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - name: Set up Ruby ${{ matrix.ruby }}
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+ - name: "Install dependencies (Jekyll: ${{matrix.jekyll}})"
23
+ run: bundle install
24
+ - name: Run tests
25
+ run: bundle exec rspec
data/.gitignore CHANGED
@@ -12,4 +12,10 @@
12
12
 
13
13
  .jekyll-cache
14
14
 
15
- Gemfile.lock
15
+ Gemfile.lock
16
+
17
+ .vscode/*
18
+ *.code-workspace
19
+
20
+ # Local History for Visual Studio Code
21
+ .history/
data/CHANGELOG.md CHANGED
@@ -1,9 +1,16 @@
1
1
  # Changelog
2
2
 
3
- ## Ongoing [☰](https://github.com/philnash/jekyll-brotli/compare/v2.2.1...master)
3
+ ## Ongoing [☰](https://github.com/philnash/jekyll-brotli/compare/v0.2.1...master)
4
4
 
5
5
  ...
6
6
 
7
+ ## 0.2.1 (2022-04-05) [☰](https://github.com/philnash/jekyll-web_monetization/compare/v0.2.0...v0.2.1)
8
+
9
+ ### Added
10
+
11
+ - If the config is set to an array of payment pointers that has only one payment pointer, then just print the meta tag ([Thanks SethFalco](https://github.com/philnash/jekyll-web_monetization/pull/1))
12
+
13
+
7
14
  ## 0.2.0 (2020-06-08) [☰](https://github.com/philnash/jekyll-web_monetization/compare/v0.1.0...v0.2.0)
8
15
 
9
16
  ### Added
data/Gemfile CHANGED
@@ -4,3 +4,6 @@ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in jekyll-web_monetization.gemspec
6
6
  gemspec
7
+
8
+ # Allows to switch Jekyll version in the build matrix
9
+ gem "jekyll", ENV["JEKYLL_VERSION"] ? "#{ENV["JEKYLL_VERSION"]}" : nil
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A Jekyll plugin to add [Web Monetization API](https://webmonetization.org/) payment pointers to your site.
4
4
 
5
- [![Build Status](https://travis-ci.org/philnash/jekyll-web_monetization.svg?branch=master)](https://travis-ci.org/philnash/jekyll-web_monetization)
5
+ [![Gem Version](https://badge.fury.io/rb/jekyll-web_monetization.svg)](https://badge.fury.io/rb/jekyll-web_monetization) ![Build status](https://github.com/philnash/jekyll-web_monetization/workflows/tests/badge.svg) [![Maintainability](https://api.codeclimate.com/v1/badges/9a29d485942538c525dc/maintainability)](https://codeclimate.com/github/philnash/jekyll-web_monetization/maintainability) [![Inline docs](http://inch-ci.org/github/philnash/jekyll-web_monetization.svg?branch=master)](http://inch-ci.org/github/philnash/jekyll-web_monetization)
6
6
 
7
7
  ## Web Monetization
8
8
 
@@ -7,18 +7,27 @@ module Jekyll
7
7
  def render(context)
8
8
  site_payment_pointer = context.registers[:site].config["payment_pointer"]
9
9
  page_payment_pointer = context.registers[:page]["payment_pointer"] || site_payment_pointer
10
- if page_payment_pointer.is_a?(Array)
11
- pointers_with_weights = array_to_object(page_payment_pointer)
12
- return javascript(pointers_with_weights)
10
+
11
+ if page_payment_pointer.is_a?(Array)
12
+ if page_payment_pointer.length == 1
13
+ pointer_to_html(page_payment_pointer[0])
14
+ else
15
+ pointers_with_weights = array_to_object(page_payment_pointer)
16
+ return javascript(pointers_with_weights)
17
+ end
13
18
  elsif page_payment_pointer.is_a?(Hash)
14
19
  return javascript(page_payment_pointer)
15
20
  elsif page_payment_pointer.is_a?(String)
16
- "<meta name='monetization' content='#{page_payment_pointer}'>"
21
+ pointer_to_html(page_payment_pointer)
17
22
  end
18
23
  end
19
24
 
20
25
  private
21
26
 
27
+ def pointer_to_html(pointer)
28
+ return "<meta name='monetization' content='#{pointer}'>"
29
+ end
30
+
22
31
  def array_to_object(pointers)
23
32
  pointers.reduce({}) { |acc, pointer| acc[pointer] = 1; acc }
24
33
  end
@@ -38,7 +47,7 @@ module Jekyll
38
47
  }
39
48
  }
40
49
  }
41
-
50
+
42
51
  window.addEventListener("load", function() {
43
52
  const tag = document.createElement("meta");
44
53
  tag.name = "monetization";
@@ -48,7 +57,7 @@ module Jekyll
48
57
  })();
49
58
  </script>
50
59
  JAVASCRIPT
51
- end
60
+ end
52
61
  end
53
62
  end
54
- end
63
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module WebMonetization
5
- VERSION = "0.2.0"
5
+ VERSION = "0.2.1"
6
6
  end
7
7
  end
@@ -10,4 +10,4 @@ module Jekyll
10
10
  end
11
11
  end
12
12
 
13
- Liquid::Template.register_tag('web_monetization', Jekyll::WebMonetization::Tag)
13
+ Liquid::Template.register_tag('web_monetization', Jekyll::WebMonetization::Tag)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-web_monetization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Nash
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-08 00:00:00.000000000 Z
11
+ date: 2022-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -66,9 +66,10 @@ executables: []
66
66
  extensions: []
67
67
  extra_rdoc_files: []
68
68
  files:
69
+ - ".editorconfig"
70
+ - ".github/workflows/tests.yml"
69
71
  - ".gitignore"
70
72
  - ".rspec"
71
- - ".travis.yml"
72
73
  - CHANGELOG.md
73
74
  - CODE_OF_CONDUCT.md
74
75
  - Gemfile
@@ -88,7 +89,7 @@ metadata:
88
89
  homepage_uri: https://github.com/philnash/jekyll-web_monetization
89
90
  source_code_uri: https://github.com/philnash/jekyll-web_monetization
90
91
  changelog_uri: https://github.com/philnash/jekyll-web_monetization/master/CHANGELOG.md
91
- post_install_message:
92
+ post_install_message:
92
93
  rdoc_options: []
93
94
  require_paths:
94
95
  - lib
@@ -103,8 +104,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
104
  - !ruby/object:Gem::Version
104
105
  version: '0'
105
106
  requirements: []
106
- rubygems_version: 3.1.2
107
- signing_key:
107
+ rubygems_version: 3.3.3
108
+ signing_key:
108
109
  specification_version: 4
109
110
  summary: A Jekyll plugin to add Web Monetization API payment pointers to your site
110
111
  test_files: []
data/.travis.yml DELETED
@@ -1,18 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.7
7
- - 2.6
8
- - 2.5
9
- - 2.4
10
- - ruby-head
11
- env:
12
- - 'JEKYLL_VERSION="~> 3.0"'
13
- - 'JEKYLL_VERSION="~> 4.0"'
14
- matrix:
15
- allow_failures:
16
- - rvm: ruby-head
17
- before_install: gem install bundler
18
- script: bundle exec rspec