Skip to content

Commit

Permalink
Revert "Don't crash on manual lookup from filemanager either"
Browse files Browse the repository at this point in the history
This reverts commit b6b4ead.

This is not actually necessary now because there should be no situation
where there's no document available
  • Loading branch information
nairyo committed Dec 13, 2023
1 parent 0fdd269 commit 1cc0d36
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions ankinote.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ end
-- Create metadata string about the document the word came from.
-- ]]
function AnkiNote:get_metadata()
if not self.ui.document then
return
end
local meta = self.ui.document._anki_metadata
return string.format("%s - %s (%d/%d)", meta.author, meta.title, meta:current_page(), meta.pages)
end
Expand Down Expand Up @@ -126,9 +123,6 @@ function AnkiNote:get_custom_context(pre_s, pre_c, post_s, post_c)
end

function AnkiNote:get_picture_context()
if not self.ui.document then
return
end
local meta = self.ui.document._anki_metadata
if not meta then
return
Expand Down Expand Up @@ -271,7 +265,7 @@ function AnkiNote:new(popup_dict)
selected_dict = popup_dict.results[popup_dict.dict_index],
-- indicates that popup_dict relates to word in book
-- this can still be set to false later when the user looks up a word in a book, but then modifies the looked up word
contextual_lookup = self.ui.highlight and self.ui.highlight.selected_text ~= nil,
contextual_lookup = self.ui.highlight.selected_text ~= nil,
word_trim = { before = "", after = "" },
tags = { "KOReader" },
}
Expand Down

0 comments on commit 1cc0d36

Please sign in to comment.