Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--syntax-definition doesn't work with absolute paths in Windows #6374

Closed
THS-on opened this issue May 17, 2020 · 10 comments
Closed

--syntax-definition doesn't work with absolute paths in Windows #6374

THS-on opened this issue May 17, 2020 · 10 comments

Comments

@THS-on
Copy link

THS-on commented May 17, 2020

System info

  • Pandoc 2.9.2.1
  • Tested using Windows 10 and 7
  • Tested using cmd.exe and calling pandoc using python subprocess

If I use the absolute path for --syntax-definition it will fail with the following message.

C:\Users\User\Desktop>pandoc --syntax-definition C:\Users\User\Desktop\cpp.xml test.md
pandoc: file:///C:/Users/User/Desktop/cpp.xml: openBinaryFile: invalid argument (Invalid argument)

Relative paths work fine.

C:\Users\User\Desktop>pandoc --syntax-definition cpp.xml test.md


C:\Users\User\Desktop>

To recreate this problem

@jgm
Copy link
Owner

jgm commented May 17, 2020

See #4836, which I thought could be fixed by turning this into a file: URL -- but the OP never confirmed that the fix worked, and I wasn't able to test it myself since I don't have a windows box to test on.

@THS-on
Copy link
Author

THS-on commented May 26, 2020

Thanks for the quick reply. I switched my scripts to use relative paths under Windows, to make them work.
If I find the time I'll setup Haskell on Windows and try to debug it. At which parts of pandoc and hxt should I look?
Can this be fixed in pandoc or should I look into fixing it in hxt?

@jgm
Copy link
Owner

jgm commented May 28, 2020

Fixing in HXT would be best, if the maintainer is responsive (I never got any reply to my bug report). I'm not sure how to fix in pandoc, but maybe there's something I haven't thought of.

@tim-elmer
Copy link

See #4836, which I thought could be fixed by turning this into a file: URL -- but the OP never confirmed that the fix worked, and I wasn't able to test it myself since I don't have a windows box to test on.

Tested with Pandoc 2.14.2, file protocol is prepended by pandoc, but error is still thrown: pandoc.exe: file:///C:/Users/XYZ: openBinaryFile: invalid argument (Invalid argument).

jgm/skylighting@16e3001 doesn't seem to have resolved the issue.

@jgm
Copy link
Owner

jgm commented Oct 6, 2021

Since all of this, we've switched from HXT to xml-conduit in skylighting.
So the commit you mention isn't even in the code any more; file:// is being prepended by pandoc's command line option parser, but it shouldn't be any more. (I'll change this; maybe it will help, maybe not.)

jgm added a commit that referenced this issue Oct 6, 2021
This was a fix for a problem in skylighting, but this
problem doesn't exist now that we've moved from HXT to
xml-conduit.

Cf. #6374.
@jgm
Copy link
Owner

jgm commented Oct 6, 2021

Done in 5a1bd52
Please test (nightly should be available by tomorrow).

@tim-elmer
Copy link

This may be me being obtuse, but I'm assuming you're referring to master branch. Tried cloning and building it but I'm not having any luck (stack install log: https://pastebin.com/WFisqkgQ). I don't know how much effort you want to put into walking me through getting a test build working.

Relative paths work for me.

@jgm
Copy link
Owner

jgm commented Oct 9, 2021

Try a (precompiled) nightly, you don't need to build it yourself.
https://github.com/jgm/pandoc/actions/runs/1319449072

@tim-elmer
Copy link

Ah, missed that, thanks. That build does appear to resolve the issue. I was able to process a markdown document to html with an absolutely pathed syntax definition.

👍

@THS-on
Copy link
Author

THS-on commented Oct 9, 2021

I can confirm that this fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants