Skip to content

Commit

Permalink
Treat each zero-width space as a word
Browse files Browse the repository at this point in the history
  • Loading branch information
britzl committed Sep 10, 2019
1 parent 3341af6 commit 714277f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion richtext/parse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ end
-- add a single word to the list of words
local function add_word(text, settings, words)
-- handle HTML entities
text = text:gsub("&lt;", "<"):gsub("&gt;", ">"):gsub("&nbsp;", " "):gsub("&zwsp;", "\226\128\139")
text = text:gsub("&lt;", "<"):gsub("&gt;", ">"):gsub("&nbsp;", " ")

local data = { text = text }
for k,v in pairs(settings) do
Expand Down Expand Up @@ -134,6 +134,7 @@ function M.parse(text, default_settings)
assert(text)
assert(default_settings)

text = text:gsub("&zwsp;", "<zwsp>\226\128\139</zwsp>")
local all_words = {}
local open_tags = {}
while true do
Expand Down

0 comments on commit 714277f

Please sign in to comment.