citation-style-language/csl-editor

cslExporter.csl exports malformed JSON on the author array

mcshaz opened this issue · 6 comments

when using the cslExporter.csl file from wiki/citation-style-editor/csl-editor/cslExporter.csl I get some malformed JSON in the author property:

"author": [{"family": "Moynihan", "given": "Katie"}]"}, {"family": "[{"family": "McSharry", "given": "Brent"}]"}, {"family": "[{"family": "Reed", "given": "Peter"}]"}, {"family": "[{"family": "Buckley", "given": "David"}]

it should be
"author": [{"family": "Moynihan", "given": "Katie"}, {"family": "McSharry", "given": "Brent"}, {"family": "Reed", "given": "Peter"}, {"family": "Buckley", "given": "David"}]

that is each object within the collection is being serialised with:
]"}, {"family": "[
instead of just a comma

We might be able to fix this, but can you give the (wiki) page that links to https://raw.githubusercontent.com/wiki/citation-style-editor/csl-editor/cslExporter.csl? I've never heard of it before, and some context would be handy. What do you hope to use it for?

That's how you can see what Mendeley passes on to CSL. I think @cpina created it -- maybe he can fix?

Looks like each

<group>
  <text prefix=" &quot;" value="author&quot;: " />
  <names variable="author">
    <name delimiter="&quot;}, {&quot;family&quot;: &quot;" prefix="[{&quot;family&quot;: &quot;" suffix="&quot;}]" name-as-sort-order="all" sort-separator="&quot;, &quot;given&quot;: &quot;" ></name>
  </names>
</group>

should look something like

<group>
  <text prefix=" &quot;" value="author" suffix="&quot;: " />
  <names variable="author" prefix="[" suffix="]">
    <name delimiter=", " prefix="{&quot;family&quot;: &quot;" suffix="&quot;}" name-as-sort-order="all" sort-separator="&quot;, &quot;given&quot;: &quot;"/>
  </names>
</group>

(this gives:

"author": [{"family": "Shih", "given": "T. Y."}, {"family": "Stokes", "given": "P. E."}, {"family": "Smythers", "given": "G. W."}, {"family": "Dhar", "given": "R."}, {"family": "Oroszlan", "given": "S."}]

)

cpina commented

I'll test and change it...

@mcshaz, sorry for the long wait, but I fixed up https://raw.githubusercontent.com/wiki/citation-style-editor/csl-editor/cslExporter.csl. I incorporated my suggested change above to fix the output of all CSL name variables.

If you still have any use for it, let us know if you run into any more issues.

P.S. There was also an issue with CSL number variables (such as "issue"), which were output twice (once with <text/> and once with <number/>), that I fixed, keeping only the <text/> output. I also added some style metadata so that the style properly validates, and reindented the style.