Juris-M / citeproc-js

A JavaScript implementation of the Citation Style Language (CSL) https://citeproc-js.readthedocs.io
Other
304 stars 85 forks source link

bug(CSL.Output.Formats.prototype.fo): start-indent and end-indent invalid values #185

Open mgr34 opened 3 years ago

mgr34 commented 3 years ago

In the FO output the values expected by FO for start-indent[1] and end-indent [2] should be one of length | percentage. However, in my limited tests the value is boolean. Which is invalid, and not useful for any FO processor. This appears to be because the value is derived from the boolean hanging-indent [3]. It's method of supplying a negative (-) preceeding the attribute value of end-indent is, as far as I know, the accepted way to render a hanging-indent in FO.

If you deem this a valid bug I would be happy to throw a PR together. Otherwise, I will continue to simply post process the output to replace trueem with the value of my choosing (3em). Note, that when I post-process I also find it necessary to throw an xmlns in for fo, or my xquery transformation throws a fit when I call parse-xml-fragment about it being not well-formed. This last bit is not relevant to the issue, but it might solve someone else's issue somewhere, sometime :)

[1] https://www.w3.org/TR/xsl11/#start-indent [2] https://www.w3.org/TR/xsl11/#end-indent [3] https://github.com/Juris-M/citeproc-js/blob/aa2683f48fe23be459f4ed3be3960e2bb56203f0/citeproc.js#L22557-L22558

bwiernik commented 3 years ago

How would the appropriate length of percentage value be determined?

mgr34 commented 3 years ago

That's a fair question. In short, I don't know. But more specifically the formatter is trying to use em's and the value should be an integer. At present a true or false value is returned and promptly ignored by the fo processor.