Skip to content

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

Merged
merged 3 commits into from
May 2, 2019

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Apr 19, 2019

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.

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.
@nik9000 nik9000 requested a review from estolfo April 19, 2019 14:37
@nik9000
Copy link
Member Author

nik9000 commented Apr 19, 2019

I noticed this when working on converting Kibana's book to Asciidoctor.

Copy link
Contributor

@estolfo estolfo left a 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
Copy link
Contributor

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.

Copy link
Member Author

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
Copy link
Contributor

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'..?

@nik9000
Copy link
Member Author

nik9000 commented Apr 30, 2019

@esdocs, I've fixed this up from your comments and reworked it to be a bit more consistent with itself.

@nik9000
Copy link
Member Author

nik9000 commented Apr 30, 2019

@estolfo, I've fixed this up from your comments and reworked it a big to be more consistent. Could you have another look?

Copy link
Contributor

@estolfo estolfo left a 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!

@nik9000 nik9000 merged commit 77ba014 into elastic:master May 2, 2019
@nik9000
Copy link
Member Author

nik9000 commented May 2, 2019

Thanks so much for reviewing @estolfo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants