@@ -2055,25 +2055,37 @@ end docsFileGetUTF8Contents
20552055-- Find all lcdoc files in pFolder and add them to the list of docs
20562056-- data in xLibraryA
20572057private command addToDictionaryFromFolder pFolder, @xLibraryA
2058- local tDefaultFolder
2059- put the defaultFolder into tDefaultFolder
2060-
20612058 docsBuilderProgressUpdate "" , "Building dictionary from folder" && pFolder
2062- set the defaultfolder to pFolder
2063- get the files
2059+ get files (pFolder )
20642060 filter it with "*.lcdoc"
20652061 repeat for each line tFile in it
2066- local tText , tParsedA
2062+ local tText , tParsedA , tDisplayName , tSynonymA
20672063 wait 0 with messages
20682064 put docsFileGetUTF8Contents(pFolder & slash & tFile , true ) into tText
20692065 put revDocsParseDocText(tText ) into tParsedA
20702066 repeat for each element tDoc in tParsedA ["doc" ]
2067+ put tDoc ["display name" ] into tDisplayName
20712068 -- TODO: Work out why something empty is returned
2072- if tDoc [ "display name" ] is empty then next repeat
2069+ if tDisplayName is empty then next repeat
20732070 addToList tDoc , xLibraryA
2071+ -- BWM fix for Bug 18305
2072+ -- add an additional entry to dictionary for each synonym to allow keyword search
2073+ if tDoc ["Synonyms" ] is not empty then
2074+ put tDoc ["Synonyms" ] into tSynonymA
2075+ repeat for each element tSynonymName in tSynonymA
2076+ local tSynonymDoc
2077+ if tSynonymName is tDisplayName then next repeat -- glossary entries include themselves
2078+ put tDoc into tSynonymDoc
2079+ put tSynonymName into tSynonymDoc ["display name" ]
2080+ if tDoc ["Type" ] is not "glossary" then
2081+ put " (Synonym of " & tDisplayName & ")" after tSynonymDoc ["display name" ]
2082+ end if
2083+ addToList tSynonymDoc , xLibraryA
2084+ end repeat
2085+ end if
2086+ -- end fix for Bug 18305
20742087 end repeat
20752088 end repeat
2076- set the defaultFolder to tDefaultFolder
20772089end addToDictionaryFromFolder
20782090
20792091/*
0 commit comments