mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
strip punctuation characters around selected word
This commit is contained in:
@@ -39,6 +39,10 @@ end
|
||||
function ReaderDictionary:stardictLookup(word)
|
||||
DEBUG("lookup word:", word)
|
||||
if word then
|
||||
-- strip punctuation characters around selected word
|
||||
word = string.gsub(word, "^%p+", '')
|
||||
word = string.gsub(word, "%p+$", '')
|
||||
DEBUG("stripped word:", word)
|
||||
-- escape quotes and other funny characters in word
|
||||
local std_out = io.popen("./sdcv -nj "..("%q"):format(word), "r")
|
||||
local results_str = std_out:read("*all")
|
||||
@@ -67,6 +71,7 @@ function ReaderDictionary:showDict(result)
|
||||
-- })
|
||||
if result then
|
||||
UIManager:show(DictQuickLookup:new{
|
||||
ui = self.ui,
|
||||
dict = result.dict,
|
||||
definition = result.definition,
|
||||
id = result.ID,
|
||||
|
||||
Reference in New Issue
Block a user