Skip to content

Commit 348061b

Browse files
committed
Empty tags were incorrectly merged with the words prior to the tag
Fixes #57
1 parent c216520 commit 348061b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

richtext/parse.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ end
4949
local function add_word(text, settings, words)
5050
-- handle HTML entities
5151
text = text:gsub("&lt;", "<"):gsub("&gt;", ">"):gsub("&nbsp;", " ")
52-
52+
5353
local data = { text = text }
5454
for k,v in pairs(settings) do
5555
data[k] = v
@@ -171,9 +171,9 @@ function M.parse(text, default_settings)
171171
if is_empty then
172172
-- empty tag, ie tag without content
173173
-- example <br/> and <img=texture:image/>
174-
local tag_settings = parse_tag(name, params)
175-
merge_tags(word_settings, tag_settings)
176-
add_word("", word_settings, all_words)
174+
local empty_tag_settings = parse_tag(name, params)
175+
merge_tags(empty_tag_settings, word_settings)
176+
add_word("", empty_tag_settings, all_words)
177177
elseif not is_endtag then
178178
-- open tag - parse and add it
179179
local tag_settings = parse_tag(name, params)

0 commit comments

Comments
 (0)