Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: add to file #20

Open
lotard opened this issue May 8, 2020 · 10 comments
Open

Feature: add to file #20

lotard opened this issue May 8, 2020 · 10 comments

Comments

@lotard
Copy link

lotard commented May 8, 2020

Awesome extension!

Is there a plan to allow it to add citations directly to an already existing (bibTeX) file, instead of manual copy-paste or export of a single citation as a new file?

It may require simple parsing of that file to avoid citation key duplication. Mendeley adds a lowecase letter in such cases.

@Langenscheiss
Copy link
Owner

Hi.
Hmm, need to see whether I can do this within the current permissions. I am not going to ask for more permissions then what I am already doing. I hate browser extensions that circumvent all security features simply asking the user to agree to everything. If this is possible without extra permissions, I would love to add this. It would make things faster.

@lotard
Copy link
Author

lotard commented May 8, 2020

It's also retrival. What makes me hesitant to use the plugin is the likely case when a citation key duplicates. It won't be as common as in Mendeley (which uses AuthorYear), but with all the common Asian family names and general salami publishing it's bound to happen.

I guess I can write myself a script which cleans the database up, but that's besides the point.

@Langenscheiss
Copy link
Owner

Two things:

  1. Every user can adjust the citation key the plugin is using to their own liking in the general options (and i was planning on expanding this by supporting website specific citation keys). This should minimize the key duplication issue due to common names.
  2. Removing duplicate entries from a bibliography is a typical feature of any library tool such as JabRef or Mendeley. This is clearly beyond the scope of this plugin. It might have some simple sanity check, but the only thing I think makes sense right now is a simple convenience feature like "append to file". All these extra checks whether the entry is duplicate etc. should be handeled by the library software.

@lotard
Copy link
Author

lotard commented May 8, 2020

  1. That'll work only, if you remember you've already added Chen2010Apr.
  2. Ah, the reason I was interested in this plugin is to move away from Mendeley entirely.
    I currently use M. as a slow, semi-manual (odd 'review' process) and Elsevier-linked way of formatting citations from webpages into a BIB file, which I then source into my notes in LaTeX. I could do without a reference manager. Now, that might not be even close to how others might use your plugin, so of course act accordingly. If you do manage to get it to append to file directly, I may look into using say JabRef (or a simple bash script) to deduplicate it, when the need arises.

@Langenscheiss
Copy link
Owner

Langenscheiss commented May 8, 2020

Yeah, unfortunately, it's only me working on it so no time and resources to build an entire library management tool. And besides, there are many good ones already. BibItnow works very well with JabRef for example. You can simply copy paste Bibtex into JabRef, and JabRef will add to the citation database. For me personally, I am fine with just copy-pasting into raw bib files.

EDIT: Of course, I can couple the append function to a simple sanity check whether exactly the same block of text you are about to append already exists in the file you are going to append something to. In this way, it can at least prevent you from creating duplicates in that way.

@Langenscheiss
Copy link
Owner

Sorry. Won't happen. There is currently no secure way to write files locally. The only thing one can do is provide a file download or a "save as" dialogue for security reasons. The only thing one can do is read the file, append the text, and then trigger a "save as" dialogue which lets the user overwrite the database file with another one where the text is added. Sorry, but what you ask for is not possible with browser extensions only. Yes, other software does it (JabFox), but they combine their extension with additional software which is an absolute no-go for me.

@Langenscheiss
Copy link
Owner

Langenscheiss commented Aug 1, 2020

In the latest version 0.897 submitted today, the file download works with at least one click less, it remembers the default action on Firefox if clicked from the popup, and it can even be initiated with a single keystroke (default: Alt+Q). If you link, say bibfiles, to some default application that appends the file to your library file, you can achieve this. I am actually thinking about writing something like this and provide it here on github as an optional additional application, that, however, is not needed for the plugin to work. In that way, you can actually add the citation to the file with a single keystroke, at least on Chrome. On firefox, the default action is not applied if the download is not explicitly initiated by clicking the link (due to security restrictions in Firefox)

@lotard
Copy link
Author

lotard commented Nov 22, 2020

This works nicely, looking forward to the extension!

@tbruckmaier
Copy link

Another option would be using a custom protocol like bib-import://. When users install that protocol handler on their machine, the configured program could be openend without using the clipboard/the download dialog. I have just tried it quick&dirty with JabRef which supports a --importBibtex flag, so you can pass a bibtex string and JabRef offers to import it to your active bib file.

Protocol registration works different depending on the OS, here are some example instructions for another addon: https://github.com/mikehardy/thunderlink/#installation

On my linux machine, the workflow would be something like this (I have adapted the instructions from the link above):

# ~/.local/share/applications/bib-import.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Import into JabRef
Exec=jabref --importBibtex %u
Terminal=false
X-MultipleArgs=false
Type=Application
MimeType=x-scheme-handler/bib-import;
StartupNotify=true
NoDisplay=true

I have registered the protocol via gio mime x-scheme-handler/bib-import bib-import.desktopand voila, xdg-open bib-import://{bibentry-string} opens jabref and offers me to import the entry.

If bibitnow could offer a way to open an according url, this could be a pretty convenient way of importing entries. Downside is the rather complex installation. What do you guys think?

@Langenscheiss
Copy link
Owner

Hi.
Thanks for the suggestion. I will try to look into it, but at the moment, I am in research paper writing mode, so not much time. Sorry for the slow progress at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants