Giter VIP home page Giter VIP logo

zotxt's Introduction

zotxt: a Zotero extension for text

zotxt is a Zotero extension for supporting utilities that deal with plain text files (e.g., markdown, reStructuredText, latex, etc.)

Installation

  1. Visit https://github.com/egh/zotxt/releases
  2. Download the latest .xpi file. If you are using Firefox, you will need to right-click and "Save as"
  3. Start Zotero standalone.
  4. In Zotero, select Tools -> Add-ons -> Gear (upper right) -> Install Add-On from file, and install the downloaded xpi file.

pandoc integration

Please install the pandoc-zotxt.lua extension to pandoc as well as Better BibTeX, which provides excellent citation key management.

Using the citation keys provided by Better BibTeX in pandoc citation format, you can automatically connect pandoc to a running Zotero instance to generate citations. (An example of a pandoc citation is [@Doe2006] where Doe2006 is the citation key set by Better BibTex.)

For example:

pandoc -L pandoc-zotxt.lua -C file.md -t pdf -o file.pdf

emacs integration

See zotxt-emacs

Zotxt API

The Zotxt API is exposed via http://127.0.0.1:23119/zotxt/. To get an idea of what is possible, your best bet is probably to have a look at the test/test.rb file.

zotxt's People

Contributors

adunning avatar alessandrow avatar andersjohansson avatar bostonenginerd avatar dependabot[bot] avatar egh avatar odkr avatar retorquere avatar tdsmith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

zotxt's Issues

zotxt not loading correctly

When I run org-zotxt-insert-reference-link it calls something like /zotxt/search?q=test&method=titleCreatorYear&format=quickBib. Performing the same call by hand, curl "http://127.0.0.1:23119/zotxt/search?q=test&method=titleCreatorYear&format=quickBib"
results in

(5)(+0023984): GET /zotxt/search?q=test&method=titleCreatorYear&format=quickBib HTTP/1.1 Host: 127.0.0.1:23119 User-Agent: curl/7.64.1 Accept: */*

(5)(+0000002): HTTP/1.0 404 Not Found X-Zotero-Version: 5.0.82 X-Zotero-Connector-API-Version: 2 Content-Type: text/plain No endpoint found 

And similarly, curl "http://127.0.0.1:23119/zotxt/version" results in

(5)(+0337211): GET /zotxt/version HTTP/1.1 Host: 127.0.0.1:23119 User-Agent: curl/7.64.1 Accept: */*

(5)(+0000001): HTTP/1.0 404 Not Found X-Zotero-Version: 5.0.82 X-Zotero-Connector-API-Version: 2 Content-Type: text/plain No endpoint found 

endpoint not found(6.0.2)

When I use "C-c " i" command in emacs, an error occur
Caught error: (error http 500) [error] request--callback: peculiar error: 500 [error] request-default-error-callback: http://127.0.0.1:23119/zotxt/version error deferred error : (error "Zotxt version endpoint not found; is Zotero running and zotxt installed?")
After using zotero debugging and searching the logs for zotxt, I only found
zotero(5)(+0089958): GET /zotxt/version HTTP/1.1 Host: 127.0.0.1:23119 User-Agent: curl/7.78.0 Accept: */*
Besides, when I execute "C-c " i" in emacs, there is no response in the zotero [debugging] terminal,
but "$ curl http://127.0.0.1:23119/zotxt/version" get response:
{
"version": "6.0.2"
}%
"$curl 'http://localhost:23119/zotxt/search?q={word_for_query}&format=bibliography'" also get a correct response.
I wonder how to solve this, thanks!

environment:
macos Monterey 12.6 (21G115)=> Emacs Version 28.2 (9.0)=> zotero 6.0.15

zotxt 6.0.2 – won’t find items with non-ASCII citation keys

I just tried to insert a citation to a paper by Esa Díaz-León, using the Better BibTeX Citation key "Díaz-LeónWhat2015". However, zotxt responds: "Díaz-LeónWhat2015 had no results". I tried changing the citation key to "Diaz-LeonWhat2015", but that just gives the same error. I can reproduce that behaviour with other citation keys that contain non-ASCII characters.

I conjecture that zotxt uses the citation key to search for the author, so forcing an ASCII citation key doesn’t help, because the author name is not saved in ASCII. My best guess for why the UTF-encoded citation key is not found are unicode normalisation issues. It may be that my editor enforces a different normal form than Zotero. I’m not sure how to best address this, since applications have some leeway when it comes to normal forms. But if my guess is right, it’s probably best to normalise incoming strings to NFC, since that is what web sites should use; it's also the most common one.

I’ll investigate further when I have more time.

Thanks for looking into this!

Zotero 7 beta support

Last few days Zotero 7 entered beta phase, most plugins doesnt support it yet, are there already an roadmap to update this plugin?

zotxt api does not work for non-latin references

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: shivams/zim-zotero-plugin#1, but I now realize that it's an issue with zotxt, as Zotero's default search actually works with non-latin characters.

Sync is not working with Zotero (v6.0.26).

Hi, I used to have Zotero working in sync with Emacs using zotxt until, I guess 1. Aug, when some update happened on Zotero end. My Zotero version is 6.0.26, I ran into issues with BBT renaming, so I had to update BetterBibTeX plugin to 6.7.101 and ZotFile to v5.1.3 (development version). I have Zotxt (v6.0.2) plugin installed. I noticed that Emacs is not picking up newly added references, and I can no longer see the settings related to BetterBibTeX plugin inside Zotero preferences. Am I missing something? Your help is greatly appreciated.

Access group libraries

Hello,

I'm trying to use zotxt via the org-zotxt package in Emacs. It appears to work for items in "My Library", which I can insert via C-c " i. However, it doesn't find anything in my group libraries. I'm not sure if this is an issue with zotxt, org-zotxt, or zotxt.el, or me. Is it possible to retrieve items from Group Libraries via zotxt, and if so, what should I be doing to enable this?

Thanks,

Tyler

Feature request: locale parameter

Could you add a "locale" or "lang" parameter that we could use to ask Zotero for bibliographies formatted for specific locales?

Different locales use different punctuation and different localized strings for "editor", "and", "in", etc.

Switching default locale manually in the Zotero app is possible but cumbersome (needs restarting). Too cumbersome for my use case (generating a multi-language static web site with references in multiple documents).

Back in the days of zotero-plain I tweaked zotero-generate-bib-entry to do this by replacing the "bibliography=" string in the second parameter in the call to Zotero.QuickCopy.getContentFromItems with a contentformat object that included a "locale" property containing a language code like "fr". I seem to remember that I had it working smoothly. Perhaps something like that could be done for zotxt.

HTTP requests to zotxt reply "Request not allowed" for zotxt v5.0.2 and Zotero >= v5.0.71

I'm using Zotero v5.0.72 and zotxt 5.0.2.

When I try to retrieve citation data for an item via a GET request to http://127.0.0.1:23119/zotxt/items?easykey=<KEY>, Zotero responds with "Request not allowed". I can reproduce this for other endpoints.

I have recently upgraded to Zotero (the error also occurs in v5.0.71), which may (or may not) have caused the issue. I'm using the zotero-bibliography setting, so I can’t tell when things stopped working.

Do you have any idea what's going on?

No endpoint found

First of all, thanks for your awesome extension!

I hit the following bug:
When I visit http://127.0.0.1:23119/zotxt/ I get the message No endpoint found. In emacs org-zotxt-insert-reference-link seems to work fine, but org-zotxt-open-attachment results in

[error] request--callback: peculiar error: 400
Caught error: (error "#s(request-response 400 nil nil (error http 400) parse-error \"http://127.0.0.1:23119/zotxt/items?key=nil&format=paths\" t (:params ((\"key\") (\"format\" . \"paths\")) :parser json-read :success #[128 \"\\302\\300\\303\\301�\\\"\\\"\\207\" [#[(d &rest args) \"\\302�\\303	\\304\\\"\\\"\\207\" [d args deferred:callback-post plist-get :response] 5] (#s(deferred identity deferred:default-errorback deferred:default-cancel #s(deferred (lambda (&rest --cl-rest--) (apply (function #[(G107 G108 response) \"\\302\\304�!	>\\204�\0\\305\\306\\307�D\\\"\\210�\\310H\\311\\234\\236A�\\312\\313
!�J\\\")\\207\" [response cl-struct-request-response-tags paths G107 type-of signal wrong-type-argument request-response 3 0 org-open-file org-zotxt-choose-path] 5]) (quote --arg--) (quote --item-id--) --cl-rest--)) deferred:default-errorback deferred:default-cancel #s(deferred deferred:default-callback zotxt--deferred-handle-error deferred:default-cancel nil nil nil) nil nil) nil nil)) apply append] 6 \"

(fn &rest ARGS2)\"] :error #[128 \"\\302\\300\\303\\301�\\\"\\\"\\207\" [#[(d &rest args) \"\\302�\\303	\\304\\\"\\\"\\207\" [d args deferred:errorback-post plist-get :response] 5] (#s(deferred identity deferred:default-errorback deferred:default-cancel #s(deferred (lambda (&rest --cl-rest--) (apply (function #[(G107 G108 response) \"\\302\\304�!	>\\204�\0\\305\\306\\307�D\\\"\\210�\\310H\\311\\234\\236A�\\312\\313
!�J\\\")\\207\" [response cl-struct-request-response-tags paths G107 type-of signal wrong-type-argument request-response 3 0 org-open-file org-zotxt-choose-path] 5]) (quote --arg--) (quote --item-id--) --cl-rest--)) deferred:default-errorback deferred:default-cancel #s(deferred deferred:default-callback zotxt--deferred-handle-error deferred:default-cancel nil nil nil) nil nil) nil nil)) apply append] 6 \"

(fn &rest ARGS2)\"] :url \"http://127.0.0.1:23119/zotxt/items?key=nil&format=paths\" :response #0 :encoding utf-8) #<killed buffer> \"HTTP/1.0 400 Bad Request
X-Zotero-Version: 5.0.82
X-Zotero-Connector-API-Version: 2
Content-Type: text/plain; charset=UTF-8

which I think is related to the broken endpoint.

I'm using zotero 5.0.82, zotxt 5.0.5 and org-zotxt-mode 20200120.1950 from melpa on Centos 7 and emacs-26.3.

pandoc-zotxt: TypeError: list indices must be integers, not str

Trying to run pandoc like this:

pandoc -F pandoc-zotxt -F pandoc-citeproc -f org -t markdown_github -o test.md AstrologyHouseMnemonic.org

Results in this error:

Traceback (most recent call last):
  File "/usr/local/bin/pandoc-zotxt", line 9, in <module>
    load_entry_point('pandoc-zotxt==5.0.2', 'console_scripts', 'pandoc-zotxt')()
  File "build/bdist.linux-x86_64/egg/pandoczotxt/__init__.py", line 90, in run
  File "build/bdist.linux-x86_64/egg/pandoczotxt/__init__.py", line 38, in toJSONFilter
TypeError: list indices must be integers, not str
pandoc: Error running filter pandoc-zotxt
Filter returned error status 1

I am using python 2.7 on Ubuntu 17.04.

Python error: File not found.

Bug Report

Details

Collecting pandoc-zotxt
  Downloading https://files.pythonhosted.org/packages/27/70/00eb7db38200f8ad08e18ac65056d320dc8eeab744c0760cbfbe5bc1d1f1/pandoc-zotxt-5.0.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-caky9ev4/pandoc-zotxt/setup.py", line 10, in <module>
        with open(path.join(here, '..', 'README.rst'), encoding='utf-8') as f:
      File "/home/haozeke/.virtualenvs/bTechProjFin-O5xos1BV/lib/python3.6/codecs.py", line 897, in open
        file = builtins.open(filename, mode, buffering)
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-caky9ev4/pandoc-zotxt/../README.rst'
    
    ----------------------------------------

Error:  An error occurred while installing pandoc-zotxt!
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-caky9ev4/pandoc-zotxt/

This seems related to #3 but it differs in the file missing.

get BetterBibTeX

Is it possible for a query to return the bib entry that would be produced by using Better BibTex?

Zotxt version endpoint not found (version 5.1.2)

hello,

The last version 5.1.2 does not work, at least on my setup.

emacs-zotxt reports the following error message:

\"http://127.0.0.1:23119/zotxt/items?key=1_JU4BZUWT&format=paths\" :response #0 :encoding utf-8) #<killed buffer> \"HTTP/1.0 404 Not Found
X-Zotero-Version: 5.0.95
X-Zotero-Connector-API-Version: 2
Content-Type: text/plain
\" nil curl nil)")
[error] request--callback: peculiar error: 404
[error] request-default-error-callback: http://127.0.0.1:23119/zotxt/version error
deferred error : (error "Zotxt version endpoint not found; is Zotero running and zotxt installed?")
user-error: Minibuffer window is not active

zotxt works fine with version 5.1.0. I have not tested the intermediate release.

setup.py FileNotFoundError

When trying to install pandoc-zotxt from pip (Python 2 or 3) I get the error:

Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-hfqj1v_j/pandoc-zotxt/setup.py", line 10, in <module>
    with open(path.join(here, '..', 'README.rst'), encoding='utf-8') as f:
  File "/usr/lib/python3.5/codecs.py", line 895, in open
    file = builtins.open(filename, mode, buffering)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-hfqj1v_j/pandoc-zotxt/../README.rst'

because there is no README.srt file.

It can be correctly installed from source by having a README.srt file on the parent directory.

version endpoint not found (zotxt 5.1.4)

Have seen a few of these among the recent issues, but I seem to encounter it with zotxt 5.1.4.

I see two mentions of zotxt in my zotero logs;

once at the very start:

version => 5.0.96.2, platform => MacIntel, oscpu => Intel Mac OS X 10.15, locale => en-US, appName => Zotero, appVersion => 5.0.96.2, extensions => Zotero Word for Mac Integration (5.0.36.SA.5.0.96.2, extension), Zotero LibreOffice Integration (5.0.25.SA.5.0.96.2, extension), zotxt (5.1.4, extension), Better BibTex for Zotero (5.4.10, extension, disabled)

and once at the end, when I'd curl'ed the version endpoint, as curl http://127.0.0.1:23119/zotxt/version:

(5)(+0173681): GET /zotxt/version HTTP/1.1 Host: 127.0.0.1:23119 User-Agent: curl/7.64.1 Accept: */* 
(5)(+0000014): HTTP/1.0 404 Not Found X-Zotero-Version: 5.0.96.2 X-Zotero-Connector-API-Version: 2 Content-Type: text/plain No endpoint found

and where "No endpoint found" was the response I saw at the CLI.

I'll note, I'm running the same versions of Zotero and zotxt on a linux box, and there they work fine.

Any ideas to try? Thank you.

Make zotxt compatible with Zotero 5

First, thanks a lot for your work! And, although I’m sure that you’ve got in your radar, please upgrade zotxt to work with Zotero 5. (I’m mostly posting this issue so that I’m notified once it’s done.) Thanks a lot!

New release of better bibtext breaks zotxt (BetterBibTeX.KeyManager.keys.findOne is not a function)

I believe a new release of better bibtext has broken something in zotxt. The key issue seems it might be TypeError: zotero.BetterBibTeX.KeyManager.keys.findOne is not a function

My setup:
Zotero 6.0.27
Better BibTex for Zotero 6.7.132
zotxt 6.0.2
I am accessing zotxt through the pandoc-zotxt.lua filter in emacs 29.1 on Windows 10

Zotxt failed to find items in my Zotero bibliography. When I rolled back to Better Bibtext v6.7.100, things worked as they should. (I chose that version arbitrarily; I didn't test every release going back.)

The Zotero debugger gives me the output below. I have included the entries on either side of the errors.

This is wonderful project. I am very grateful to you. I hope you will be kind enough to fix this issue.

(3)(+0005003): {better-bibtex} +5002 idle: Thu Oct 26 2023 23:46:04 GMT-0400 (Eastern Daylight Time), save-database active

(3)(+0000002): {better-bibtex} +2 idle: auto-export: {"state":{"state":"active","topic":"save-database"},"pref":{"autoExport":"immediate","autoExportIdleWait":10}}

(5)(+0011210): GET /zotxt/items?betterbibtexkey=sagiv_DeepBlueNotes_2015 HTTP/1.1 Host: localhost:23119 Accept-Encoding: gzip

(3)(+0000008): TypeError: zotero.BetterBibTeX.KeyManager.keys.findOne is not a function findByBBTKey@chrome://zotxt/content/modules/Core.jsm:217:18 itemsEndpoint/<@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///C:/Users/alexanderkaye/AppData/Roaming/Zotero/Zotero/Profiles/79uiu4p8.default/extensions/[email protected]!/bootstrap.js:420:24 itemsEndpoint@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///C:/Users/alexanderkaye/AppData/Roaming/Zotero/Zotero/Profiles/79uiu4p8.default/extensions/[email protected]!/bootstrap.js:419:13 handleErrors/<@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///C:/Users/alexanderkaye/AppData/Roaming/Zotero/Zotero/Profiles/79uiu4p8.default/extensions/[email protected]!/bootstrap.js:300:18 Zotero.Server.DataListener.prototype._processEndpoint<@chrome://zotero/content/xpcom/server.js:526:26 Zotero.Server.DataListener.prototype._headerFinished@chrome://zotero/content/xpcom/server.js:302:5 Zotero.Server.DataListener.prototype.onDataAvailable@chrome://zotero/content/xpcom/server.js:208:7

(5)(+0000001): HTTP/1.0 500 Internal Server Error X-Zotero-Version: 6.0.27 X-Zotero-Connector-API-Version: 2 Content-Length: 0

(5)(+0002057): GET /zotxt/items?easykey=sagiv_DeepBlueNotes_2015 HTTP/1.1 Host: localhost:23119 Accept-Encoding: gzip

(5)(+0000009): HTTP/1.0 400 Bad Request X-Zotero-Version: 6.0.27 X-Zotero-Connector-API-Version: 2 Content-Type: application/json; charset=UTF-8 "sagiv_DeepBlueNotes_2015 must be of the form DoeTitle2000 or doe:2000title"

(3)(+0016322): {better-bibtex} +29608 idle: Thu Oct 26 2023 23:46:33 GMT-0400 (Eastern Daylight Time), save-database idle

Installation Documentation for Windows

Is zotxt compatible with windows? I'm running the most recent version of Zim Wiki, but there is no "Add-ons" option in the Tools Menu.

"Custom Tools" seems like it might be close, but there is no install from file option, just commands that can be pasted in.

Thanks for any advice you can provide.

Can not install, plugin appears corrupt

I can not install the add-on because on installing firefox shows the pop-up message: "This add-on could not be istalled because it appears to be corrupt"

I'm on linux (64-bit), Firefox 73.0

request--callback: peculiar error: 400

I'm using emacs 30 (current master) and the available zotxt mode. When I insert a reference, I get access to selecting it, but then I get a

[[zotero://select/items/nil]]

thing imported and a

[error] request--callback: peculiar error: 400

error, and eventually this one too:

[error] request-default-error-callback: http://127.0.0.1:23119/zotxt/select?key=nil error

It looks like the protocol is not working on Zotero's side, but I'm not sure what to do.

Error when running pandoc-zotxt

I run into this error when invoking pandoc-zotxt.

File "/usr/local/bin/pandoc-zotxt", line 5, in <module>
    from pandoczotxt import run
  File "/usr/local/lib/python3.7/site-packages/pandoczotxt/__init__.py", line 69
    except (urllib2.HTTPError, IndexError), e:
                                          ^
SyntaxError: invalid syntax

Linking to Zotero items: pb with the id field

Hello,
Thank you very much for developing this nice extension!
I use the last version of Zotero with the last version of OSX.
I meet a problem with BetterbibteX and Zotxt.

I use Hook for connecting different information together and it has now a module for linking with Zotero items, that is very useful for me (I am a researcher). This connection uses zotxt that I have already installed.

It reads the information about the selected item in Zotero through the following curl command:
"curl -s -d selected=t&format=json -G http://127.0.0.1:23119/zotxt/items"
and then builds a zotero:// link using the id it reads from this record

When Better BibTeX is activated, I get as the id the citekey of the article, like
zotero://select/library/items/harmsen2015
and the the zotero link cannot point to the specific article when I click it.

If I deactivate BBTX, the correct id (the same as the name of the subfolder in the Zotero storage folder) is obtained and the link points to the specific file:
zotero://select/library/items/DCEXAPF4

BBTX developer suggested me to contact you: "I don't generate or modify this url, that's zotxt's work. Zotxt likely detects the presence of BBT and reacts to that, but I don't know how it reacts to BBT and whether it's configurable; you'll have to ask the Zotxt developer."

I have not been able to find any option for Zotxt. Do you think that we could solve this problem?

Thank you for your attention.
Very cordially,

Murat

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.