haml 6.2.1 → 6.2.3

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: 28980224aeb7aaf767631d85d1a25371bd1e1fd78b87afa34ba5e300ee397126
4
- data.tar.gz: c6e6cf4c766238cf501eb7695d75bc973746010a0c11bc90bce88d51d3d6b20d
3
+ metadata.gz: e0e28e40ec5137482caae5c2fb466d21976027139b3f39d428035dbd35914774
4
+ data.tar.gz: c906550bd147f7e6a2961ebd07bc59fcc69b3433c454141cb2ae29e1ccd64e2b
5
5
  SHA512:
6
- metadata.gz: 42427402b30e767c124156562de33826ba7e16905a71ee38d494182bb0bd2f7f29135c1fd736702932ca656b94d3fdf8503e5829bd1d4cf62928eb3703261123
7
- data.tar.gz: a8786a46da773e42d90bca9c29a9003a07be1a0b0f4ef2ad8ce7af117566ea96e891bc13ec22ccb5ab3ad0b6c62be8f247c7ac5b9db279c2f21cd0e4b3d06576
6
+ metadata.gz: '0583d8a879f6c7eda656d6c956a9e5573eedd5f94d14b28d378af85bbab73f220499b9c8021af0bad5946c95073cd1201d2d2765556e138696462bf2d28a4304'
7
+ data.tar.gz: 2847f03720469d3eaabcc689f628198569f668b1c87c70f67422c70ed1af25103998cc004a86d9f430d57fb12f88078ef2fa27d544dad69ad9df95cc9241bfdd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Haml Changelog
2
2
 
3
+ ## 6.2.3
4
+
5
+ * Resurrect RDFa doctype support [#1147](https://github.com/haml/haml/issues/1147)
6
+
7
+ ## 6.2.2
8
+
9
+ * Allow adding custom attributes to `Haml::BOOLEAN_ATTRIBUTES` [#1148](https://github.com/haml/haml/issues/1148)
10
+ * Consider `aria-xxx: false` as a boolean attribute
11
+
3
12
  ## 6.2.1
4
13
 
5
14
  * Fix v6.2.0's bug in rendering dynamic `aria` attributes [#1149](https://github.com/haml/haml/issues/1149)
@@ -2,15 +2,8 @@
2
2
  require 'haml/object_ref'
3
3
 
4
4
  module Haml::AttributeBuilder
5
- BOOLEAN_ATTRIBUTES = %w[disabled readonly multiple checked autobuffer
6
- autoplay controls loop selected hidden scoped async
7
- defer reversed ismap seamless muted required
8
- autofocus novalidate formnovalidate open pubdate
9
- itemscope allowfullscreen default inert sortable
10
- truespeed typemustmatch download].freeze
11
-
12
5
  class << self
13
- def build(escape_attrs, quote, format, boolean_attributes, object_ref, *hashes)
6
+ def build(escape_attrs, quote, format, object_ref, *hashes)
14
7
  hashes << Haml::ObjectRef.parse(object_ref) if object_ref
15
8
  buf = []
16
9
  hash = merge_all_attrs(hashes)
@@ -26,7 +19,7 @@ module Haml::AttributeBuilder
26
19
  buf << build_data(escape_attrs, quote, *hash[key])
27
20
  when 'aria'
28
21
  buf << build_aria(escape_attrs, quote, *hash[key])
29
- when *boolean_attributes, /\Adata-/
22
+ when *Haml::BOOLEAN_ATTRIBUTES, /\Adata-/, /\Aaria-/
30
23
  build_boolean!(escape_attrs, quote, format, buf, key, hash[key])
31
24
  else
32
25
  buf << " #{key}=#{quote}#{escape_html(escape_attrs, hash[key].to_s)}#{quote}"
@@ -4,6 +4,14 @@ require 'haml/attribute_parser'
4
4
  require 'haml/ruby_expression'
5
5
 
6
6
  module Haml
7
+ # The list of boolean attributes. You may add custom attributes to this constant.
8
+ BOOLEAN_ATTRIBUTES = %w[disabled readonly multiple checked autobuffer
9
+ autoplay controls loop selected hidden scoped async
10
+ defer reversed ismap seamless muted required
11
+ autofocus novalidate formnovalidate open pubdate
12
+ itemscope allowfullscreen default inert sortable
13
+ truespeed typemustmatch download]
14
+
7
15
  class AttributeCompiler
8
16
  def initialize(identity, options)
9
17
  @identity = identity
@@ -31,10 +39,7 @@ module Haml
31
39
  attrs = []
32
40
  attrs.unshift(node.value[:attributes].inspect) if node.value[:attributes] != {}
33
41
 
34
- args = [
35
- @escape_attrs.inspect, "#{@quote.inspect}.freeze", @format.inspect,
36
- '::Haml::AttributeBuilder::BOOLEAN_ATTRIBUTES', node.value[:object_ref],
37
- ] + attrs
42
+ args = [@escape_attrs.inspect, "#{@quote.inspect}.freeze", @format.inspect, node.value[:object_ref]] + attrs
38
43
  [:html, :attrs, [:dynamic, "::Haml::AttributeBuilder.build(#{args.join(', ')}, #{node.value[:dynamic_attributes].to_literal})"]]
39
44
  end
40
45
 
@@ -52,7 +57,7 @@ module Haml
52
57
  compile_class!(temple, key, values)
53
58
  when 'data', 'aria'
54
59
  compile_data!(temple, key, values)
55
- when *AttributeBuilder::BOOLEAN_ATTRIBUTES, /\Adata-/, /\Aaria-/
60
+ when *BOOLEAN_ATTRIBUTES, /\Adata-/, /\Aaria-/
56
61
  compile_boolean!(temple, key, values)
57
62
  else
58
63
  compile_common!(temple, key, values)
@@ -8,10 +8,12 @@ module Haml
8
8
 
9
9
  def compile(node)
10
10
  case node.value[:type]
11
- when 'xml'
12
- xml_doctype
13
11
  when ''
14
12
  html_doctype(node)
13
+ when 'xml'
14
+ xml_doctype
15
+ when 'rdfa'
16
+ rdfa_doctype
15
17
  else
16
18
  [:html, :doctype, node.value[:type]]
17
19
  end
@@ -41,6 +43,10 @@ module Haml
41
43
  [:multi]
42
44
  end
43
45
  end
46
+
47
+ def rdfa_doctype
48
+ [:static, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">']
49
+ end
44
50
  end
45
51
  end
46
52
  end
data/lib/haml/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Haml
3
- VERSION = '6.2.1'
3
+ VERSION = '6.2.3'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.1
4
+ version: 6.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Natalie Weizenbaum
@@ -337,7 +337,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
337
337
  - !ruby/object:Gem::Version
338
338
  version: '0'
339
339
  requirements: []
340
- rubygems_version: 3.4.10
340
+ rubygems_version: 3.3.26
341
341
  signing_key:
342
342
  specification_version: 4
343
343
  summary: An elegant, structured (X)HTML/XML templating engine.