Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions anki_configuration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ local Configuration = {
Setting:new{ id = 'def_field', required = true },
Setting:new{ id = 'dupe_scope', default = 'deck' },
Setting:new{ id = 'allow_dupes', default = false },
Setting:new{ id = 'trust_first_dict', default = false },
Setting:new{ id = 'custom_tags', default = {} },
Setting:new{ id = 'enabled_extensions', default = {} },
Setting:new{ id = 'context_field' },
Expand Down
4 changes: 3 additions & 1 deletion ankinote.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ local AnkiNote = {
-- We want to know if last dict lookup is contained in first dict lookup.
-- e.g.: '広大な' -> trimmed to '広大' -> context is '' (before), 'な' (after)
--]]

function AnkiNote:set_word_trim()
local list = self.popup_dict.window_list
if #list == 1 then
if #list == 1 or conf.trust_first_dict:get_value() then
self.popup_dict.word = list[1].word -- often useless
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in what case is this not useless? self.popup_dict here should always be the top level dict window so isn't that always what you want?

return
end
local orig, last = list[1].word, list[#list].word
Expand Down
7 changes: 7 additions & 0 deletions menubuilder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ local menu_entries = {
description = "Allow creation of duplicate notes",
conf_type = "bool",
},
{
id = "trust_first_dict",
group = general_settings,
name = "Use first lookup context",
description = "Blindly use word and sentence context from first lookup when doing nested lookups",
conf_type = "bool",
},
{
id = "dupe_scope",
group = general_settings,
Expand Down
2 changes: 2 additions & 0 deletions profiles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ local Config = {
-- It is possible to toggle whether duplicate notes can be created. This can be of use if your note type contains the full sentence as first field (meaning this gets looked at for uniqueness)
-- When multiple unknown words are present, it won't be possible to add both in this case, because the sentence would be the same.
allow_dupes = false,
-- When adding words within nested windows (like a dictionary lookup from a dictionary window), take original lookup as word
trust_first_dict = false,
-- The scope where ankiconnect will look to to find duplicates
dupe_scope = "deck",
-- api key - extra authentication supported by ankiconnect, see https://git.foosoft.net/alex/anki-connect#authentication
Expand Down