ggrossetie / asciidoctor-web-pdf

Convert AsciiDoc documents to PDF using web technologies
https://asciidoctor.org
MIT License
448 stars 92 forks source link

Problems with collapsible blocks #241

Open henriette-einstein opened 4 years ago

henriette-einstein commented 4 years ago

I use a collapsible block in a test document.

[%collapsible]
====
Example block turns into collapsible summary/details.
====

The collapsible is not automatically expanded in the PDF generated. It works if I write it

[%collapsible%open]

I think, collapsibles should always be expanded when producing PDF's. Or at least there should be a CLI-option to expand all collapsible blocks.

If the collapsible is expanded with %open, the text 'Details' gets displayed on every page that contains part of the collapsible. That is a) not necessary and b) does not display the collapsible title that has been set but instead the string 'Details' which is the default text.

I attach a PDF that demonstrates that. It has a little more content than the sample code above.

sample.pdf

ggrossetie commented 4 years ago

That's a good point!

To be clear, the sample.pdf file attached was generated from Asciidoctor Web PDF (I really need to rename this project I keep saying Asciidoctor Web PDF but the project is named Asciidoctor.js PDF... anyway :zany_face:) or Asciidoctor Ruby PDF?

henriette-einstein commented 4 years ago

Yes, the PDF has been generated with Asciidoctor Web PDF. Asciidoctor-pdf --version returns

Asciidoctor PDF 1.0.0-alpha.7 using Asciidoctor.js 2.2.0 (Asciidoctor 2.0.10) [https://asciidoctor.org]
Runtime Environment (node v14.0.0 on darwin)
CLI version 3.2.0

It was just an except. I attach the complete PDF and the source document here.

sample.adoc.txt sample.pdf

I had to rename the suffix of the sample doc to adoc.txt, because GitHub would not let me drop adoc files directly. Just rename the extension back afterwards.

Actually I wanted to check my own stylesheet that produces the HTML-page you can find at https://henriette-einstein.net/sample.html. There you can see that the CSSgram stuff actually works...

ggrossetie commented 4 years ago

Thanks I will have a look :eyes: I was asking because I wonder how Asciidoctor Ruby PDF (the "reference implementation") is solving this issue.

ggrossetie commented 4 years ago

I can confirm that collapsible are "expanded" with Asciidoctor PDF.

collapsible.pdf

I don't think we can "open" the collapsible block using CSS. To fix this issue, we could:

Any preference?

henriette-einstein commented 4 years ago

I'd probably use a TreeProcessor.

BTW: I am dealing with some personal issues to get rid of some errand cells using chemicals. Therefore I am not participating with Asciidoctor stuff too much at the moment. I hopefully will be back soon.

ggrossetie commented 4 years ago

BTW: I am dealing with some personal issues to get rid of some errand cells using chemicals. Therefore I am not participating with Asciidoctor stuff too much at the moment. I hopefully will be back soon.

I'm sorry to hear that... Take care, I hope you will get better soon :pray:

I would not aus JavaScript. It adds additional complexity to the processing chain with probably additional problems.

Yes, I agree :100:

The HTML 5 converter does what it has to do. It produces HTML 5. That the PDF production has to fiddle with the HTML in order to expand collapsible does not belong its responsibility.

Yes, but at the same time the converter is specific and its responsibility is to produce a printable HTML 5 page. So I think it's reasonable to do that in the converter.

Currently, we rely a lot on the built-in HTML 5 converter from Asciidoctor but it was mainly to get a "quick" result at the early stage of the project. Now that this project is gradually becoming a full-fledged converter, we can add more logic.