-- Separate the functions to format props, children, and element,
-- so a plugin could override a particular function, if needed.
-- Too bad, so sad: the traditional (but unnecessary) space
-- in a self-closing tagColor requires a second test of printedProps.

function printElement(
	type_: string,
	printedProps: string,
	printedChildren: string,
	config: Config,
	indentation: string
): string
	-- ROBLOX deviation START: adding default value as we don't support colors
	local colors = config.colors or DEFAULT_COLORS
	local tagColor = colors.tag
	-- ROBLOX deviation END
	return tagColor.open
		.. "<"
		.. type_
		.. (if Boolean.toJSBoolean(printedProps)
			then tagColor.close .. printedProps .. config.spacingOuter .. indentation .. tagColor.open
			else printedProps)
		.. (if Boolean.toJSBoolean(printedChildren)
			then
				">"
				.. tagColor.close
				.. printedChildren
				.. config.spacingOuter
				.. indentation
				.. tagColor.open
				.. "</"
				.. type_
			else (if Boolean.toJSBoolean(printedProps) and not Boolean.toJSBoolean(config.min) then "" else " ") .. "/")
		.. ">"
		.. tagColor.close
end
exports.printElement = printElement

function printElementAsLeaf(type_: string, config: Config): string
	-- ROBLOX deviation START: adding default value as we don't support colors
	local colors = config.colors or DEFAULT_COLORS
	local tagColor = colors.tag
	-- ROBLOX deviation END
	return tagColor.open .. "<" .. type_ .. tagColor.close .. " …" .. tagColor.open .. " />" .. tagColor.close
end
exports.printElementAsLeaf = printElementAsLeaf

return exports
