From 2d60a5080ec39ac84a472b4ae1d9110fb24700e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lafortune?= Date: Mon, 6 Dec 2021 11:19:31 -0500 Subject: [PATCH] Implement `` [Fixes #106] Note: original inky's implementation seems completely broken https://github.com/foundation/inky/issues/137 https://github.com/foundation/inky/issues/136 --- lib/inky.rb | 3 ++- lib/inky/component_factory.rb | 6 ++++++ spec/cases/h_line/basic.inky | 1 + spec/cases/h_line/multiple.inky | 8 ++++++++ spec/cases/h_line/with_attr.inky | 2 ++ 5 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 spec/cases/h_line/basic.inky create mode 100644 spec/cases/h_line/multiple.inky create mode 100644 spec/cases/h_line/with_attr.inky diff --git a/lib/inky.rb b/lib/inky.rb index 4528251..8c936f1 100644 --- a/lib/inky.rb +++ b/lib/inky.rb @@ -20,7 +20,8 @@ def initialize(options = {}) callout: 'callout', spacer: 'spacer', wrapper: 'wrapper', - menu_item: 'item' + menu_item: 'item', + h_line: 'h-line', }.merge(::Inky.configuration.components).merge(options[:components] || {}) self.component_lookup = components.invert diff --git a/lib/inky/component_factory.rb b/lib/inky/component_factory.rb index 644f150..0f9b0e7 100644 --- a/lib/inky/component_factory.rb +++ b/lib/inky/component_factory.rb @@ -141,6 +141,12 @@ def _transform_spacer(component, _inner) end end + def _transform_h_line(component, _inner) + classes = _combine_classes(component, 'h-line') + attributes = _pass_through_attributes(component) + %{
 
} + end + def _transform_wrapper(component, inner) attributes = _combine_attributes(component, 'wrapper') %{
#{inner}
} diff --git a/spec/cases/h_line/basic.inky b/spec/cases/h_line/basic.inky new file mode 100644 index 0000000..abb7f75 --- /dev/null +++ b/spec/cases/h_line/basic.inky @@ -0,0 +1 @@ + diff --git a/spec/cases/h_line/multiple.inky b/spec/cases/h_line/multiple.inky new file mode 100644 index 0000000..79f4593 --- /dev/null +++ b/spec/cases/h_line/multiple.inky @@ -0,0 +1,8 @@ + +Hello + +World + +Bye + +Zzz diff --git a/spec/cases/h_line/with_attr.inky b/spec/cases/h_line/with_attr.inky new file mode 100644 index 0000000..03ec99a --- /dev/null +++ b/spec/cases/h_line/with_attr.inky @@ -0,0 +1,2 @@ + +