hamlit 2.15.2-java → 2.16.2-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f965a5e90ebe0386f30191817e1e863539eb6ed308ac54dc86889fd6e405f40
4
- data.tar.gz: 976c904d82d5e8fd67046c631b3b8a0372a2b3cdd9f74745f62b2a2f8c0f2d37
3
+ metadata.gz: 82b1954dd2f447f3351274d1eb8b7aab0cc3e241c137bf0af1bad3a6c0224884
4
+ data.tar.gz: 3a80f13f9c16722bf9b492a7666741ba235d732eb906724729b8cde5e257f81f
5
5
  SHA512:
6
- metadata.gz: 9802c20f7102db16aa338f57d268ee8305d502812d6a24e5ad92ff17d94347d5018f84e6d93137f6efbab4cebbe7608573bab318a9c2064915f849720361a03d
7
- data.tar.gz: 7d00e40daaf4f9b4c3f2e167f7cbe22e99badc1a37971fd4d8df788a6842c3b9dc643b10e2d048e719b3ac2f49302719c3994cdc7a2324f319c2aa54028873da
6
+ metadata.gz: 9aeda4f739eeb2b18dd029a4727fe1b6325f9f80c2483ab607211994651e3f1d219738df7ed75cb1d638423e65c3d999ecfd63586e26d3f022f190ae9b72d8bb
7
+ data.tar.gz: beae99e9412e203580ed8a2610acee46ed3da1316e0a6530533dd372e73d9fd7c10d114d4ac512174beb84f32b4f372ea74d355acbb3a9580eb13851ca23db95
data/CHANGELOG.md CHANGED
@@ -4,6 +4,30 @@ 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.2](https://github.com/k0kubun/hamlit/compare/v2.16.1...v2.16.2) - 2022-08-07
8
+
9
+ ### Fixed
10
+
11
+ - Fix an issue when `disable_capture: false` is set and a Ruby comment is put after `do`
12
+
13
+ ## [2.16.1](https://github.com/k0kubun/hamlit/compare/v2.16.0...v2.16.1) - 2022-08-07
14
+
15
+ ### Added
16
+
17
+ - Introduce `:disable_capture` option to capture a block
18
+ - Default: `disable_capture: true` (backward-compatible)
19
+ - For Rails, this must be `true` anyway to use Rails-native capturing.
20
+ - If you override the option like `disable_capture: false` in Hamlit::Template,
21
+ you can capture a block content like `= render do ...`.
22
+
23
+ ## [2.16.0](https://github.com/k0kubun/hamlit/compare/v2.15.2...v2.16.0) - 2022-02-03
24
+
25
+ ### Added
26
+
27
+ - Raise an exception on a Haml-level syntax error with `hamlit compile -c`
28
+ [#189](https://github.com/k0kubun/hamlit/issues/189)
29
+ *Thanks to @dlwr*
30
+
7
31
  ## [2.15.2](https://github.com/k0kubun/hamlit/compare/v2.15.1...v2.15.2) - 2022-01-04
8
32
 
9
33
  ### Fixed
data/lib/hamlit/cli.rb CHANGED
@@ -106,6 +106,7 @@ module Hamlit
106
106
  Hamlit::Engine.options.to_h.merge(
107
107
  escape_attrs: options[:escape_attrs],
108
108
  escape_html: options[:escape_html],
109
+ check_syntax: options[:check],
109
110
  )
110
111
  end
111
112
 
@@ -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
@@ -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
@@ -21,6 +21,8 @@ module Hamlit
21
21
  hr img input isindex keygen link menuitem meta
22
22
  param source track wbr),
23
23
  filename: "",
24
+ check_syntax: false,
25
+ disable_capture: true,
24
26
  )
25
27
 
26
28
  use Parser
data/lib/hamlit/parser.rb CHANGED
@@ -20,6 +20,7 @@ module Hamlit
20
20
  autoclose
21
21
  escape_html
22
22
  escape_attrs
23
+ check_syntax
23
24
  ].freeze
24
25
 
25
26
  def initialize(options = {})
@@ -35,6 +36,7 @@ module Hamlit
35
36
  end
36
37
  HamlParser.new(HamlOptions.new(@options)).call(template)
37
38
  rescue ::Hamlit::HamlError => e
39
+ raise e if @options[:check_syntax]
38
40
  error_with_lineno(e)
39
41
  end
40
42
 
@@ -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.15.2'
3
+ VERSION = '2.16.2'
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.15.2
4
+ version: 2.16.2
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-01-05 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
  requirement: !ruby/object:Gem::Requirement
@@ -359,7 +359,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
359
359
  - !ruby/object:Gem::Version
360
360
  version: '0'
361
361
  requirements: []
362
- rubygems_version: 3.1.6
362
+ rubygems_version: 3.2.29
363
363
  signing_key:
364
364
  specification_version: 4
365
365
  summary: High Performance Haml Implementation