egh / zotxt

zotxt: a Zotero extension for text
http://gitlab.com/egh/zotxt
GNU General Public License v3.0
326 stars 16 forks source link

zotxt api does not work for non-latin references #8

Open shivams opened 5 years ago

shivams commented 5 years ago

When using non-latin characters to search/query for references with non-latin characters in them, zotxt doesn't provide any results.

This issue was reported on a separate plugin here: https://github.com/shivams/zim-zotero-plugin/issues/1, but I now realize that it's an issue with zotxt, as Zotero's default search actually works with non-latin characters.

Nick222 commented 4 years ago

And what about this problem ?

egh commented 4 years ago

It's working for me. Can you clarify the problem you are seeing?

$ curl 'http://localhost:23119/zotxt/search?q=niederl%C3%A4ndisch&format=bibliography'
[
  {
    "key": "1_PDK8584T",
    "html": "<div class=\"csl-bib-body\" style=\"line-height: 1.35; margin-left: 2em; text-indent:-2em;\">\n  <div class=\"csl-entry\">Matthias Hüning. “Wortbildung im niederländisch-deutschen Sprachvergleich.” In <i>Deutsch im Sprachvergleich. Grammatische Kontraste&nbsp; und Konvergenzen</i>, edited by Lutz Gunkel and Gisela Zifonun, 161–86. Institut für Deutsche Sprache, Jahrbuch 2011. Berlin: De Gruyter, 2012.</div>\n  <span class=\"Z3988\" title=\"url_ver=Z39.88-2004&amp;ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fzotero.org%3A2&amp;rft_id=urn%3Aisbn%3A978-3-11-028354-9&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=bookitem&amp;rft.atitle=Wortbildung%20im%20niederl%C3%A4ndisch-deutschen%20Sprachvergleich&amp;rft.place=Berlin&amp;rft.publisher=De%20Gruyter&amp;rft.au=undefined&amp;rft.au=Lutz%20Gunkel&amp;rft.au=Gisela%20Zifonun&amp;rft.date=2012&amp;rft.pages=161-186&amp;rft.spage=161&amp;rft.epage=186&amp;rft.isbn=978-3-11-028354-9&amp;rft.language=German\"></span>\n</div>",
    "text": "Matthias Hüning. “Wortbildung im niederländisch-deutschen Sprachvergleich.” In Deutsch im Sprachvergleich. Grammatische Kontraste  und Konvergenzen, edited by Lutz Gunkel and Gisela Zifonun, 161–86. Institut für Deutsche Sprache, Jahrbuch 2011. Berlin: De Gruyter, 2012."
  }
]
Nick222 commented 4 years ago

I install plugin "Better BibTex for Zotero" - it created "citekey" and I use this "citekey" to insert citation in another program. But this "citekey" is translit author-name and book-name in Latin.

Nick222 commented 4 years ago

egh Without "format-bibliography" and with "q=(citekey)" - all OK.

With "format-bibliography" and with "q=(citekey)":

$ curl 'http://localhost:23119/zotxt/search?q=__2017&ie=utf-8&oe=utf-8&format=bibliography'

csl is nullTypeError: csl is null buildBibliographyResponse/responseData<@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///home/nick/.zotero/zotero/d2f53sy5.default/extensions/zotxt@e6h.org.xpi!/bootstrap.js:220:9 buildBibliographyResponse@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///home/nick/.zotero/zotero/d2f53sy5.default/extensions/zotxt@e6h.org.xpi!/bootstrap.js:219:24 buildResponse/<@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///home/nick/.zotero/zotero/d2f53sy5.default/extensions/zotxt@e6h.org.xpi!/bootstrap.js:156:20 tryCatcher@resource://zotero/loader.jsm -> resource://zotero/bluebird/util.js:16:16 module.exports/Promise.prototype._settlePromiseFromHandler@resource://zotero/loader.jsm -> resource://zotero/bluebird/promise.js:512:13 module.exports/Promise.prototype._settlePromise@resource://zotero/loader.jsm -> resource://zotero/bluebird/promise.js:569:13 module.exports/Promise.prototype._settlePromise0@resource://zotero/loader.jsm -> resource://zotero/bluebird/promise.js:614:5 module.exports/Promise.prototype._settlePromises@resource://zotero/loader.jsm -> resource://zotero/bluebird/promise.js:693:13 module.exports/Promise.prototype._fulfill@resource://zotero/loader.jsm -> resource://zotero/bluebird/promise.js:638:13 module.exports/PromiseArray.prototype._resolve@resource://zotero/loader.jsm -> resource://zotero/bluebird/promise_array.js:126:5 module.exports/MappingPromiseArray.prototype._promiseFulfilled@resource://zotero/loader.jsm -> resource://zotero/bluebird/map.js:101:13 module.exports/Promise.prototype._settlePromise@resource://zotero/loader.jsm -> resource://zotero/bluebird/promise.js:574:17 From previous event: captureStackTrace@resource://zotero/loader.jsm -> resource://zotero/bluebird/debuggability.js:829:23 CapturedTrace@resource://zotero/loader.jsm -> resource://zotero/bluebird/debuggability.js:721:5 longStackTracesCaptureStackTrace@resource://zotero/loader.jsm -> resource://zotero/bluebird/debuggability.js:400:19 module.exports/Promise.prototype._then@resource://zotero/loader.jsm -> resource://zotero/bluebird/promise.js:232:9 module.exports/Promise.prototype._passThrough@resource://zotero/loader.jsm -> resource://zotero/bluebird/finally.js:94:12 module.exports/Promise.prototype.finally@resource://zotero/loader.jsm -> resource://zotero/bluebird/finally.js:103:12 PromiseSpawn@resource://zotero/loader.jsm -> resource://zotero/bluebird/generators.js:36:25 module.exports/Promise.coroutine/<@resource://zotero/loader.jsm -> resource://zotero/bluebird/generators.js:197:21 Zotero.Server.DataListener.prototype._headerFinished@chrome://zotero/content/xpcom/server.js:304:5 Zotero.Server.DataListener.prototype.onDataAvailable@chrome://zotero/content/xpcom/server.js:210:7

Nick222 commented 4 years ago

egh

When use code-query author-name (%D0%9C%D0%B0%D1%80%D0%BA%D0%BE%D0%B2) instead citekey - without bibliography - OK, with bibliography - see errors above.

egh commented 4 years ago

@Nick222 Do you have this style installed? http://www.zotero.org/styles/chicago-note-bibliography By default zotxt will use that if you don't specify another style. I should probably change that, but it's the current default and it will error if it is not installed. I suspect that may be the error you are seeing.

Nick222 commented 4 years ago

egh

OK - now good

But I cannot cite in Zim by write non-Latin author-name or book-name - because citekeys are in Latin only...?

Nick222 commented 4 years ago

Do I need a file "pandoc-zotxt.lua" for zotxt to work ?

egh commented 4 years ago

No, you shouldn't need pandoc zotxt.lua.

I'm not sure about non-latin citekeys. Better BibTeX might support that. From what I see, out of the box, it is transliterating: image