From 61290fb71d88bb69b3fbc5f6e74ef6ce78b3ae7e Mon Sep 17 00:00:00 2001 From: reverend Date: Fri, 19 Mar 2021 12:23:43 +0100 Subject: [PATCH] cIndex 0 check --- components/00_Tools/_bemGenerator.styl | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/components/00_Tools/_bemGenerator.styl b/components/00_Tools/_bemGenerator.styl index 1d3baae..1ba4ead 100644 --- a/components/00_Tools/_bemGenerator.styl +++ b/components/00_Tools/_bemGenerator.styl @@ -5,7 +5,7 @@ _bem_context = { known_names: {} } -//bem_debug = false !default +bem_debug = false work_stack(stack, callback) while length(stack) > 0 @@ -114,7 +114,7 @@ filter(list, value_list) push(filtered, element) return filtered -RV-Level(name_delimiter, selector_callback, name=null, super_parents=null) +RV-Level(name_delimiter, selector_callback, name=null) call_stack = split(' ', ''+called-from) call_stack = filter(call_stack, ('RV-Level' 'RV-Block' 'RV-Block--modifier' 'RV-Element' 'RV-Element--modifier' 'RV-Modifier')) @@ -124,7 +124,6 @@ RV-Level(name_delimiter, selector_callback, name=null, super_parents=null) name = auto_name(name_delimiter, mixin_name) cindex = contigious_index(call_stack) - nested_in_super_parents = is_nested_in(super_parents) if bem_debug --attempt mixin_name @@ -132,7 +131,7 @@ RV-Level(name_delimiter, selector_callback, name=null, super_parents=null) --nested_in_super_parents nested_in_super_parents // TODO Clear up this logic - if cindex == -1 || nested_in_super_parents + if cindex != 0 if name == null name = pop_last_alias() name = lookup_alias(name) @@ -142,7 +141,7 @@ RV-Level(name_delimiter, selector_callback, name=null, super_parents=null) if name == '' selector_name = split(name_delimiter, selector_name)[0] - if cindex != -1 && nested_in_super_parents && !(name in _bem_context.known_names) + if cindex > 0 && !(name in _bem_context.known_names) return else _bem_context.known_names[name] = name @@ -153,7 +152,7 @@ RV-Level(name_delimiter, selector_callback, name=null, super_parents=null) if bem_debug --mixin_name mixin_name --name name - else if cindex <= 0 + else store_alias(name) {block} if bem_debug