jekyll-json-ld 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll/json/ld.rb +8 -22
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 717d55f92cc655e4bc53a8590da539376f8505d8
4
- data.tar.gz: 559b97f1ec2ff2783b8bc680aae747c03019d28b
3
+ metadata.gz: 6be50cf54ef3f123c545caa5b50b8bf1f194ab3a
4
+ data.tar.gz: eb95a9eab5cbe3b72948a4a33b8a9b6995e6c518
5
5
  SHA512:
6
- metadata.gz: a4cee1b424ef1be795bc997f2c2d701b48efcbce48b2fe976344f4f09afa97c2fad18195d1bd58ee5afe83c1dbb8c00b4ba46a07a659dbf14cd78006cd91a384
7
- data.tar.gz: 3ae4deda5a7679946d223faec994e9ed216bb103e23e9960e9f8c251375131add48026291c672b3d8e723db3c020289b6020fd4384ed2b7914bb70fc42fec475
6
+ metadata.gz: ba9afe5b97073ebc4f8dc8f53653add896fd61920621fed4fb4f7d499fa385004668fc13408f2833987da25f7159ecf14d4d818fe65e656445d6ba563af49cf8
7
+ data.tar.gz: 277d0e7d999bfdbd88b48542eb317fc0eb6fa31af78f63c6358c09b0db5de1b32d4b30c1938f2cd1ce5deae90777634db027256fe527822a7f47de19c3a36686
@@ -4,31 +4,17 @@ require "liquid"
4
4
  module Jekyll
5
5
  module JSON
6
6
  module LD
7
- # Provides the tag json_ld that renders
8
- # the object specified in the Front Matter
9
- # YAML to JSON-LD
10
- class JSONLDTag < Liquid::Tag
11
-
12
- # @param root_key [string] name of the root
13
- # key containing the object in the Front Matter
14
- def initialize(tag_name, root_key, tokens)
15
- super
16
- @root_key = root_key.strip
17
- @tokens = tokens
18
- end
19
-
20
- # Render is called by liquid
21
- # @return [string] JSON-LD string enclosed
22
- # in the appropriate script tag
23
- def render(context)
24
- "<script type=\"application/ld+json\">%s</script>" % context.environments[0][@root_key].to_json
7
+ # Provides the filter json_ld that renders
8
+ # a provided YAML to JSON-LD
9
+ # @param yaml [String] object to render
10
+ # @return [String] object in json-ld wrapped in the script tag of type "application/ld+json"
11
+ module JSONLDFilter
12
+ def json_ld_filter(yaml)
13
+ "<script type=\"application/ld+json\">%s</script>" % yaml.to_json
25
14
  end
26
-
27
15
  end
28
16
  end
29
17
  end
30
18
  end
31
19
 
32
- Liquid::Template.register_tag(
33
- "json_ld",
34
- Jekyll::JSON::LD::JSONLDTag)
20
+ Liquid::Template.register_filter(Jekyll::JSON::LD::JSONLDFilter)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-json-ld
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthias Winkelmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-17 00:00:00.000000000 Z
11
+ date: 2016-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -74,7 +74,7 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - lib/jekyll/json/ld.rb
77
- homepage: https://github.com/MatthiasWinkelmann/jekyll-json-ld
77
+ homepage: https://matthi.coffee/jekyll-json-ld/
78
78
  licenses:
79
79
  - MIT
80
80
  metadata:
@@ -98,6 +98,6 @@ rubyforge_project:
98
98
  rubygems_version: 2.4.5.1
99
99
  signing_key:
100
100
  specification_version: 4
101
- summary: JSON-LD Liquid Tags in Jekyll
101
+ summary: JSON-LD Liquid in Jekyll
102
102
  test_files: []
103
103
  has_rdoc: