Word add-in wrongly declaring style invalid (Word 2010 on Windows 7, Zotero 4.0.12)

A valid CSL 1.0.1 style file ( available from http://imada.sdu.dk/~petersk/sdulaw-en.csl ) is declared to be invalid ( see http://imada.sdu.dk/~petersk/sdulaw-en.rtf for a screenshot ).

Steps to reproduce:
1. Start Firefox
2. Add style file to Zotero (no complaints)
3. Start Word 2010
4. Create a new document
5. Add a citation
6. Select "SDU Law 35 (English, Fullnote)" as the style

The style validates in the online validator. I have tried bisecting the file with strange results. Removing the type "legal_case" helps, but putting it back in, I get strange behaviour. Two comments with <!-- --> are invalid, while one is valid etc.

Please help!

Cheers,
Peter
  • edited October 31, 2013
    FWIW, validation passes on ZSA 4.0.11, but I can reproduce this with Zotero for Firefox 4.0.12

    Edit: Dan, 4.0.11 tag is missing from github
  • confirmed.

    [JavaScript Error: "too much recursion" {file: "chrome://zotero/content/xpcom/citeproc.js" line: 11269}]

    fbennett will need to look at this.
  • @fbennett - I have the processor gadget version 1.0.132 installed, should be the most recent version.
  • FWIW - the reason the style is failing are convoluted tests of type.
    You can find a working version of the style here:
    https://gist.github.com/adam3smith/7258466/raw/47029c0ca0606e21c0aa07aec5aa1b4b2a1dc2ac/sdulaw-en.csl

    all it does it to simplify the macros "types" and "notes" without altering their output. Obviously valid styles should never produce errors, but this will allow you to work with this until fbennett is able to fix the issue breaking your version.
  • Under Ubuntu with Firefox 25, the style under the link given by the OP (http://imada.sdu.dk/~petersk/sdulaw-en.csl) loads fine, with all versions of Zotero and MLZ that I have to hand, including Zotero 4.0.12.

    So ... either the file under that link has been updated with the version offered by Sebastian, or a difference in platforms (OS, Firefox version) affects the behaviour.

    I'll wait for further news about the genesis of the file under that link before going further.
  • Thanks for the feedback.

    I actually got a working version by removing some unnecessary groups, tests etc. I will look at the simplification of the types and notes macros by adamsmith.

    Anyway, a valid style file of reasonable size and complexity should be handled without complaints - where reasonable size is << 100K and reasonable complexity is nesting to depths << 100 ;)

    Cheers,
    Peter
  • Until I have code in hand that fails locally, there's not much I can do by way of debugging. ;)
  • Anyway, a valid style file of reasonable size and complexity should be handled without complaints - where reasonable size is << 100K and reasonable complexity is nesting to depths << 100</blockquote>
    For what it's worth, I have some numbers to report.

    The latest addition to the MLZ family of styles (the MLZ Taiwanese Law Style) is 3,806 lines in length with a file size of 127k. Size isn't a problem.

    I tried adding 100 layers of group nesting to a macro in SDU Law, and it loads and runs without error on my system here.

    With a macro containing 100 layers of conditional nesting, the style also loads and runs without error.

    With nesting of simple macros, I hit a limit at 75 levels. Added complexity within the macros themselves might affect this constraint. The ceiling shouldn't be anywhere near this low, and it's probably worth looking into how nested macros are cast and executed at some point; but unless there is a concrete use case that requires such deep nesting (in a style with maintainable code), it doesn't look like this requires urgent attention.
  • the style at the URL has been updated (that's not very helpful to do in the middle of troubleshooting, btw.). The old, failing style is here:
    https://gist.github.com/adam3smith/7267539
  • Under Ubuntu 12.04 with Firefox 25, I get the recursion error with Zotero 4.0.12 for Firefox. With Processor Gadget 1.0.132 installed, the style loads and runs fine.

    Although I can't reproduce the error here, if this particular code consistently fails on a specific platform (Windows?) under Firefox 25 or above and Zotero 4.0.12 Processor Gadget 1.0.132, it would be good to know. The CSL code isn't very complicated, and certainly shouldn't throw a recursion error.
  • I can consistently get this failing with the proc. gadget 1.0.132 on FF 25, Zotero 4.0.12, LibreOffice Version 4.0.2.2 in Ubuntu 13.04.
    Just to restate - the error is only thrown when I try to use the style in LO. It works in the test pane, e.g.

    Anything I can provide as output? I had a brief look at debug, that didn't seem like it had anything useful.
  • edited November 2, 2013
    I'm using LO 3.5.72. Looks like it's either a change in an Ubuntu library, or the LO version. It's hard to imagine how the latter could be related, since all the plugin does is send string data back and forth to Zotero, but you never know.

    Apart from that, I've no idea what could be causing the error.
  • edited November 3, 2013
    The "recursion error" began appearing with Firefox 24, so it may have to do with some new constraint or other in the JS engine that is hit on some systems but not on others. I took a quick look at the release docs, though, and didn't see anything that looked relevant. As the amateur in the room I'm hesitant to say so, but it might just be a bug at their end.
Sign In or Register to comment.