hamlit 2.16.0-java → 3.0.0-java
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 +4 -4
- data/CHANGELOG.md +25 -0
- data/lib/hamlit/compiler/script_compiler.rb +3 -2
- data/lib/hamlit/compiler.rb +1 -1
- data/lib/hamlit/engine.rb +1 -0
- data/lib/hamlit/rails_template.rb +5 -2
- data/lib/hamlit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12be429a8481d86e0dee762af8fa98eb8ef7ed5b131092f5cb47acc47655f5a0
|
4
|
+
data.tar.gz: 55fad897b3938e57bb9986e3b0c2c6cb449634889fa0563e46cef0176358c280
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e89257b48ceebde299b037ef204f29d9f017c6f49c5687f38f31a5182c8b0eb6b53802dc5a1fdc7980163f2aad1b8a89c88e072ddde7d63294cf63638d9f7634
|
7
|
+
data.tar.gz: 51da64cfc88e0a9625c1c60b7913099bec59f73bdc5e2b602383c9a4c685e887b74c8cb8445fd8e2c774397751f86f28fdfbe226d9d5fca9497ccd89f8d9adb8
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,31 @@ All notable changes to this project will be documented in this file. This
|
|
4
4
|
project adheres to [Semantic Versioning](http://semver.org/). This change log is based upon
|
5
5
|
[keep-a-changelog](https://github.com/olivierlacan/keep-a-changelog).
|
6
6
|
|
7
|
+
## [3.0.0](https://github.com/k0kubun/hamlit/compare/v2.16.2...v3.0.0) - 2022-08-07
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
- [**breaking**] Use `disable_capture: false` for non-Rails environments
|
12
|
+
- `:disable_capture` is an option introduced in v2.16.1. See its release notes for details.
|
13
|
+
- If you use Rails, it continues to use `disable_capture: true`, so you're not impacted by this change.
|
14
|
+
|
15
|
+
## [2.16.2](https://github.com/k0kubun/hamlit/compare/v2.16.1...v2.16.2) - 2022-08-07
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
|
19
|
+
- Fix an issue when `disable_capture: false` is set and a Ruby comment is put after `do`
|
20
|
+
|
21
|
+
## [2.16.1](https://github.com/k0kubun/hamlit/compare/v2.16.0...v2.16.1) - 2022-08-07
|
22
|
+
|
23
|
+
### Added
|
24
|
+
|
25
|
+
- Introduce `:disable_capture` option to capture a block
|
26
|
+
- Default: `disable_capture: true` (backward-compatible)
|
27
|
+
- For Rails, this must be `true` anyway to use Rails-native capturing.
|
28
|
+
- If you override the option like `disable_capture: false` in Hamlit::Template,
|
29
|
+
scripts starting with `=` (e.g. `= render do ...`) capture a block content.
|
30
|
+
- Scripts starting with `-` (e.g. `- users.each do`) are not impacted.
|
31
|
+
|
7
32
|
## [2.16.0](https://github.com/k0kubun/hamlit/compare/v2.15.2...v2.16.0) - 2022-02-03
|
8
33
|
|
9
34
|
### Added
|
@@ -6,8 +6,9 @@ require 'hamlit/string_splitter'
|
|
6
6
|
module Hamlit
|
7
7
|
class Compiler
|
8
8
|
class ScriptCompiler
|
9
|
-
def initialize(identity)
|
9
|
+
def initialize(identity, options)
|
10
10
|
@identity = identity
|
11
|
+
@disable_capture = options[:disable_capture]
|
11
12
|
end
|
12
13
|
|
13
14
|
def compile(node, &block)
|
@@ -79,7 +80,7 @@ module Hamlit
|
|
79
80
|
else
|
80
81
|
[:multi,
|
81
82
|
[:block, "#{var} = #{node.value[:text]}",
|
82
|
-
[:multi, [:newline], yield(node)]
|
83
|
+
[:multi, [:newline], @disable_capture ? yield(node) : [:capture, Temple::Utils.unique_name, yield(node)]]
|
83
84
|
],
|
84
85
|
]
|
85
86
|
end
|
data/lib/hamlit/compiler.rb
CHANGED
@@ -16,7 +16,7 @@ module Hamlit
|
|
16
16
|
@comment_compiler = CommentCompiler.new
|
17
17
|
@doctype_compiler = DoctypeCompiler.new(options)
|
18
18
|
@filter_compiler = Filters.new(options)
|
19
|
-
@script_compiler = ScriptCompiler.new(identity)
|
19
|
+
@script_compiler = ScriptCompiler.new(identity, options)
|
20
20
|
@silent_script_compiler = SilentScriptCompiler.new
|
21
21
|
@tag_compiler = TagCompiler.new(identity, options)
|
22
22
|
end
|
data/lib/hamlit/engine.rb
CHANGED
@@ -15,6 +15,7 @@ module Hamlit
|
|
15
15
|
use_html_safe: true,
|
16
16
|
streaming: true,
|
17
17
|
buffer_class: 'ActionView::OutputBuffer',
|
18
|
+
disable_capture: true,
|
18
19
|
}
|
19
20
|
end
|
20
21
|
|
@@ -34,8 +35,10 @@ module Hamlit
|
|
34
35
|
end
|
35
36
|
|
36
37
|
if ActionView::Base.try(:annotate_rendered_view_with_filenames) && template.format == :html
|
37
|
-
options
|
38
|
-
|
38
|
+
options = options.merge(
|
39
|
+
preamble: "<!-- BEGIN #{template.short_identifier} -->\n",
|
40
|
+
postamble: "<!-- END #{template.short_identifier} -->\n",
|
41
|
+
)
|
39
42
|
end
|
40
43
|
|
41
44
|
Engine.new(options).call(source)
|
data/lib/hamlit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hamlit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|