asciidoctor / asciidoctor-bibtex

Add bibtex citation support for asciidoc documents
Other
69 stars 27 forks source link

No citation when two pictures are side-by-side #85

Closed anneloreegger closed 2 years ago

anneloreegger commented 2 years ago

When I try to display 2 pictures side by side by using an invisible table, the citations I then use in the picture caption do not work.

Citations I use inside picture captions but not inside an invisible table work.

I have created a small example to show the issue. I have posted the example in the asciidoctor zulip chat in this message: https://asciidoctor.zulipchat.com/#narrow/stream/288690-users.2Fasciidoctor-pdf/topic/.E2.9C.94.20Side-by-side.20Images/near/283862156

The command I use to generate the pdf is: asciidoctor-pdf Report.adoc -a pdf-themesdir=themes -a pdf-theme=basic -r asciidoctor-bibtex

Let me know if you have issues looking at the example.

Is it anyhow possible to still display the citation in the caption?

mojavelinux commented 2 years ago

The problem is that the extension is not traversing into AsciiDoc table cells. To fix it, the following call:

prose_blocks = document.find_by do |b|

must be changed to:

prose_blocks = document.find_by traverse_documents: true do |b|

Then, it will find the cite macro in the image caption inside the AsciiDoc table cell.

anneloreegger commented 2 years ago

Thank you for your answer.

Could you explain to me how exactly I could change this? I tried to add an extension, but I am not sure if I tried to do this right and if I even have to add an extension to do this.

mojavelinux commented 2 years ago

That comment was directed at the maintainer of this project. I was explaining how the code would have to change to accommodate this scenario. If you would like to submit a PR, then these are the lines of code that need to be changed: