jekyll-haml 0.1.6 → 1.0.0
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 +5 -5
- data/CHANGELOG.md +6 -0
- data/jekyll-haml.gemspec +2 -2
- data/lib/jekyll-haml/ext/convertible.rb +1 -1
- data/lib/jekyll-haml/tags/haml_partial.rb +46 -40
- data/lib/jekyll-haml/version.rb +1 -1
- data/lib/jekyll-haml.rb +14 -12
- metadata +14 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e9051303083d86acc94dad50b1c0df7ad02b128b02ff750a0c37922456cc6ded
|
4
|
+
data.tar.gz: 112427d6d32930dc72aea85325bb80138c2f16cf528964eb9c7c0b0c75082cb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1cf72bb0ee0a22a2882aae0e3594200c41f452ff2e69b715df802bdb0ddeadc6d280ee07c72aef680659efc03b1e6f10d0e3f379f624dea8bcc25e272cdfffb
|
7
|
+
data.tar.gz: cd255a43ad7b5fb1f8a6c6db615b931429ca4fb745b1491eef495d3be66140e1629da635bc958281341e17f2261162ff51528a3f4d9ca694a99838320eb4d566
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 1.0.0 2024-05-15
|
2
|
+
### breaking changes in order to work with jekyll ~> 4.0
|
3
|
+
* rework of haml liquid tag implementation - ([@mfaughn][])
|
4
|
+
* change Coverter._renderer to Coverter.renderer in convertible.rb - ([@mfaughn][])
|
5
|
+
* update dependencies in gemspec - ([@mfaughn][])
|
6
|
+
|
1
7
|
## 0.1.6 2017-11-10
|
2
8
|
### minor enhancements
|
3
9
|
* removes newlines from `{% haml %}` includes - ([@pedrozath][])
|
data/jekyll-haml.gemspec
CHANGED
@@ -17,6 +17,6 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
gem.add_runtime_dependency 'jekyll', '
|
21
|
-
gem.add_runtime_dependency 'haml', '
|
20
|
+
gem.add_runtime_dependency 'jekyll', '~> 4.0'
|
21
|
+
gem.add_runtime_dependency 'haml', '~> 5.0'
|
22
22
|
end
|
@@ -1,53 +1,59 @@
|
|
1
1
|
require 'haml'
|
2
2
|
|
3
3
|
module Jekyll
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
def render(context)
|
12
|
-
includes_dir = File.join(context.registers[:site].source, '_includes')
|
13
|
-
|
14
|
-
if File.symlink?(includes_dir)
|
15
|
-
return "Includes directory '#{includes_dir}' cannot be a symlink"
|
4
|
+
module Tags
|
5
|
+
class HamlIncludeTag < IncludeTag
|
6
|
+
def initialize(tag_name, file, tokens)
|
7
|
+
super
|
8
|
+
@file = file.strip
|
16
9
|
end
|
10
|
+
|
11
|
+
def load_cached_partial(path, context)
|
12
|
+
context.registers[:cached_partials] ||= {}
|
13
|
+
cached_partial = context.registers[:cached_partials]
|
17
14
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
choices = Dir['**/*'].reject { |x| File.symlink?(x) }
|
26
|
-
if choices.include?(@file)
|
27
|
-
source = File.read(@file)
|
28
|
-
conversion = ::Haml::Engine.new(source).render.delete("\n")
|
29
|
-
partial = Liquid::Template.parse(conversion)
|
15
|
+
if cached_partial.key?(path)
|
16
|
+
cached_partial[path]
|
17
|
+
else
|
18
|
+
html = ::Haml::Engine.new(File.read(path)).render.delete("\n")
|
19
|
+
unparsed_file = context.registers[:site]
|
20
|
+
.liquid_renderer
|
21
|
+
.file(path)
|
30
22
|
begin
|
31
|
-
|
23
|
+
cached_partial[path] = unparsed_file.parse(html)
|
32
24
|
rescue => e
|
33
|
-
|
34
|
-
|
35
|
-
e
|
36
|
-
puts backtrace
|
37
|
-
end
|
38
|
-
abort("Build Failed")
|
25
|
+
e.template_name = path
|
26
|
+
e.markup_context = "haml " if e.markup_context.nil?
|
27
|
+
raise e
|
39
28
|
end
|
29
|
+
end
|
30
|
+
end
|
40
31
|
|
41
|
-
|
42
|
-
|
32
|
+
def render(context)
|
33
|
+
if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./
|
34
|
+
return "Include file '#{@file}' contains invalid characters or sequences"
|
35
|
+
end
|
36
|
+
return "File must have \".haml\" extension" if @file !~ /\.haml$/
|
37
|
+
|
38
|
+
site = context.registers[:site]
|
39
|
+
path = locate_include_file(context, @file, site.safe)
|
40
|
+
return unless path
|
41
|
+
add_include_to_dependency(site, path, context)
|
42
|
+
|
43
|
+
partial = load_cached_partial(path, context)
|
44
|
+
|
45
|
+
context.stack do
|
46
|
+
begin
|
47
|
+
partial.render!(context)
|
48
|
+
rescue Liquid::Error => e
|
49
|
+
e.template_name = path
|
50
|
+
e.markup_context = "included " if e.markup_context.nil?
|
51
|
+
raise e
|
43
52
|
end
|
44
|
-
else
|
45
|
-
"Included file '#{@file}' not found in _includes directory"
|
46
53
|
end
|
47
54
|
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
55
|
|
53
|
-
|
56
|
+
end # HamlIncludeTag
|
57
|
+
end # Tags
|
58
|
+
end # Jekyll
|
59
|
+
Liquid::Template.register_tag('haml', Jekyll::Tags::HamlIncludeTag)
|
data/lib/jekyll-haml/version.rb
CHANGED
data/lib/jekyll-haml.rb
CHANGED
@@ -5,20 +5,22 @@ require "jekyll-haml/tags/haml_partial"
|
|
5
5
|
require "jekyll-haml/ext/convertible"
|
6
6
|
|
7
7
|
module Jekyll
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
module Converters
|
9
|
+
class Haml < Converter
|
10
|
+
safe true
|
11
|
+
priority :low
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
def matches(_ext)
|
14
|
+
_ext =~ /haml/i
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
def output_ext(ext)
|
18
|
+
".html"
|
19
|
+
end
|
19
20
|
|
20
|
-
|
21
|
-
|
21
|
+
def convert(content)
|
22
|
+
::Haml::Engine.new(content).render
|
23
|
+
end
|
22
24
|
end
|
23
25
|
end
|
24
|
-
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-haml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Vincent
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: haml
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '5.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '5.0'
|
41
41
|
description: HAML html converter for Jekyll
|
42
42
|
email:
|
43
43
|
- sam.vincent@mac.com
|
@@ -59,7 +59,7 @@ files:
|
|
59
59
|
homepage: ''
|
60
60
|
licenses: []
|
61
61
|
metadata: {}
|
62
|
-
post_install_message:
|
62
|
+
post_install_message:
|
63
63
|
rdoc_options: []
|
64
64
|
require_paths:
|
65
65
|
- lib
|
@@ -74,9 +74,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
requirements: []
|
77
|
-
|
78
|
-
|
79
|
-
signing_key:
|
77
|
+
rubygems_version: 3.5.16
|
78
|
+
signing_key:
|
80
79
|
specification_version: 4
|
81
80
|
summary: Convert HAML files to standard HTML files as part of your Jekyll build.
|
82
81
|
test_files: []
|