hamlit 2.16.0 → 2.16.1

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
  SHA256:
3
- metadata.gz: de464e04c0b09e109a52ccae59ad85ee2a07875eaf903d8d0208d8b4d24b3d7d
4
- data.tar.gz: a495ef4fc7e65d0e51a3538146a099d3c313b987fe11a03ef4da2468e2cabe5c
3
+ metadata.gz: 921962522202b469a63ef1efb1c6d40592e300d4fc77d6e11be1a6a60c74de82
4
+ data.tar.gz: 54b36f243114ab4d2f97b370c9c9a6a4b617e844ddf106fde2c2f8162972b18e
5
5
  SHA512:
6
- metadata.gz: 22f7bd667c39909360a6405768b71b30769d5ea3aeff02e067f48a05ee89c07dda6e2d5467eafb4f000233ece666704483e31e325bda0cb16e53cb88beb97668
7
- data.tar.gz: 83d3434d5953eebc388eeebddbf10f76d07dece448cacb00f96bfe0da80b8488fbc311002f81cc455ccdb5586ad70a21fd76497927fe656b586e2bcfde2b3bc1
6
+ metadata.gz: babaa44e8ba551564676bbfac32f2b14d9b5c1e2da6de71aa434cb1cc33dcb929a20569a5665ec2451489327beac0ece13a1d4b2d1bee834cabd744a0ef555f6
7
+ data.tar.gz: 93d5ae7dcc898e6376c21820c36c82d3ba481fbac14d1a1cff982640c22988e57cbd69cfa2d56816207d51e33970ba642d2d0f4ebf0537ba02073c87cad08b64
data/CHANGELOG.md CHANGED
@@ -4,6 +4,16 @@ 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
+ ## [2.16.1](https://github.com/k0kubun/hamlit/compare/v2.16.0...v2.16.1) - 2022-08-07
8
+
9
+ ### Added
10
+
11
+ - Introduce `:disable_capture` option to capture a block
12
+ - Default: `disable_capture: true` (backward-compatible)
13
+ - For Rails, this must be `true` anyway to use Rails-native capturing.
14
+ - If you override the option like `disable_capture: false` in Hamlit::Template,
15
+ you can capture a block content like `= render do ...`.
16
+
7
17
  ## [2.16.0](https://github.com/k0kubun/hamlit/compare/v2.15.2...v2.16.0) - 2022-02-03
8
18
 
9
19
  ### 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)
@@ -77,9 +78,10 @@ module Hamlit
77
78
  [:code, ')'],
78
79
  ]
79
80
  else
81
+ content = [:multi, [:newline], yield(node)]
80
82
  [:multi,
81
83
  [:block, "#{var} = #{node.value[:text]}",
82
- [:multi, [:newline], yield(node)],
84
+ @disable_capture ? content : [:capture, Temple::Utils.unique_name, content],
83
85
  ],
84
86
  ]
85
87
  end
@@ -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
@@ -22,6 +22,7 @@ module Hamlit
22
22
  param source track wbr),
23
23
  filename: "",
24
24
  check_syntax: false,
25
+ disable_capture: true,
25
26
  )
26
27
 
27
28
  use Parser
@@ -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[:preamble] = "<!-- BEGIN #{template.short_identifier} -->\n"
38
- options[:postamble] = "<!-- END #{template.short_identifier} -->\n"
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)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Hamlit
3
- VERSION = '2.16.0'
3
+ VERSION = '2.16.1'
4
4
  end
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: 2.16.0
4
+ version: 2.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-03 00:00:00.000000000 Z
11
+ date: 2022-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: temple
@@ -360,7 +360,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
360
360
  - !ruby/object:Gem::Version
361
361
  version: '0'
362
362
  requirements: []
363
- rubygems_version: 3.2.22
363
+ rubygems_version: 3.3.7
364
364
  signing_key:
365
365
  specification_version: 4
366
366
  summary: High Performance Haml Implementation