-
Notifications
You must be signed in to change notification settings - Fork 345
Asciidoctor: Copy inline images in lists #824
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
Conversation
Adds support for copying inline images declared in lists. Sadly, Asciidoctor doesn't make this easy. They pre-convert lists so we have to detect the image in docbook. I feel like it might have been a mistake to try and copy images by traversing the tree, mostly because Asciidoctor works in strange ways.
I noticed this when working on converting Kibana's book to Asciidoctor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very minor if
statement comment
process_inline_image_from_source block, block.source if block.content_model == :simple | ||
process_inline_image_from_converted block, block.text if | ||
block.context == :list_item && block.parent.context == :olist | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to reverse the syntax and write the if
statement first.
I typically only use the post-fix if
statement if it fits on one line and is fairly simple logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it!
@@ -68,6 +74,22 @@ def process_inline_image(block) | |||
end | |||
end | |||
|
|||
## | |||
# Scan the inline image from the generated docbook. It is not nice that | |||
# this is required there isn't much we can do about it. We *could* rewrite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe missing the word 'so'..?
@esdocs, I've fixed this up from your comments and reworked it to be a bit more consistent with itself. |
@estolfo, I've fixed this up from your comments and reworked it a big to be more consistent. Could you have another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks a lot better now!
Thanks so much for reviewing @estolfo! |
Adds support for copying inline images declared in lists. Sadly,
Asciidoctor doesn't make this easy. They pre-convert lists so we have to
detect the image in docbook. I feel like it might have been a mistake to
try and copy images by traversing the tree, mostly because Asciidoctor
works in strange ways.