jekyll-html 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: '068e8061dabd1d58dea6038ab8e397a55988116065e3c52612e62ca697c76a98'
4
+ data.tar.gz: fd1b9d8ab71bae12038fedf99c8506095ee6606f123d5a8ec0fff1440ede006a
5
+ SHA512:
6
+ metadata.gz: 1c2fd59853cd02630383868eb9a1acb6c53e292abf54e5787658eb01e7cd91e7b607d56f4c5e2b7d06a73ae7aa71b0e6b828e9b75fc77d100019da5c71b22d90
7
+ data.tar.gz: 36ecf26f03f281886ec98398c85239a8256df7bb95d113b058a83ce85ab8f3c811abd6b71d2fb7542b9d77226fafac5ca5319112871440f15954731f7e3bd30e
@@ -0,0 +1,24 @@
1
+ *.gem
2
+ *.swp
3
+ *~
4
+ .DS_Store
5
+ .analysis
6
+ .bundle/
7
+ .byebug_history
8
+ .jekyll-metadata
9
+ .ruby-gemset
10
+ .ruby-version
11
+ .sass-cache
12
+ /test/source/file_name.txt
13
+ /vendor
14
+ Gemfile.lock
15
+ _site/
16
+ .idea/
17
+ bin/
18
+ bbin/
19
+ coverage
20
+ gh-pages/
21
+ pkg/
22
+ site/_site/
23
+ test/dest
24
+ tmp/*
@@ -0,0 +1,15 @@
1
+ sudo: false
2
+ language: ruby
3
+
4
+ before_install:
5
+ - gem install bundler -v 1.16.0
6
+
7
+ matrix:
8
+ include:
9
+ - rvm: 2.4.2
10
+ - rvm: 2.3.5
11
+ - rvm: 2.2.8
12
+ - rvm: 2.1.10
13
+
14
+ notfications:
15
+ email: false
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017-present Kacper Duras
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,51 @@
1
+ # jekyll-html [![Build Status](https://travis-ci.org/kacperduras/jekyll-html.svg?branch=master)](https://travis-ci.org/kacperduras/jekyll-html) [![Gem Version](https://badge.fury.io/rb/jekyll-html.svg)](https://badge.fury.io/rb/jekyll-html)
2
+
3
+ A Jekyll plugin to use HTML tags in Jekyll pages, posts and collections.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+ ```
9
+ $ gem 'jekyll-html'
10
+ ```
11
+
12
+ And then execute:
13
+ ```
14
+ $ bundle
15
+ ```
16
+
17
+ Or install it yourself as:
18
+ ```
19
+ $ gem install jekyll-html
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ Input:
25
+ ```
26
+ {% starttag p %}
27
+ Example text
28
+ {% endtag p %}
29
+
30
+ {% starttag div class=test_class %}
31
+ {% starttag p class=test_class %}
32
+ Example text
33
+ {% endtag p class=test_class %}
34
+ {% endtag div %}
35
+ ```
36
+
37
+ Output:
38
+ ```html
39
+ <p>
40
+ Example text
41
+ </p>
42
+
43
+ <div class="test class">
44
+ <p class="test_class">
45
+ Example text
46
+ </p> <!-- this tag can not have any attributes, because he closes -->
47
+ </div>
48
+ ```
49
+
50
+ ## License
51
+ [MIT](LICENSE)
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'test'
6
+ t.libs << 'lib'
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task default: :test
@@ -0,0 +1,38 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = 'jekyll-html'
6
+ spec.version = '1.0.0'
7
+ spec.authors = ['Kacper Duras']
8
+ spec.email = ['git@kacperduras.pl']
9
+
10
+ spec.summary = 'A Jekyll plugin to use HTML tags in Jekyll pages, posts and collections.'
11
+ spec.homepage = 'https://github.com/kacperduras/jekyll-html'
12
+ spec.license = 'MIT'
13
+
14
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
15
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
16
+ if spec.respond_to?(:metadata)
17
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
18
+ else
19
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
20
+ 'public gem pushes.'
21
+ end
22
+
23
+ spec.required_ruby_version = '>= 2.1'
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
+ f.match(%r{^(test|spec|features)/})
27
+ end
28
+ spec.bindir = 'exe'
29
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ['lib']
31
+
32
+ spec.add_dependency 'jekyll', '~> 3.6.2'
33
+
34
+ spec.add_development_dependency 'bundler', '~> 1.16'
35
+
36
+ spec.add_development_dependency 'rake', '~> 12.3'
37
+ spec.add_development_dependency 'minitest', '~> 5.10.3'
38
+ end
@@ -0,0 +1,55 @@
1
+ require 'jekyll'
2
+ require 'liquid'
3
+
4
+ require 'jekyll-html/start_tag'
5
+ require 'jekyll-html/end_tag'
6
+
7
+ module Jekyll
8
+
9
+ module Html
10
+
11
+ class << self
12
+
13
+ def generate_start_tag(tag_content)
14
+ raise('Tag content cannot be null!') if tag_content.nil?
15
+ raise('Tag content cannot be empty!') if tag_content.empty?
16
+
17
+ content = tag_content.split(' ')
18
+ raise('Splitted content cannot be empty!') if content.empty?
19
+
20
+ result = ''
21
+
22
+ content.each do |target|
23
+ targetContent = target.split('=')
24
+ if targetContent.length != 2
25
+ result += target + ' '
26
+ next
27
+ end
28
+
29
+ key = targetContent[0]
30
+ value = targetContent[1].tr('_', ' ')
31
+
32
+ result += "#{key}=\"#{value}\"\""
33
+ end
34
+
35
+ "<#{result[0, result.length - 1]}>"
36
+ end
37
+
38
+ def generate_end_tag(tag_content)
39
+ raise('Tag content cannot be null!') if tag_content.nil?
40
+ raise('Tag content cannot be empty!') if tag_content.empty?
41
+
42
+ content = tag_content.split(' ')
43
+ raise('Splitted content cannot be empty!') if content.empty?
44
+
45
+ "</#{content[0]}>"
46
+ end
47
+
48
+ end
49
+
50
+ end
51
+
52
+ end
53
+
54
+ Liquid::Template.register_tag('starttag', Jekyll::Html::StartTag)
55
+ Liquid::Template.register_tag('endtag', Jekyll::Html::EndTag)
@@ -0,0 +1,24 @@
1
+ require 'jekyll'
2
+ require 'liquid'
3
+
4
+ require 'jekyll-html'
5
+
6
+ module Jekyll
7
+
8
+ module Html
9
+
10
+ class EndTag < Liquid::Tag
11
+
12
+ def initialize(tag_name, txt, tokens)
13
+ @context = txt.nil? || txt.empty? ? '' : txt
14
+ end
15
+
16
+ def render(context)
17
+ Jekyll::Html.generate_end_tag(@context)
18
+ end
19
+
20
+ end
21
+
22
+ end
23
+
24
+ end
@@ -0,0 +1,24 @@
1
+ require 'jekyll'
2
+ require 'liquid'
3
+
4
+ require 'jekyll-html'
5
+
6
+ module Jekyll
7
+
8
+ module Html
9
+
10
+ class StartTag < Liquid::Tag
11
+
12
+ def initialize(tag_name, txt, tokens)
13
+ @context = txt.nil? || txt.empty? ? '' : txt
14
+ end
15
+
16
+ def render(context)
17
+ Jekyll::Html.generate_start_tag(@context)
18
+ end
19
+
20
+ end
21
+
22
+ end
23
+
24
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-html
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Kacper Duras
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-12-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 3.6.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 3.6.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.16'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.16'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '12.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '12.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 5.10.3
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 5.10.3
69
+ description:
70
+ email:
71
+ - git@kacperduras.pl
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".idea/workspace.xml"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - LICENSE
81
+ - README.md
82
+ - Rakefile
83
+ - bin/console
84
+ - bin/setup
85
+ - jekyll-html.gemspec
86
+ - lib/jekyll-html.rb
87
+ - lib/jekyll-html/end_tag.rb
88
+ - lib/jekyll-html/start_tag.rb
89
+ homepage: https://github.com/kacperduras/jekyll-html
90
+ licenses:
91
+ - MIT
92
+ metadata:
93
+ allowed_push_host: https://rubygems.org
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '2.1'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.7.3
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: A Jekyll plugin to use HTML tags in Jekyll pages, posts and collections.
114
+ test_files: []