modular-jekyll 0.0.2 → 0.0.3

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
  SHA1:
3
- metadata.gz: 27efccd404954392ff95873e31578316088a9c91
4
- data.tar.gz: a90d7d366996026cf06baead95412e845c102396
3
+ metadata.gz: 3f63da167c55298e6490c3b42efc3034cb147bfb
4
+ data.tar.gz: b9e25e7170cbf735f66c5c521bd49dc6450b54f4
5
5
  SHA512:
6
- metadata.gz: 57db14eaeff18f098bcade37755ec8f922c9f0e22f242c538bf8548d2df7a69c40138863131c02234252923c76897c2894cce16be2f8d3dcf33cdf88ee2b4393
7
- data.tar.gz: f93629c4a5af9d94aa3f7a34f8be3edfe6fadc9631471e7d57bd436a5f5eef1acb22bb8c0ada7ebac40a50973a4e20fd7d2b56506098c9f066132e50c1221fb2
6
+ metadata.gz: 8dfa9148fbc78a4bb9d738bb4b5796b78b118914bc68c375b6a22ac1032f8e6adab6d53bf1c2fe47e139703300bb06ff55e70a180a2e8d49af12750180a85fb7
7
+ data.tar.gz: 66eabff33db95dcd29946be67c1077d8216d9fb59553ab4ef1f15b1e982aac9bbe57ea606d3f01a18a7ca73cb50a93f0830bc4c0f5d4e9ab7c41917ba8330605
data/README.md CHANGED
@@ -1,3 +1,9 @@
1
1
  # modular-jekyll
2
2
 
3
3
  A modular approach to Jekyll
4
+
5
+ # Setup
6
+
7
+ - Add `gem 'modular-jekyll', '~> 0.0.2'` to your Gemfile
8
+ - Update your gemspec
9
+ - Add `gems: ['modular-jekyll']` to `_config.yml`
@@ -0,0 +1,53 @@
1
+ require "modular-jekyll/version"
2
+
3
+ module ModularJekyll
4
+ class Generator < Jekyll::Generator
5
+ def create_modular_content(page, modules, modules_dir)
6
+ content = ''
7
+
8
+ modules.each do | mod |
9
+ module_html = '';
10
+ params = Hash.new
11
+
12
+ if mod.is_a? String
13
+ # If we've a string, just load the file
14
+ module_html = File.read File.join Dir.pwd, modules_dir, "#{mod}.html"
15
+ else
16
+ # Otherwise, we have params. Load the file and inject the params
17
+ mod.select do |modName, modParams|
18
+ module_html = File.read File.join Dir.pwd, modules_dir, "#{modName}.html"
19
+ params['include'] = modParams
20
+ end
21
+ end
22
+
23
+ # Pass page into our partial
24
+ params['page'] = page
25
+ tmpl = Liquid::Template.parse(module_html).render(params)
26
+
27
+ # Append it to the content
28
+ content += tmpl
29
+ end
30
+
31
+ content
32
+ end
33
+
34
+ def generate(site)
35
+ modules_dir = '_includes/modules'
36
+ if site.config['modules']
37
+ modules_dir = site.config['modules']
38
+ end
39
+
40
+ site.pages.map do | page |
41
+ if page.data['modules']
42
+ page.data['moduleContent'] = create_modular_content(
43
+ page,
44
+ page.data['modules'],
45
+ modules_dir
46
+ )
47
+ end
48
+
49
+ page
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,3 @@
1
+ module ModularJekyll
2
+ VERSION = "0.0.3"
3
+ end
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'modular/jekyll/version'
4
+ require 'modular-jekyll/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "modular-jekyll"
8
- spec.version = Modular::Jekyll::VERSION
8
+ spec.version = ModularJekyll::VERSION
9
9
  spec.authors = ["Scott Dover"]
10
10
  spec.email = ["sdover102@gmail.com"]
11
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modular-jekyll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Dover
@@ -66,8 +66,8 @@ files:
66
66
  - Rakefile
67
67
  - bin/console
68
68
  - bin/setup
69
- - lib/modular/jekyll.rb
70
- - lib/modular/jekyll/version.rb
69
+ - lib/modular-jekyll.rb
70
+ - lib/modular-jekyll/version.rb
71
71
  - modular-jekyll.gemspec
72
72
  homepage: https://github.com/scottdover/modular-jekyll
73
73
  licenses:
@@ -1,55 +0,0 @@
1
- require "modular/jekyll/version"
2
-
3
- module Modular
4
- module Jekyll
5
- class Generator < Jekyll::Generator
6
- def create_modular_content(page, modules, modules_dir)
7
- content = ''
8
-
9
- modules.each do | mod |
10
- module_html = '';
11
- params = Hash.new
12
-
13
- if mod.is_a? String
14
- # If we've a string, just load the file
15
- module_html = File.read File.join Dir.pwd, modules_dir, "#{mod}.html"
16
- else
17
- # Otherwise, we have params. Load the file and inject the params
18
- mod.select do |modName, modParams|
19
- module_html = File.read File.join Dir.pwd, modules_dir, "#{modName}.html"
20
- params['include'] = modParams
21
- end
22
- end
23
-
24
- # Pass page into our partial
25
- params['page'] = page
26
- tmpl = Liquid::Template.parse(module_html).render(params)
27
-
28
- # Append it to the content
29
- content += tmpl
30
- end
31
-
32
- content
33
- end
34
-
35
- def generate(site)
36
- modules_dir = '_includes/modules'
37
- if site.config['modules']
38
- modules_dir = site.config['modules']
39
- end
40
-
41
- site.pages.map do | page |
42
- if page.data['modules']
43
- page.data['moduleContent'] = create_modular_content(
44
- page,
45
- page.data['modules'],
46
- modules_dir
47
- )
48
- end
49
-
50
- page
51
- end
52
- end
53
- end
54
- end
55
- end
@@ -1,5 +0,0 @@
1
- module Modular
2
- module Jekyll
3
- VERSION = "0.0.2"
4
- end
5
- end