ImageSizingTreeprocessor for putting width and height attrs into images#80
Closed
danyill wants to merge 1 commit intoasciidoctor:masterfrom
Closed
ImageSizingTreeprocessor for putting width and height attrs into images#80danyill wants to merge 1 commit intoasciidoctor:masterfrom
danyill wants to merge 1 commit intoasciidoctor:masterfrom
Conversation
…e and allow height scaling
Contributor
Author
|
I forgot to reference Issue 1451 where @mojavelinux suggested a TreeProcessor |
Contributor
Author
|
Thinking about this (and asciidoctor/asciidoctor#1116), maybe I did it wrong. If the user specifies the height, should we just proportionately modify the width and only set that to retain responsiveness? |
Member
|
The width is the only attribute that the processor considers. So the width should be computed from the height and passed through. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I realised I couldn't do height scaling on an image in a table, and discovered that there were some other image handling problems (see Issue 820 and Issue 1116). For my money I would have said that at least being able to set the height rather than the width should be a feature of the core.
I thought for education I would attempt the Treeprocessor for image blocks using fastimage as per the @mojavelinux suggestion.
I took the approach (discussed in the above issues) that aspect ratio must be as per the image sizing and so this Treeprocessor respects the image aspect ratio and doesn't allow it to be changed. There is I guess other reasonable options.
I had difficulty figuring out how to iterate across table cells to deal with block images in asciidoc styled cells. There is quite possibly a better way but it wasn't obvious to me.
Hopefully this is closer to the desired code style as well.