diff --git a/.rubocop.yml b/.rubocop.yml
index f301326..fcc8d46 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -153,5 +153,8 @@ Metrics/BlockLength:
- 'Rakefile'
- 'spec/**/*.rb'
+Style/MutableConstant:
+ Enabled: false
+
Style/Encoding:
Enabled: false
diff --git a/lib/inky.rb b/lib/inky.rb
index e0c1864..a97bfb6 100644
--- a/lib/inky.rb
+++ b/lib/inky.rb
@@ -40,6 +40,7 @@ def release_the_kraken(html_string)
html = Nokogiri::HTML.public_send(parse_cmd, str)
transform_doc(html)
string = html.to_html
+ string.gsub!(INTERIM_TH_TAG_REGEX, 'th')
Inky::Core.re_inject_raws(string, raws)
end
diff --git a/lib/inky/component_factory.rb b/lib/inky/component_factory.rb
index cc6b353..794e5b0 100644
--- a/lib/inky/component_factory.rb
+++ b/lib/inky/component_factory.rb
@@ -12,6 +12,11 @@ def component_factory(elem)
tags = tags.to_set if tags.respond_to? :to_set
IGNORED_ON_PASSTHROUGH = tags.freeze
+ # These constants are used to circumvent an issue with JRuby Nokogiri.
+ # For more details see https://github.com/zurb/inky-rb/pull/94
+ INTERIM_TH_TAG = 'inky-interim-th'.freeze
+ INTERIM_TH_TAG_REGEX = %r{(?<=\<|\<\/)#{Regexp.escape(INTERIM_TH_TAG)}}
+
def _pass_through_attributes(elem)
elem.attributes.reject { |e| IGNORED_ON_PASSTHROUGH.include?(e.downcase) }.map do |name, value|
%{#{name}="#{value}" }
@@ -60,7 +65,7 @@ def _transform_menu(component, inner)
def _transform_menu_item(component, inner)
target = _target_attribute(component)
attributes = _combine_attributes(component, 'menu-item')
- %{
#{inner} | }
+ %{<#{INTERIM_TH_TAG} #{attributes}>#{inner}#{INTERIM_TH_TAG}>}
end
def _transform_container(component, inner)
@@ -91,7 +96,7 @@ def _transform_columns(component, inner)
subrows = component.elements.css(".row").to_a.concat(component.elements.css("row").to_a)
expander = %{ | } if large_size.to_i == column_count && subrows.empty?
- %{ | }
+ %{<#{INTERIM_TH_TAG} class="#{classes}" #{_pass_through_attributes(component)}>#{INTERIM_TH_TAG}>}
end
def _transform_block_grid(component, inner)