summaryrefslogtreecommitdiff
path: root/dev-ruby/asciidoctor/files/asciidoctor-2.0.18-haml-6.patch
blob: b6896999f83823a42946ea71abc52cd58a1048af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
https://sources.debian.org/patches/asciidoctor/2.0.18-2/0001-Port-tests-to-haml-6.patch/ (backport)
https://github.com/asciidoctor/asciidoctor/pull/4395

From 25ee484dd66cc813eaa421d1c104ae64478e51ff Mon Sep 17 00:00:00 2001
From: Antonio Terceiro <terceiro@debian.org>
Date: Mon, 26 Dec 2022 13:11:36 -0300
Subject: [PATCH] Port tests to haml 6

Forwarded: https://github.com/asciidoctor/asciidoctor/pull/4395
Fixes: #4382
--- a/asciidoctor.gemspec
+++ b/asciidoctor.gemspec
@@ -38,7 +38,7 @@ Gem::Specification.new do |s|
   s.add_development_dependency 'cucumber', '~> 3.1.0'
   # erubi is needed for testing alternate eRuby impls
   s.add_development_dependency 'erubi', '~> 1.10.0'
-  s.add_development_dependency 'haml', '~> 5.2.0'
+  s.add_development_dependency 'haml', '~> 6.1'
   s.add_development_dependency 'minitest', '~> 5.14.0'
   s.add_development_dependency 'nokogiri', '~> 1.10.0'
   s.add_development_dependency 'rake', '~> 12.3.0'
--- a/lib/asciidoctor/converter/template.rb
+++ b/lib/asciidoctor/converter/template.rb
@@ -29,7 +29,7 @@ class Converter::TemplateConverter < Con
     erb: { trim: 0 },
     # TODO line 466 of haml/compiler.rb sorts the attributes; file an issue to make this configurable
     # NOTE AsciiDoc syntax expects HTML/XML output to use double quotes around attribute values
-    haml: { format: :xhtml, attr_wrapper: '"', escape_attrs: false, ugly: true },
+    haml: { format: :xhtml, attr_quote: '"', escape_attrs: false, ugly: true },
     slim: { disable_escape: true, sort_attrs: false, pretty: false },
   }
 
--- a/test/converter_test.rb
+++ b/test/converter_test.rb
@@ -9,7 +9,7 @@ context 'Converter' do
       assert_kind_of Asciidoctor::Converter::CompositeConverter, doc.converter
       selected = doc.converter.find_converter('paragraph')
       assert_kind_of Asciidoctor::Converter::TemplateConverter, selected
-      assert_kind_of Tilt::HamlTemplate, selected.templates['paragraph']
+      assert_kind_of Haml::Template, selected.templates['paragraph']
       assert_equal :html5, selected.templates['paragraph'].options[:format]
     end
 
@@ -18,7 +18,7 @@ context 'Converter' do
       assert_kind_of Asciidoctor::Converter::CompositeConverter, doc.converter
       selected = doc.converter.find_converter('paragraph')
       assert_kind_of Asciidoctor::Converter::TemplateConverter, selected
-      assert_kind_of Tilt::HamlTemplate, selected.templates['paragraph']
+      assert_kind_of Haml::Template, selected.templates['paragraph']
       assert_equal :xhtml, selected.templates['paragraph'].options[:format]
     end
 
@@ -95,7 +95,7 @@ context 'Converter' do
       %w(paragraph sidebar).each do |node_name|
         selected = doc.converter.find_converter node_name
         assert_kind_of Asciidoctor::Converter::TemplateConverter, selected
-        assert_kind_of Tilt::HamlTemplate, selected.templates[node_name]
+        assert_kind_of Haml::Template, selected.templates[node_name]
         assert_equal %(block_#{node_name}.html.haml), File.basename(selected.templates[node_name].file)
       end
     end
@@ -126,7 +126,7 @@ context 'Converter' do
       %w(paragraph).each do |node_name|
         selected = doc.converter.find_converter node_name
         assert_kind_of Asciidoctor::Converter::TemplateConverter, selected
-        assert_kind_of Tilt::HamlTemplate, selected.templates[node_name]
+        assert_kind_of Haml::Template, selected.templates[node_name]
         assert_equal %(block_#{node_name}.xml.haml), File.basename(selected.templates[node_name].file)
       end
     end
@@ -215,7 +215,7 @@ context 'Converter' do
       refute_empty caches[:templates]
       paragraph_template = caches[:templates].values.find {|t| File.basename(t.file) == 'block_paragraph.html.haml' }
       refute_nil paragraph_template
-      assert_kind_of ::Tilt::HamlTemplate, paragraph_template
+      assert_kind_of Haml::Template, paragraph_template
     end
 
     test 'should be able to disable template cache' do
--- a/test/fixtures/custom-backends/haml/docbook5/block_paragraph.xml.haml
+++ b/test/fixtures/custom-backends/haml/docbook5/block_paragraph.xml.haml
@@ -1,6 +1,6 @@
 - if title?
   %formalpara{'xml:id'=>@id, role: (attr :role), xreflabel: (attr :reftext)}
-    %title=title
-    %para=content
+    %title!=title
+    %para!=content
 - else
-  %para{'xml:id'=>@id, role: (attr :role), xreflabel: (attr :reftext)}=content
+  %para{'xml:id'=>@id, role: (attr :role), xreflabel: (attr :reftext)}!=content
--- a/test/fixtures/custom-backends/haml/html5-tweaks/block_paragraph.html.haml
+++ b/test/fixtures/custom-backends/haml/html5-tweaks/block_paragraph.html.haml
@@ -1 +1 @@
-%p=content
+%p!=content
--- a/test/fixtures/custom-backends/haml/html5-tweaks/embedded.html.haml
+++ b/test/fixtures/custom-backends/haml/html5-tweaks/embedded.html.haml
@@ -1 +1 @@
-=content
+!=content
--- a/test/fixtures/custom-backends/haml/html5/block_paragraph.html.haml
+++ b/test/fixtures/custom-backends/haml/html5/block_paragraph.html.haml
@@ -1,3 +1,3 @@
 - if title?
-  .title=title
-%p{id: @id, class: (attr 'role')}=content
+  .title!=title
+%p{id: @id, class: (attr 'role')}!=content
--- a/test/fixtures/custom-backends/haml/html5/block_sidebar.html.haml
+++ b/test/fixtures/custom-backends/haml/html5/block_sidebar.html.haml
@@ -1,5 +1,5 @@
 %aside{id: @id, class: (attr 'role')}
   - if title?
     %header
-      %h1=title
-  =content.chomp
+      %h1!=title
+  !=content.chomp
--- a/test/invoker_test.rb
+++ b/test/invoker_test.rb
@@ -616,7 +616,7 @@ context 'Invoker' do
     assert_kind_of Asciidoctor::Converter::CompositeConverter, doc.converter
     selected = doc.converter.find_converter 'paragraph'
     assert_kind_of Asciidoctor::Converter::TemplateConverter, selected
-    assert_kind_of Tilt::HamlTemplate, selected.templates['paragraph']
+    assert_kind_of Haml::Template, selected.templates['paragraph']
   end
 
   test 'should load custom templates from multiple template directories' do