Skip to content

Commit

Permalink
Export special component tags
Browse files Browse the repository at this point in the history
  • Loading branch information
dextercd committed Oct 3, 2022
1 parent e8e7343 commit 78c3b11
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions component-explorer/comp_tag_util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,16 @@ comp_tag_util.special_tags = {
"fire",
}

function comp_tag_util.special_tags_xml_value(component_id)
local str = ""
for _, tag in ipairs(comp_tag_util.special_tags) do
if ComponentHasTag(component_id, tag) then
if str ~= "" then str = str .. "," end
str = str .. tag
end
end

return str
end

return comp_tag_util
6 changes: 6 additions & 0 deletions serialise_component.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local nxml = dofile_once("mods/component-explorer/deps/nxml.lua")
local comp_tag_util = dofile_once("mods/component-explorer/comp_tag_util.lua")
dofile_once("mods/component-explorer/serialise_component_fields.lua")

{% for component in component_documentation %}
Expand Down Expand Up @@ -47,6 +48,11 @@ function serialise_component(component_id, include_privates)

add_component_fields(component_id, type_name, component, include_privates)

local tags = comp_tag_util.special_tags_xml_value(component_id)
if tags ~= "" then
component.attr._tags = tags
end

return component
end

0 comments on commit 78c3b11

Please sign in to comment.