altairwei / altairwei/ZoteroLinkCitation
Problem with quotes in titles
- 主要言語
- VBA
- スター
- 138
- フォーク
- 13
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
First of all, thanks a lot for this script. It is super helpful. And I encountered a minor issue with it.
The script fails to find the item in bibliography in a rare cases when the title contains quotes (like in _Comment to "..."_) and a citation style puts all titles into quotes. Then Zotero changes double quotes in title (internal) to single ones to avoid confusion. But that means that the title in bibliography is different from the title in Zotero.
I could make a dirty fix for that by adding
```bas
title = DoubleToSingleQuotes(title)
```
before [this code](https://github.com/altairwei/ZoteroLinkCitation/blob/934a9065846ae6eb2618e5d89a06ded6e017a8e6/ZoteroLinkCitation.bas#L806-L817) that searches for a title in bibliography.
With the corresponding function defined somewhere above:
```bas
Private Function DoubleToSingleQuotes(ByVal s As String) As String
s = Replace(s, """", "'")
s = Replace(s, ChrW(&H201C), ChrW(&H2018))
s = Replace(s, ChrW(&H201D), ChrW(&H2019))
DoubleToSingleQuotes = s
End Function
```
However, it will definitely fail for styles that do not put titles in quotes.
So the question is whether it is possible to fix it for all cases. One solution is to ignore all quotes inside `rngBibliography.Find` (both in text and in the key) - in this respect it seems to be related to #10. Current settings in the call of this method does not seem sufficient, and I do not know if they can be further tuned. More complicated solution in the same direction is to manually sanitize (remove all quotes from) both the text and bibliography before the search.
A second solution is to limit the above fix to some styles with explicit list as in `ExtractCitations(...)`.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。