diff --git a/Scripts/Constants.gd b/Scripts/Constants.gd index 6a3e95e..b14432d 100644 --- a/Scripts/Constants.gd +++ b/Scripts/Constants.gd @@ -80,13 +80,11 @@ var HTML_CONTENT = """

📝 Recent Activity

-
- -
+ diff --git a/Scripts/Tags/ol.gd b/Scripts/Tags/ol.gd index 8b73681..4e84070 100644 --- a/Scripts/Tags/ol.gd +++ b/Scripts/Tags/ol.gd @@ -72,7 +72,18 @@ func create_li_node(element: HTMLParser.HTMLElement, list_type: String, index: i li_container.add_child(marker_label) li_container.add_child(content_label) - return li_container + var styles = parser.get_element_styles_with_inheritance(element, "", []) + if BackgroundUtils.needs_background_wrapper(styles): + var panel_container = BackgroundUtils.create_panel_container_with_background(styles) + panel_container.name = "Li" + # Get the VBoxContainer inside PanelContainer and replace it with our HBoxContainer + var vbox = panel_container.get_child(0) + panel_container.remove_child(vbox) + vbox.queue_free() + panel_container.add_child(li_container) + return panel_container + else: + return li_container func get_marker_for_type(list_type: String, index: int) -> String: match list_type: diff --git a/Scripts/Tags/ul.gd b/Scripts/Tags/ul.gd index 2f29960..358d64f 100644 --- a/Scripts/Tags/ul.gd +++ b/Scripts/Tags/ul.gd @@ -66,7 +66,18 @@ func create_li_node(element: HTMLParser.HTMLElement, list_type: String, marker_w li_container.add_child(bullet_label) li_container.add_child(content_label) - return li_container + var styles = parser.get_element_styles_with_inheritance(element, "", []) + if BackgroundUtils.needs_background_wrapper(styles): + var panel_container = BackgroundUtils.create_panel_container_with_background(styles) + panel_container.name = "Li" + # Get the VBoxContainer inside PanelContainer and replace it with our HBoxContainer + var vbox = panel_container.get_child(0) + panel_container.remove_child(vbox) + vbox.queue_free() + panel_container.add_child(li_container) + return panel_container + else: + return li_container func get_bullet_for_type(list_type: String) -> String: match list_type: diff --git a/Scripts/main.gd b/Scripts/main.gd index 7cb5023..7e1cc96 100644 --- a/Scripts/main.gd +++ b/Scripts/main.gd @@ -49,7 +49,6 @@ func render() -> void: parser.process_styles() - print("Total elements found: " + str(parse_result.all_elements.size())) if parse_result.errors.size() > 0: print("Parse errors: " + str(parse_result.errors)) @@ -148,8 +147,25 @@ func create_element_node(element: HTMLParser.HTMLElement, parser: HTMLParser) -> final_node = AUTO_SIZING_FLEX_CONTAINER.new() final_node.name = "Flex_" + element.tag_name container_for_children = final_node + + # For FLEX ul/ol elements, we need to create the li children directly in the flex container + if element.tag_name == "ul" or element.tag_name == "ol": + final_node.flex_direction = FlexContainer.FlexDirection.Column + + website_container.add_child(final_node) + + var temp_list = UL.instantiate() if element.tag_name == "ul" else OL.instantiate() + website_container.add_child(temp_list) + await temp_list.init(element, parser) + + for child in temp_list.get_children(): + temp_list.remove_child(child) + container_for_children.add_child(child) + + website_container.remove_child(temp_list) + temp_list.queue_free() # If the element itself has text (like TEXT) - if not element.text_content.is_empty(): + elif not element.text_content.is_empty(): var new_node = await create_element_node_internal(element, parser) container_for_children.add_child(new_node) else: @@ -248,12 +264,12 @@ func create_element_node_internal(element: HTMLParser.HTMLElement, parser: HTMLP "ul": node = UL.instantiate() website_container.add_child(node) - await node.init(element) + await node.init(element, parser) return node "ol": node = OL.instantiate() website_container.add_child(node) - await node.init(element) + await node.init(element, parser) return node "li": node = LI.instantiate()