Support bibliography citeproc tests #273
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #229.
As a drive-by, affixes around bibliography
<layout>
are now included in the output. (This should be the only visible change of this PR to users.)Initial inspiration was taken from #228, and includes its drive-by fix of affixes in bibliography layout, but the approach taken for test comparison is entirely different: I implemented code to generate HTML similar to that generated by citeproc for the citeproc tests. The generated HTML is not indented, and so indentation in the original test result is stripped for comparison.
Future work
This revealed a bug, it appears that formatting is always being applied to affixes by hayagriva (cf
sort_VariousNameMacros1.txt
, where bold is being applied to spaces around a bold group), but this can be fixed later.Also, there are various test failures to investigate, for example
"bugreports_parenthesis
seems to have some extraneous spacing to the left on hayagriva's output, which is weird. Perhaps citeproc is compressing two consecutive spaces in a way we didn't think of.In addition, I considered moving affix application to
layout::render
to apply it to anywhere else using bibliography, but it appears this is already manually handled by citation, so this breaks things.Scripts used
Nushell file (
parse.nu
):You can use this at
processor-tests/humans
withWhich provides a table with columns
name
(filename),MODE
(citation / bibliography),RESULT
(test result), ..., as well asparsed_res
(RESULT
parsed as HTML (actually XML, but here that works) into a table) andflattened_res
(flattened list of HTML element information)The command below provides the list of HTML elements used:
Output
TODO
sort_VariousNameMacros1.txt
test) is probably a bug in hayagriva and best fixed separately. I think the problem is that formatting is being applied to affixes when it shouldn't.