jekyll-gl 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1bcc3177d7c38c90fdf1dd93eead46510bc243f8
4
- data.tar.gz: 2339ed509127a1d058df54675100e8c6b0ed6a7d
3
+ metadata.gz: a3c057ae6377c1321a169a6b536da7211ba801d6
4
+ data.tar.gz: 23640f722cf1365da78b9ac654a049f676e2756b
5
5
  SHA512:
6
- metadata.gz: 310194c2f0bee3901978a1f41b796014a1b0707bd3898f84d96ae021d87bf37fcaad51371b8ba5fc204b76fbd82aadd7921493ee6cc413a3a646e905fe719722
7
- data.tar.gz: 1a705067fcd52078fe5c4bef7a1099ef86c197a755d82b1936f1fd8b2151535a2c2ab49b4d78e41cb892c9ec7b05613e7d72b4d077bc55ba8231a1e60879cf28
6
+ metadata.gz: 3a5a84405c8341a0d9600506e86f581f1db04dc4834faf8bd596fa93bb0c80b6cc1600ea661e82ab34ce2714d29a046a313754151cb26443c1b68d9f83fc10ac
7
+ data.tar.gz: 36d28d2988e3e9b1748d555c9ff0d84e8fc9fddf9097281eb634111a5d352bea5857bab674ee1632c663c31d64a21696609d0dd9fdea2a372182ac1ae1652853
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "jekyll", "~>2.5.0"
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Marcelo Miranda Carneiro
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # jekyll-gl
2
+
3
+ This is a very simple Jekyll plugin to be used on Hyojun.guideline project. It'll place `.gl` class on all markdown generated elements.
4
+
5
+ ## Installation
6
+
7
+ Place this gem on your project `Gemfile`:
8
+
9
+ ```
10
+ gem "jekyll-gl", "~>0.1.0"
11
+ ```
12
+
13
+ Or install it via `gem install`:
14
+
15
+ ```
16
+ $ gem install jekyll-gl
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ On jekyll `_config.yaml` file, add this gem to be loaded as a plugin:
22
+
23
+ ```yaml
24
+ source: ./_jekyll
25
+ destination: ./guideline
26
+
27
+ url: /guideline
28
+
29
+ gems: ["jekyll-gl"]
30
+
31
+ defaults:
32
+ -
33
+ scope:
34
+ type: pages
35
+ values:
36
+ layout: default
37
+
38
+ kramdown:
39
+ transliterated_header_ids: true
40
+ ```
41
+
42
+ ## Contributing
43
+
44
+ Go to [Hyojun.guideline](https://bitbucket.org/fbiz/hyojun.guideline/) for more information.
data/jekyll-gl.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "jekyll-gl"
7
- spec.version = "0.1.1"
7
+ spec.version = "0.1.2"
8
8
  spec.authors = ["Marcelo Miranda Carneiro"]
9
9
  spec.email = ["mcarneiro@fbiz.com.br"]
10
10
  spec.summary = %q{Hyojun.guideline Jekyll Plugin}
@@ -12,9 +12,14 @@ Gem::Specification.new do |spec|
12
12
  spec.homepage = "http://fbiz.bitbucket.org/hyojun.guideline/"
13
13
  spec.license = "MIT"
14
14
 
15
- spec.files = "jekyll-gl.gemspec"
15
+ spec.files = [
16
+ "Gemfile",
17
+ "jekyll-gl.gemspec",
18
+ "lib/jekyll-gl.rb",
19
+ "LICENSE.txt",
20
+ "README.md"
21
+ ]
16
22
  spec.require_paths = ["lib"]
17
23
 
18
24
  spec.add_development_dependency "bundler", "~> 1.7"
19
- spec.add_development_dependency "rake", "~> 10.0"
20
25
  end
data/lib/jekyll-gl.rb ADDED
@@ -0,0 +1,91 @@
1
+ require 'kramdown'
2
+ require 'jekyll'
3
+
4
+ module Kramdown
5
+ module Converter
6
+
7
+ class Html
8
+
9
+ alias_method :s_format_as_span_html, :format_as_span_html
10
+ alias_method :s_format_as_block_html, :format_as_block_html
11
+ alias_method :s_format_as_indented_block_html, :format_as_indented_block_html
12
+ alias_method :s_convert_codeblock, :convert_codeblock
13
+ alias_method :s_convert_hr, :convert_hr
14
+
15
+ def add_gl_class(text)
16
+ if text['class'] == nil
17
+ text['class'] = 'gl'
18
+ else
19
+ text['class'] += ' gl'
20
+ end
21
+ end
22
+
23
+ # Format the given element as span HTML.
24
+ def format_as_span_html(name, attr, body)
25
+ add_gl_class(attr)
26
+ s_format_as_span_html(name, attr, body)
27
+ end
28
+
29
+ # Format the given element as block HTML.
30
+ def format_as_block_html(name, attr, body, indent)
31
+ add_gl_class(attr)
32
+ s_format_as_block_html(name, attr, body, indent)
33
+ end
34
+
35
+ def format_as_indented_block_html(name, attr, body, indent)
36
+ add_gl_class(attr)
37
+ s_format_as_indented_block_html(name, attr, body, indent)
38
+ end
39
+
40
+ def convert_codeblock(el, indent)
41
+ add_gl_class(el.attr)
42
+ s_convert_codeblock(el, indent)
43
+ end
44
+
45
+ def convert_hr(el, indent)
46
+ add_gl_class(el.attr)
47
+ s_convert_hr(el, indent)
48
+ end
49
+
50
+ end
51
+ end
52
+ end
53
+
54
+ module Jekyll
55
+ class Example < Liquid::Block
56
+
57
+ def initialize(tag_name, markup, options)
58
+ super
59
+ result = []
60
+ @example_tag = "div"
61
+
62
+ markup.split.each do |val|
63
+ case val
64
+ when "inline"
65
+ @example_tag = "span"
66
+ when "full"
67
+ result << 'gl-full'
68
+ when "checkers"
69
+ result << 'gl-checkers'
70
+ when "dark"
71
+ result << 'gl-dark'
72
+ end
73
+ end
74
+
75
+ result.delete("gl-full") if @css_tag == "span"
76
+
77
+ result.uniq
78
+ @css_class = result.join(' ')
79
+ end
80
+
81
+ def render(context)
82
+ '<{{tag}} class="gl {{cssclass}}"> {{content}} </{{tag}}>'
83
+ .gsub('{{tag}}', @example_tag)
84
+ .sub('{{cssclass}}', @css_class)
85
+ .sub('{{content}}', super)
86
+ end
87
+ end
88
+ end
89
+
90
+ Liquid::Template.register_tag('example', Jekyll::Example)
91
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-gl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Miranda Carneiro
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: '10.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: '10.0'
41
27
  description: This Jekyll plugin will place a ".gl" class in every mardown generated
42
28
  elment to automate Hyojun.guideline.
43
29
  email:
@@ -46,7 +32,11 @@ executables: []
46
32
  extensions: []
47
33
  extra_rdoc_files: []
48
34
  files:
35
+ - Gemfile
49
36
  - jekyll-gl.gemspec
37
+ - lib/jekyll-gl.rb
38
+ - LICENSE.txt
39
+ - README.md
50
40
  homepage: http://fbiz.bitbucket.org/hyojun.guideline/
51
41
  licenses:
52
42
  - MIT