Juris-M / propachi-vanilla

Monkey-patch CSL perocessor plugin for Zotero
Other
6 stars 4 forks source link

Forked #6

Open retorquere opened 5 years ago

retorquere commented 5 years ago

Hey Frank,

I forked propachi to this because I know you're crazy busy and I had an urgent issue I needed fixed. It's a super weird bug that happens only in Zotero i386 but citeproc triggers it. I will fold that repo down if you want, but the fix is pretty ugly so I can't imagine you'd want it in citeproc (and it really should be fixed in Zotero rather than worked around in citeproc).

fbennett commented 5 years ago

Thanks for covering---still here! I'm curious...what does the code look like after patching? From your commit, it looks like it removes things that come out as type 'number' after some sort of splitting operation performed on the bundled processor?

retorquere commented 5 years ago

The patch changes

var split = str.split(splitRex);

into

var split = str.split(splitRex).map(s => typeof s === 'number' ? '' : s); Zotero.debug('propachi: patched split: ' + JSON.stringify(split));

this provides a workaround for this problem which should absolutely never occur (a string split should not get floats in the resulting array, ever) and is not a problem in citeproc, but citeproc triggers an error in the javascript engine in Firefox for i386. In x64 that float is an empty string, so that's what I replace it with. Took a while to find this bastard, who the hell has i386 these days?

fbennett commented 5 years ago

Ah, okay - so I should just look for 'slpitRex in the source. There is already a lot of ugly code in citeproc-js, and there are constructs in there tweaked to run on early Explorer, so there is probably no harm in adopting the change. I'll take a look sometime soonish.

fbennett commented 5 years ago

And congrats + thanks for tracking that one down. A really nasty one.

retorquere commented 5 years ago

Pleasure. There's just two places I've found -- var split = str.split(splitRex); and var split = str.split(_tagRex.splitAll);