[wellwell] Tweak lookup of attributes to accommodate dash mangling by Interchange.
Stefan Hornburg <[email protected]> Thu, 09 Feb 2017 11:18:21 +0000
| Newsgroups | gmane.comp.web.interchange.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit e19840cf71af5f787d949db82da6ec171204869a Author: Stefan Hornburg (Racke) <[email protected]> Date: Thu Feb 9 12:16:57 2017 +0100 Tweak lookup of attributes to accommodate dash mangling by Interchange. lib/WellWell/Compose.pm | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) --- diff --git a/lib/WellWell/Compose.pm b/lib/WellWell/Compose.pm index eae8748..7647a7f 100644 --- a/lib/WellWell/Compose.pm +++ b/lib/WellWell/Compose.pm @@ -229,10 +229,17 @@ sub compose { # TODO support multiple aliases my ($name, $alias) = split(/=/, $comp, 2); + my ($name_lookup, $alias_lookup) = ($name, $alias); + + # dash will be mangled by Interchange in + # [compose components.sidebar="sidebar-menu" attributes.sidebar-menu.topnav="..."] + + $name_lookup =~ s/-/_/g; + $alias_lookup =~ s/-/_/g; $component_attributes = { - $attributes{$name} ? %{$attributes{$name}} : (), - $attributes{$alias} ? %{$attributes{$alias}} : (), + $attributes{$name_lookup} ? %{$attributes{$name_lookup}} : (), + $attributes{$alias_lookup} ? %{$attributes{$alias_lookup}} : (), }; # temporarily assign variables for component attributes