asciidoctor / asciidoctorj-pdf

AsciidoctorJ PDF bundles the Asciidoctor PDF RubyGem (asciidoctor-pdf) so it can be loaded into the JVM using JRuby.
Apache License 2.0
36 stars 17 forks source link

include text-hyphen gem to allow hyphenation in upcoming asciidoctor-pdf 1.5.x #29

Closed ahus1 closed 4 years ago

ahus1 commented 4 years ago

to allow users to switch on hyphenation of created PDF.

This is added as part of https://github.com/asciidoctor/asciidoctor-pdf/issues/20 and will be part of an upcoming asciidoctor-pdf 1.5.x release.

It is an optional dependency for the gem, but IMHO it would be nice for users of AsciidoctorJ-PDF to have these 700k already included in the 4000k JAR to avoid manual configuration for the users.

ahus1 commented 4 years ago

@robertpanzer - upstream ticket is in master, therefore this PR is ready to be merged.

ahus1 commented 4 years ago

@robertpanzer - upstream has been released with the hyphenation feature. I would be very happy if this PR could be merged for the upcoming v1.5.0 Beta 8 release of AsciidoctorJ. Including the dependencies for hyphenation in the JAR would make it so much easier to add hyphenation in a Maven/Gradle build.

I've rebased it and the GitHub builds complete successfully. Please let me know if I should do anything else.

robertpanzer commented 4 years ago

I tried this PR and also bumped the version of asciidoctor-pdf to 1.5.0-alpha.8. But I wasn't able to see any hyphens when rendering this document:

:lang: DE
:hyphenate:

Mitwirkende sind immer willkommen.
Neue Mitwirkende sind immer willkommen!
Wenn Sie Fehler oder Auslassungen im Quellcode, in der Dokumentation oder im Inhalt der Website entdecken, zögern Sie bitte nicht, ein Problem zu melden oder eine Pull Request mit einem Fix zu öffnen.

I converted the document with this command:

./asciidoctorj -b pdf -r text-hyphen test.adoc

The PDF also shows that asciidoctor-pdf 1.5.0-beta.8 was used:

%PDF-1.4
%<FF><FF><FF><FF>
1 0 obj
<< /Title (Untitled)
/Creator (Asciidoctor PDF 1.5.0.beta.8, based on Prawn 2.2.2)
/Producer (Asciidoctor PDF 1.5.0.beta.8, based on Prawn 2.2.2)
/ModDate (D:20191123171303-08'00')

I also checked that these files are in the asciidoctorj-pdf.jar:

gems/text-hyphen-1.4.1/lib/text/hyphen/language/de.rb
gems/asciidoctor-pdf-1.5.0.beta.8/lib/asciidoctor/pdf/text_transformer.rb

Is there anything to do in addition to check if the hyphenation works?

ahus1 commented 4 years ago

@robertpanzer - as there is an upstream release I could have added a test case. I'm sorry that I missed that opportunity.

The discussion upstream ended up choosing :hyphens: as the attribute, not :hyphenate:

I've pushed a change that bumps up the asciidoctor-pdf version to beta.8 and adds two test cases for English and German hyphenation.

To run the tests on Windows 10 I also updated JRuby from 9.1.12.0 to 9.1.17.0 to avoid some weird error ("(SystemCallError) Unknown error (SystemCallError) 123 - FindFirstFile") -- I hope you won't object.

robertpanzer commented 4 years ago

Oh yes, thank you! I just saw this PR yesterday to change the :hyphens: attribute to :hyphenate: but didn't figure that it was not merged but closed. (I was heavily jet lagged :D)

ahus1 commented 4 years ago

Thank you for the merge - looking forward to the next release of asciidoctorj-pdf (no pressure :-)