-
Notifications
You must be signed in to change notification settings - Fork 0
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
Shell Scripts Produce Corrupt PDFs under Bash for Windows #66
Comments
Update all existing Bash and batch build scripts: * Add consistent header info e annotations. * Add public domain note via the Unlicense (where applies). Update all Bash scripts for building PDF docs, and add new ones where missing: * Fix incomplete template path in some script. * Abort if executed under Bash for Windows, due to asciidoctor-fopub not being able to find default template images (e.g. admonitions icons). For more info, See #66.
This is a rather annoying problem because if asciidoctor-fopub could run without problems in Bash for Windows we could get rid of the batch scripts and use only Bash scripts — the assumption being that all contributors to the project should have Git, and therefore a Bash also on Windows. Having to maintain all scripts in two versions (Bash + batch) is not only a burden, but it could easily lead to having scripts out of synch, therefore I'm not happy about it. Also, Bash offers many useful tools which are not available on the CMD, many of which are useful for working on cross-platform repos (e.g. unix2dos, dos2unix, iconv, etc.). The current solution of Bash scripts aborting when detecting that they are running under @thoni56, any idea why asciidoctor-fopub fails under Bash for Win? |
I've done some experimentation with this in Cygwin and Msys2 and get the same problem in both. Once I've run Running
|
Mhhhh. I suspected this was the problem. I've experienced something similar in the StdLib repo, with other dependencies. The best approach IMO is to:
But, from what I remember, the main problem are the DocBook settings files, which don't work well with relative paths across multiple OSs. I remember having experienced some problems locating the fonts, and that it could only be done using Windows paths for some reasons. So, we'll have to look at the settings too, because images and fonts are controlled by the template settings. This is the reason why I was considering looking into Asciidoctor's native PDF backend, and check if the previous issues have been solved in the meantime (there were some problems with footnotes at the time, but they might be solved now). Because it's a Gem, it's going to be much easier to use it in the toolchain without headaches. Also, Java has given lot's of problems with fopub so far, with Gradle incompatibility issues (which were finally solved) and more. |
Might Need to Sub-Module FoPubHaving compared your error reports with mine, and your comments on the different behaviours under CygWin and MSYS2, I think that the problem we have here is dual-fold:
Probably the former might be fixed somehow, whereas the latter might require adding asciidoctor-fopub as a Git submodule into the repository, so that we can either pass some custom relative paths via command line options, or add some paths to the env Adding asciidoctor-fopub as a Git submodule has some other advantages too, i.e. we can ensure that everyone is using the same exact version, in case the repository is updated (which doesn't happen often though, with the latest commit being from 2018). The "Image not found" errors seem to be due to Bash vs Windows paths, since I get this error for an image that is actually there:
As for the config file error, which related to the Git submodule of our template, the paths are also resolved correct, but one is being passed (or just reported?) using the
It's strange that the
It's looking in the wrong path, the
Yes, I'm aware that CygWin and MSYS2 do some path sanitation in the background, on the fly, to ensure that paths are handled properly; but Java isn't so smart (another reason in the long list of reasons why I hate Java and its portability myths). Having to keep dual scripts (batch and shell) is really an unnecessary pain. I should really check whether the official Asciidoctor PDF backend has been updated and solved all those old problems that were preventing us from using it (a couple of years have passed since). The main problem with switching to Asciidoctor PDF is that we'll need to implement an ALAN syntax for the Rogue highlighter in order to support syntax highlighting — but then, this would solve other issues too, since a Rouge syntax would support call-outs, and can be used in the HTML backend tool. Rouge is definitely the best highlighter choice since it's in Ruby and supported by all the official Asciidoctor backends. It's similar to Pygments (Python), and it's powerful because it uses a state stack that allows contextual operations on the syntax. I'll look into it, it doesn't seem to hard to do, it's just that I don't know Ruby that well, and I'm not sure if and how a custom syntax can be integrated into Rouge without submitting it to the upstream repository. |
Start polishing the "Beginner's Guide" build scripts, dropping all the non-essential batch scripts and replacing them with Bash scripts. The only batch script preserved is `PDF_BUILD.bat`, due to the known issues with trying to use asciidoctor-fopub from Windows Bash (#66). Also polish the B.Guide's README files, removing all redundant info on the Lib v0.6 and linking instead to the ALAN Wiki and the Alan Goodies repositories to obtain more info.
Start polishing the "Beginner's Guide" build scripts, dropping all the non-essential batch scripts and replacing them with Bash scripts. The only batch script preserved is `PDF_BUILD.bat`, due to the known issues with trying to use asciidoctor-fopub from Windows Bash (#66). Also polish the B.Guide's README files, removing all redundant info on the Lib v0.6 and linking instead to the ALAN Wiki and the Alan Goodies repositories to obtain more info.
Start polishing the "Beginner's Guide" build scripts, dropping all the non-essential batch scripts and replacing them with Bash scripts. The only batch script preserved is `PDF_BUILD.bat`, due to the known issues with trying to use asciidoctor-fopub from Windows Bash (#66). Also polish the B.Guide's README files, removing all redundant info on the Lib v0.6 and linking instead to the ALAN Wiki and the Alan Goodies repositories to obtain more info.
Start polishing the "Beginner's Guide" build scripts, dropping all the non-essential batch scripts and replacing them with Bash scripts. The only batch script preserved is `PDF_BUILD.bat`, due to the known issues with trying to use asciidoctor-fopub from Windows Bash (#66). Also polish the B.Guide's README files, removing all redundant info on the Lib v0.6 and linking instead to the ALAN Wiki and the Alan Goodies repositories to obtain more info.
The
.sh
script to build the PDF docs via asciidoctor-fopub don't work as expected under Bash for Windows, for they seem unable to locate the default template images, thus creating a PDF with no admonitions icons:whereas the image mentioned in the error is actually there, with the correct path and filename!
It must be something related to how paths are handled in Bash for Windows vs real *nix bash, and how these interact with FOP.
We need to:
.sh
scripts for PDF build detect if running under Git for Windows' Bash (viaMinGW
env var) and abort execution if so..sh
scripts work..bat
scripts and keep only Bash scripts.The text was updated successfully, but these errors were encountered: