Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    David Lukes
    @dlukes
    That piece of code was already there, I just transplanted it into a function because it's now used in multiple places. If I remember correctly, the syntax for pre/post-notes in natbib and biblatex is as follows: \cite[post]{key}, \cite[pre][post]{key} or \cite[][post]{key}. In other words, if you want just a post-note, you need an empty []. I liked the way it was expressed in the existing latex format function, so I just extracted the code into a function. I assumed it was yours, but maybe it was contributed by someone else?
    Emiliano Heyns
    @retorquere
    How would you do just [pre]? And what would \cite[][post]{key} do that \cite[post]{key} doesn't?
    It may well have been my code. Most likely even.
    David Lukes
    @dlukes
    Oh sorry, yeah, I left that last option out :) Just [pre] is \cite[pre]{key}, which is why you can't have \cite[post]{key}, because [post] would be interpreted as [pre].
    If that makes sense
    Sorry twice -- I mixed it up. It's the other way round, [post] is the default when there's only one argument.

    The biblatex manual puts it rather more eloquently:

    If only one of these arguments is given, it is taken as a postnote. If you want to specify a prenote but no postnote, you need to leave the second optional argument empty, as in \cite[see][]{key}.

    That's part of the reason why I was happy to reuse the code that was there, I would have undoubtedly mixed it up in the implementation as well, or missed a corner case :)
    Emiliano Heyns
    @retorquere
    As apparently did I
    Emiliano Heyns
    @retorquere
    But now it just only adds the empty field, and omits the pre. Right?
    David Lukes
    @dlukes
    No no, I think the algorithm works fine :) It's just a bit tricky -- the prefix value is inserted right at the top of the function if it exists, because it needs to be at the start. And then, at the end, if there's no suffix but a prefix has been specified (and therefore inserted earlier), an empty [] is appended.
    It struck me as a pretty elegant, linear way to do it, my initial attempt, before I realized I didn't need to write the code, was much more baroque with nested ifs and whatnot.
    Emiliano Heyns
    @retorquere
    Right, yeah, I see it now.
    Emiliano Heyns
    @retorquere
    Cool, that seems to work. Want to add a test sample to this?
    David Lukes
    @dlukes
    Sure, it should look something like dlukes/zotero-better-bibtex@e618ca7.
    But I can't seem to get the tests to run
    The instructions in CONTRIBUTING.md seem to be a bit outdated, I think I need Python and install requirements.txt, not Ruby, right? And then run test/behave? When I do that, the extension builds fine, but then I get stuck at zotero started: <PID> and endlessly repeating lines saying connecting...
    And ps lists the Zotero process as defunct:
    $ ps <PID> 
      PID TTY      STAT   TIME COMMAND
     2441 pts/4    Z+     0:00 [sh] <defunct>
    David Lukes
    @dlukes
    I figured maybe I needed to run the get-zotero.sh script to install Zotero in a specific location, but that script basically just wraps zotero5_installer.py, which doesn't exist.
    Emiliano Heyns
    @retorquere
    I've added a few testcases but I'm not sure how the suffix is used in a realistic setting, that would be nice to have. The CONTRIBUTING.md was incredibly out of date, I've pushed a new version.
    Yep, you got everything right. There will be a directory ~/.BBTZ5TEST and a file called ~/.BBTZ5TEST.log; the former is the profile dir used for the test, and the latter is the Zotero log. If Zotero didn't start fully, there will usually be an error in the log (it's very chatty, but I usually find the error with a case-insensitive search for error:)
    Emiliano Heyns
    @retorquere
    I've ditched the installer scripts. On Linux (which I assume you're using, otherwise you can just use the normally installed Zotero), the tests depend on zotero being available as /usr/lib/zotero/zotero. The packaged debs will do this (I use these for my own tests), but you can just unpack the tarball there and it will work. The debs do a little extra with setting up permissions and desktop icons and stuff but otherwise it's exactly the same as unpacking their tarball.
    David Lukes
    @dlukes
    Great, thanks, I'll try that! I'm running Solus so the deb won't work for me
    Emiliano Heyns
    @retorquere
    The tests try to be careful about not messing with your actual Zotero data, but for safekeeping I have created files called ~/Zotero and ~/zotero so that Zotero cannot create a data directory there, and I always start Zotero using -datadir profile, and so do the tests. This has so far kept my actual research data sfe, but keep in mind that the tests do actually start Zotero and --this is the important bit -- clear out the profile it's loaded entirely.
    David Lukes
    @dlukes
    OK, thanks for the heads up! My regular profile is in a custom directory, so I'll rename it before running the tests, just to be on the safe side.
    Emiliano Heyns
    @retorquere
    I've added this but to CONTRIBUTING.md
    What kind of packages does Solus have?
    David Lukes
    @dlukes
    As in what format / package manager? They do their own thing: https://getsol.us/articles/package-management/
    Emiliano Heyns
    @retorquere
    It looks like you can't build Solus packages from debian; I build packages on Travis, Travis doesn't offer Solus. Otherwise I'd have put together a package.
    David Lukes
    @dlukes
    Yeah, I guess it's still too small a distro, though really neat :) No worries, setting up Zotero manually is no hassle.
    In other news, the test suite ran fine, thanks for the instructions!
    Emiliano Heyns
    @retorquere
    Super
    David Lukes
    @dlukes
    That was unexpectedly satisfying to watch, Zotero just busily churning away of its own volition :))
    A real-world suffix example could be "et passim"
    What do you think?
    If you like it, maybe it's easier if you change it, rather than going through the whole pull request mechanism
    Emiliano Heyns
    @retorquere
    Thanks, I've added it, tests are running. Yeah, that's fun to see -- it was at some point hidden on Linux using xvfb, but that didn't work on MacOS, and between simplifying the test runner and it being pretty funny to watch I stripped the xvfb parts.
    On travis it still uses xvfb but it's build into the Travis itself.
    Once https://travis-ci.org/retorquere/zotero-better-bibtex/builds/548133264 clears (and it should) I'll cut a new release.
    David Lukes
    @dlukes
    Perfect, looking forward to it!
    Emiliano Heyns
    @retorquere
    5.1.93 is building
    Emiliano Heyns
    @retorquere
    Does that userscript still work now that ShareLaTeX has become Overleaf?
    David Lukes
    @dlukes
    Not sure, haven't tried... We're using it with the community version of Overleaf, which still looks a lot like ShareLaTeX and is branded as such. It's available as a Docker image (https://github.com/overleaf/overleaf/wiki/Quick-Start-Guide), it's not extremely well-maintained or supported, the instructions are a bit hard to hunt down, but it works.
    Jan
    @AchtungPolitisch
    Hello, before I open an issue I wanted to ask quick here. Somehow the api stoped working or forbids access to call citekeys. Opening http://127.0.0.1:23119/better-bibtex/cayw?probe=probe also shows "Request not allowed" and as far as I knew I didn't change the setting. Anybody has an idea why I can't access anymore?
    Emiliano Heyns
    @retorquere
    It should still work using curl or some other automation tool, but since Zotero 5.0.71, direct-browser access to the CAYW url has changed. I'll see whether I can fashion a workaround.
    Jan
    @AchtungPolitisch
    @retorquere thank you, I work with Atom zotero picker and the access is blocked for them too.
    Emiliano Heyns
    @retorquere
    Them is me 😀. Please open an issue on the atom zotero plugin, the problem is on that end as regular curl still works.
    Jan
    @AchtungPolitisch
    lol, @retorquere sorry for my ignorance! Will do.
    Emiliano Heyns
    @retorquere
    Oh wait, you mean the package zotero-picker, not zotero-citations? Sorry, I was mistaken, the former isn't mine. I'll work with the authors to get this resolved but I have tested and it still works on the BBT end.
    Emiliano Heyns
    @retorquere
    Is there an open issue for this on their tracker? As said, it's reachable for me by curl, and access from an atom plugin should be the same, but I'll work with them to fix what needs fixing. There was a recent security update to Zotero that changed the embedded webserver but that should really only affect browsers, not things like atom plugins.