Bioconductor / BiocStyle

Issues and pull requests for BiocStyle should go here.
12 stars 19 forks source link

Updating footnote finding regex #72

Closed grimbough closed 4 years ago

grimbough commented 4 years ago

I've run into an issue where footnotes are not handled correctly when converting the pandoc HTML to the final version.

This only occurs on a system running RStudio 1.3.869 and is fine on a separate computer using RStudio 1.2.5033. I suspect the change in pandoc versions (2.7.3 vs 2.3.1) is the culprit but I can't find any release notes detailing this and there's many other difference between the two computers.

The cause seems to be because the 'left facing arrow with hook' pandoc inserts into the footnote link now includes some additional hidden bytes, that aren't matched by the regular expression that moves the footnotes.

On my working system I get get:

> charToRaw('↩')
[1] e2 86 a9

and on the system where it is failing I see:

> charToRaw('↩︎')
[1] e2 86 a9 ef b8 8e

This patch just expands the regular expression to allow for one or two character, which seems sufficient to match the new version but should be backwards compatible if this is a quirk of my machine.


I also updated some variable names as I couldn't use a variable called s inside RStudio debugging!

aoles commented 4 years ago

I can confirm that this is related to a change in pandoc. I could reproduce the issue once I've updated from version 2.1.3 to 2.9.2 without any other changes to my setup.

## pandoc 2.1.3
charToRaw('↩')
#> [1] e2 86 a9

## pandoc  2.9.2
charToRaw('↩︎')
#> [1] e2 86 a9 ef b8 8e

Created on 2020-03-24 by the reprex package (v0.3.0)

aoles commented 4 years ago

Thanks @grimbough for your fix! LGTM, will merge as soon as https://github.com/Bioconductor/BiocStyle/pull/67 is resolved.