jekyll-liquid-debug 0.2.3 → 0.2.4

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: 1e17e174844777be1c2b1ceb65a7a26fbb6ba8c78d1b4efcde01b32f81385937
4
- data.tar.gz: 4ee1f8f6ff148b8a7dc6b33d5ca96654e5bb0fc49bdbe4723ff890c799c68c08
3
+ metadata.gz: 666c59fc147a7b0258cbee22023237395169f102ebce20f353cacc8230a0e146
4
+ data.tar.gz: 02feac01253718abafba85e2bcc2d4d395baa428329db487aa9ed71dc185d837
5
5
  SHA512:
6
- metadata.gz: 9a016d74533b67ab881c63cf6f160028003d44f51f48539fd20a4fbd4271604fefc74d39734306ddfbeff6529dfc6b79068e6943b06588d36e73612725296dc9
7
- data.tar.gz: 86809db7617ff55ed4e69eb2e046761612b986fb26b7f11deb91adb9ed9158697192df1ec8c529b73412fb85a68968799d2f09c7b6f67d76f9b6f4d400703906
6
+ metadata.gz: 3bed0360943eefa93eab7878a9bd0696606a4c4cdaa19e5c2d6cb4d90056e9fc2422d9897367ec60e726bff0d018bd7d4f85bb442200ab1ee4883386e676a128
7
+ data.tar.gz: d9fc3f5b1d789fb6f0ba8626dfc39704952d53489031f2960c01224004016b0ad22b13bee43821aa8fa67151648be7d5e180907b461aa4c5bae777a1959ea43d
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "jekyll-liquid-debug"
3
+ require_relative "../lib/jekyll-liquid-debug"
4
4
 
5
5
  JekyllLiquidDebug.run
@@ -3,6 +3,7 @@ require_relative "lib/jekyll-liquid-debug/version"
3
3
  Gem::Specification.new do |s|
4
4
  s.required_ruby_version = ">= 2.5.0"
5
5
  s.name = "jekyll-liquid-debug"
6
+ s.executables = s.name
6
7
  s.version = VERSION
7
8
  s.authors = ["Xiang Zhong"]
8
9
  s.email = ["zhongxiang117@gmail.com"]
@@ -14,4 +15,5 @@ Gem::Specification.new do |s|
14
15
 
15
16
  s.add_dependency("liquid", "~> 4.0.0")
16
17
  s.add_dependency("kramdown", "~> 2.3.0")
18
+ s.add_dependency("hash_dot", "~> 2.0.0")
17
19
  end
@@ -1,6 +1,8 @@
1
1
  require "liquid"
2
2
  require "kramdown"
3
3
  require "optparse"
4
+ require "hash_dot"
5
+ require "yaml"
4
6
  require_relative "jekyll-liquid-debug/version"
5
7
 
6
8
  class JekyllLiquidDebug
@@ -9,7 +11,9 @@ class JekyllLiquidDebug
9
11
  # Hash to contain all settings
10
12
  # it is needed to set default values, to help use Struct make Hash dottable.
11
13
  # because Struct does not have method to check whether key exists
12
- args = {file:false, html:false, kmd:false, outhtml:false, outmd:false}
14
+ args = {file:false, html:false, kmd:false, outhtml:false, outmd:false,
15
+ yaml:false,
16
+ }
13
17
  OptionParser.new do |opt|
14
18
  opt.banner = "Usage: jekyll-liquid-debug [options]"
15
19
  opt.separator ""
@@ -23,6 +27,10 @@ class JekyllLiquidDebug
23
27
  args[:html] = Parser.func_set_file(v)
24
28
  end
25
29
 
30
+ opt.on("-y", "--yaml [FILE]", String, "input YAML file, parsed to `site.[var]'") do |v|
31
+ args[:yaml] = Parser.func_set_file(v)
32
+ end
33
+
26
34
  opt.on("-k", "--md [FILE]", String, "input raw markdown file, precedent for option `-t'") do |v|
27
35
  args[:kmd] = Parser.func_set_file(v)
28
36
  end
@@ -74,6 +82,13 @@ class JekyllLiquidDebug
74
82
  puts "Note: using input markdown file < #{args.kmd} >"
75
83
  # read input markdown
76
84
  fmd = File.open(args.kmd).read
85
+
86
+ if args.yaml
87
+ puts "Note: using input YAML file < #{args.yaml} >"
88
+ site = YAML.load_file(args.yaml).to_dot
89
+ fmd = Liquid::Template.parse(fmd).render("site" => site)
90
+ end
91
+
77
92
  # html conversion
78
93
  content = Kramdown::Document.new(fmd).to_html
79
94
  fbase = File.basename(args.kmd,".*")
@@ -1,4 +1,4 @@
1
- VERSION = '0.2.3'
1
+ VERSION = '0.2.4'
2
2
 
3
3
  FEATURE = [
4
4
  '* Version 0.1.0: Ruby-liquid Debug',
@@ -6,4 +6,5 @@ FEATURE = [
6
6
  '* Version 0.2.1: Change args type from Struct to Hash',
7
7
  '* Version 0.2.2: Optimize the combination of options',
8
8
  '* Version 0.2.3: Add README.md',
9
+ '* Version 0.2.4: Add parse YAML file',
9
10
  ]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-liquid-debug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xiang Zhong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-30 00:00:00.000000000 Z
11
+ date: 2020-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid
@@ -38,10 +38,25 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.3.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: hash_dot
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 2.0.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 2.0.0
41
55
  description:
42
56
  email:
43
57
  - zhongxiang117@gmail.com
44
- executables: []
58
+ executables:
59
+ - jekyll-liquid-debug
45
60
  extensions: []
46
61
  extra_rdoc_files: []
47
62
  files: