Closed dstillman closed 8 years ago
@fbennett Any idea what's going on here? We're not seeing any reason this should be happening, and @inukshuk gets the correct output in citeproc-rb. But we see this in multiple versions of citeproc-js going back months.
That's very weird, isn't it. In a citeproc-js test, I get correct output with that input:
<div class="csl-bib-body">
<div class="csl-entry">Bly, Robert W. (ed.). 1995. <i>The Grammar-Phobe’s Guide to Better English</i> (New York: Macmillan)</div>
</div>
As a wild guess, maybe there is a loose global variable in the processor context? I'll try to set up a citeproc-node
instance locally to dig further.
OK, thanks — at least we're not going crazy.
I can reproduce this by slotting in the above data here (no HTTP necessary): https://github.com/zotero/citeproc-node/blob/master/node_example.js
I don't know the details, but @fcheslack makes some modifications to citeproc-js here to use JSON for style parsing, so it's possible there's a bug being introduced there.
The modification is just defining CSL_JSON when it's nodejs and making sure it gets used as XML_PARSING. That's the only thing I could think of that seems likely to cause this kind of error (though I don't know how) and not see it in normal citeproc-js testing.
That's curious! @fbennett your output is not using chicago-author-date
though is it? (Not that I see anything suspicious in the style that could be causing this, but just to make sure we're using the same data)
That was MHRA (the style in the original report I think). Chicago Author-Date yields:
<div class="csl-bib-body">
<div class="csl-entry">Bly, Robert W., ed. 1995. <i>The Grammar-Phobe’s Guide to Better English</i>. New York: Macmillan.</div>
</div>
Have hit a snag attempting to get citeproc-node
running locally, failing on let
. I've upgraded node.js
on Ubuntu:
bennett@black-slate:~/src/citeproc-js$ node --version
v0.12.7
But I still get the error:
bennett@black-slate:~/src/citeproc-node$ node lib/citeServer.js
/home/bennett/src/citeproc-node/lib/citeServer.js:75
let jsonWalker = require("./json_walker.js");
^^^
SyntaxError: Unexpected strict mode reserved word
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Time for breakfast.
I believe 'node --harmony' should allow it to run on node 0.12.x
You could try to run in strict mode if you are not already; or else it may help to start node with node --harmony
(don't know when let/const was enabled by default).
@dstillman after what you said the other day, I read json as 'Jason' all the time. Jason Walker.
The --harmony
flags brings in ES6 let
- thanks all. It stops on jsdom
, though. Switching over to iojs
did the trick, and I have the server up. Seems like it might be some interaction thing - something special in the JSON parser or conversions, plus some bug in the processor. Will muck about and see what emerges.
Progress. Tracing the name operations in citeproc-node
and in the test bed shows an extraneous node initialization immediately before each rendering, which loses the formatting attributes. That suggests a problem in the refactoring of the style code that takes place in the JSON parsing module - it must be throwing in an extra node object. Should be a straight path to a fix now. More later.
Not sure if this is a bug in citeproc-node or the processor or somewhere else, but it kind of seems too fundamental to be a processor bug:
https://forums.zotero.org/discussion/54447/