bridgetown-haml 1.1.0 → 2.0.0

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: b447e6fdc5ca2638ad2d3515ef58c3d4dbcf3568e6e60e5a46247ad3cfaefd9e
4
- data.tar.gz: 37da206046e473f9747ab2b1747ca428cc02bb5eae79ae64df7ab37079d115c9
3
+ metadata.gz: 827345d279383a29038c57908b534b843e0a234973dc1216b48287076fc9a0b8
4
+ data.tar.gz: b7d6ad4c36d1ec3bf28d0adb857704c54d48e1b77c1f0ca432b52c4d4f9840ee
5
5
  SHA512:
6
- metadata.gz: bf084f41dd21a87ae0450953d438c4423e429826efbdc7aae66a06d2a2567499dbb7d3783eca731c887d202e61fe58f003cc0c94d0141da4b9d8e1c09efdb6b1
7
- data.tar.gz: '0973467470eb2d733bba581e03bc63f748bb0a91caf1d6fb1f4f0bd8ee12ed481f83db55d1b4e4325fc92d365b31232a939cba684647741011b3f09845c118aa'
6
+ metadata.gz: c0c9a36d60b55aa6d994b27ac6d9aeab2573260e353dfdf8337701d6c95dcf43967d33cfb09ccd9f263202092cdc07cf2c6f6cda2788958f57f486410fbd8d43
7
+ data.tar.gz: 58ff41d405ff0378e04a71d2e230f68f8d98fc8192514ce0407baa99c5dab5bf44d2b1d05e7bf4be24a04e05b2de4e4826d1d37e2750bc0e9864d7df543bcb7e
data/.rubocop.yml CHANGED
@@ -4,19 +4,20 @@ inherit_gem:
4
4
  rubocop-bridgetown: .rubocop.yml
5
5
 
6
6
  AllCops:
7
- TargetRubyVersion: 2.5
8
- Include:
9
- - lib/**/*.rb
7
+ TargetRubyVersion: 2.7
10
8
 
11
9
  Exclude:
12
10
  - .gitignore
13
11
  - .rspec
14
12
  - .rubocop.yml
15
13
 
14
+ - Rakefile
15
+ - "*.gemspec"
16
16
  - Gemfile.lock
17
17
  - CHANGELOG.md
18
18
  - LICENSE.txt
19
19
  - README.md
20
20
 
21
21
  - script/**/*
22
+ - spec/**/*
22
23
  - vendor/**/*
data/CHANGELOG.md CHANGED
@@ -1,13 +1,21 @@
1
- # main
1
+ # Changelog
2
2
 
3
- # 1.1.0 / 2020-10-30
3
+ ## 2.0.0 / 2022-01-22
4
+
5
+ * Upgrade to initializers system in Bridgetown 1.2
6
+
7
+ ## 1.1.1 / 2020-11-01
8
+
9
+ * Set template_engine frontmatter when matching on extension alone
10
+
11
+ ## 1.1.0 / 2020-10-30
4
12
 
5
13
  * Updated for compatibilty with Bridgetown 0.18
6
14
 
7
- # 1.0.1 / 2020-07-24
15
+ ## 1.0.1 / 2020-07-24
8
16
 
9
17
  * Fix broken link to GitHub repo
10
18
 
11
- # 1.0.0 / 2020-07-24
19
+ ## 1.0.0 / 2020-07-24
12
20
 
13
21
  * First release of the bridgetown-haml plugin
data/README.md CHANGED
@@ -2,19 +2,25 @@
2
2
 
3
3
  A Bridgetown plugin to provide support for [Haml templates](http://haml.info/).
4
4
 
5
- _Requires Bridgetown 0.18 or greater._
6
-
7
- ## Installation
5
+ ## Installation for Bridgetown 1.2+
8
6
 
9
7
  Run this command to add this plugin to your site's Gemfile:
10
8
 
11
9
  ```shell
12
- $ bundle add bridgetown-haml -g bridgetown_plugins
10
+ $ bundle add bridgetown-haml
13
11
  ```
14
12
 
13
+ And then add the initializer to your configuration in `config/initializers.rb`:
14
+
15
+ ```ruby
16
+ init :"bridgetown-haml"
17
+ ```
18
+
19
+ (For Bridgetown 1.1 or earlier, [read these instructions](https://github.com/bridgetownrb/bridgetown-slim/tree/v1.1.1).)
20
+
15
21
  ## Usage
16
22
 
17
- Simply name your page, layout, or partial with a `.haml` extension. The available features will be fairly analogous to [the ERB support](https://www.bridgetownrb.com/docs/erb-and-beyond#haml-and-slim) in Bridgetown, including support for helpers, partials, and rendering Liquid components. You can even [embed Markdown and other template languages](https://github.com/haml/haml/blob/master/REFERENCE.md#filters-filters) using standard Haml syntax.
23
+ Simply name your page, layout, or partial with a `.haml` extension. The available features will be fairly analogous to [the ERB support](https://www.bridgetownrb.com/docs/template-engines/erb-and-beyond#haml-and-slim) in Bridgetown, including support for helpers, partials, and rendering Liquid components. You can even [embed Markdown and other template languages](https://github.com/haml/haml/blob/master/REFERENCE.md#filters-filters) using standard Haml syntax.
18
24
 
19
25
  You can also add `template_engine: haml` to your file's front matter and use any extension you want. For example, you could add `data.xml` to your source folder and simply make sure the front matter contains `template_engine: haml`.
20
26
 
@@ -15,14 +15,14 @@ Gem::Specification.new do |spec|
15
15
  spec.test_files = spec.files.grep(%r!^spec/!)
16
16
  spec.require_paths = ["lib"]
17
17
 
18
- spec.required_ruby_version = ">= 2.5.0"
18
+ spec.required_ruby_version = ">= 2.7.0"
19
19
 
20
- spec.add_dependency "bridgetown", ">= 0.18", "< 2.0"
21
- spec.add_dependency "haml", ">= 5.1.2"
20
+ spec.add_dependency "bridgetown", ">= 1.2.0.beta5", "< 2.0"
21
+ spec.add_dependency "haml", ">= 6.0.0"
22
22
 
23
23
  spec.add_development_dependency "bundler"
24
24
  spec.add_development_dependency "nokogiri", "~> 1.6"
25
- spec.add_development_dependency "rake", "~> 12.0"
25
+ spec.add_development_dependency "rake", "~> 13.0"
26
26
  spec.add_development_dependency "rspec", "~> 3.0"
27
27
  spec.add_development_dependency "rubocop-bridgetown", "~> 0.2"
28
28
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "tilt/haml"
3
+ require "haml"
4
4
 
5
5
  module Bridgetown
6
6
  class HamlView < RubyTemplateView
@@ -11,14 +11,15 @@ module Bridgetown
11
11
  partial_segments.last.sub!(%r!^!, "_")
12
12
  partial_name = partial_segments.join("/")
13
13
 
14
- Tilt::HamlTemplate.new(
14
+ Haml::Template.new(
15
15
  site.in_source_dir(site.config[:partials_dir], "#{partial_name}.haml")
16
- ).render(self, options)
16
+ ).render(self, options).html_safe
17
17
  end
18
18
  end
19
19
 
20
20
  module Converters
21
21
  class HamlTemplates < Converter
22
+ priority :highest
22
23
  input :haml
23
24
 
24
25
  # Logic to do the Haml content conversion.
@@ -29,9 +30,11 @@ module Bridgetown
29
30
  #
30
31
  # @return [String] The converted content.
31
32
  def convert(content, convertible)
33
+ return content if convertible.data[:template_engine] != "haml"
34
+
32
35
  haml_view = Bridgetown::HamlView.new(convertible)
33
36
 
34
- haml_renderer = Tilt::HamlTemplate.new(convertible.relative_path) { content }
37
+ haml_renderer = Haml::Template.new(convertible.relative_path) { content }
35
38
 
36
39
  if convertible.is_a?(Bridgetown::Layout)
37
40
  haml_renderer.render(haml_view) do
@@ -45,7 +48,9 @@ module Bridgetown
45
48
  def matches(ext, convertible)
46
49
  return true if convertible.data[:template_engine] == "haml"
47
50
 
48
- super(ext)
51
+ super(ext).tap do |ext_matches|
52
+ convertible.data[:template_engine] = "haml" if ext_matches
53
+ end
49
54
  end
50
55
 
51
56
  def output_ext(ext)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BridgetownHaml
4
- VERSION = "1.1.0"
4
+ VERSION = "2.0.0"
5
5
  end
@@ -1,4 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bridgetown"
4
- require "bridgetown-haml/haml_templates"
4
+
5
+ Bridgetown.initializer :"bridgetown-haml" do
6
+ require "bridgetown-haml/haml_templates"
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-haml
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-30 00:00:00.000000000 Z
11
+ date: 2023-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bridgetown
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.18'
19
+ version: 1.2.0.beta5
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '2.0'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '0.18'
29
+ version: 1.2.0.beta5
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '2.0'
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: 5.1.2
39
+ version: 6.0.0
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 5.1.2
46
+ version: 6.0.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '12.0'
81
+ version: '13.0'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '12.0'
88
+ version: '13.0'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: rspec
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +114,7 @@ dependencies:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0.2'
117
- description:
117
+ description:
118
118
  email: maintainers@bridgetownrb.com
119
119
  executables: []
120
120
  extensions: []
@@ -136,7 +136,7 @@ homepage: https://github.com/bridgetownrb/bridgetown-haml
136
136
  licenses:
137
137
  - MIT
138
138
  metadata: {}
139
- post_install_message:
139
+ post_install_message:
140
140
  rdoc_options: []
141
141
  require_paths:
142
142
  - lib
@@ -144,15 +144,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
144
  requirements:
145
145
  - - ">="
146
146
  - !ruby/object:Gem::Version
147
- version: 2.5.0
147
+ version: 2.7.0
148
148
  required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  requirements: []
154
- rubygems_version: 3.1.4
155
- signing_key:
154
+ rubygems_version: 3.3.3
155
+ signing_key:
156
156
  specification_version: 4
157
157
  summary: A Bridgetown plugin which provides support for Haml templates.
158
158
  test_files: []