jalvesaq / zotcite

Neovim plugin for integration with Zotero
GNU General Public License v3.0
161 stars 13 forks source link

Improper title in the citation key #26

Closed whytong closed 3 years ago

whytong commented 3 years ago

Given the title of a paper (a citation) is 'The COVID19 study', the generated citekey becomes @zotkey#Author_2020_The. It seems the ptrn defining line in the _calculate_citekeys

ptrn = '^(' + ' |'.join(self._bwords) + ' )'
# which gives '^(a |  |a |n |  |t |h |e |  |s |o |m |e |  |f |r |o |m |  |o |n |  |i |n |  |t |o |  |o |f |  |d |o |  |w |i |t |h )'

does not achieve the intended goal. Also this line in the same function

titlew = re.sub('[ ,;:\.!?].*', '', title)

Removes all words after "The". I assume the intended title shall be @zotkey#Author_2020_COVID19Study.

Sorry, I'm not a beginner in Python coding and does not know how to fix this.

jalvesaq commented 3 years ago

Thanks for reporting the issue! I believe it's fixed now.

whytong commented 3 years ago

Thanks for reporting the issue! I believe it's fixed now.

Thanks. Yes, the banned words issue is fixed. I'm not sure about the generated title. It seems only the first word not in the banned list is kept for the citekey. In the example of "The COVID19 study", the cite key becomes @zotkey#Author_2020_COVID19 If that was intended originally, then the issue can be closed.

jalvesaq commented 3 years ago

Yes, this was intended because, otherwise, the citation key would be too long. The first word is just a reminder of the entire title. I actually prefer only the last author's name and year because this is what will appear in the rendered document.