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
Add image scaling attributes to block image in DocBook backend #763
Comments
Open Question: Should we assume the scaledwidth value is a percentage? Or should we leave it open for the writer to set the units? |
I think that % should be the default and it is a good practice to use El divendres 1 de novembre de 2013, Dan Allen ha escrit:
Enviat amb Gmail Mobile |
Super. I added that feature. |
resolves #763 added scaling & align attributes to block image in DocBook backend
There still seems to be a compatibility issue with original asciidoc. If I remember correctly, original asciidoc allows to use both attributes, width and scaledwidth at the same time. width will only apply to HTML output, scaledwidth to docbook output. I am able to write
This is different in Asciidoctor. scaledwidth only applies to docbook output, but width applies to both, HTML and docbook. This causes such images not being scaled properly in generated PDF. Apparently, the backend sets contentwidth and contentheight attributes based on width and height parameters. As a workaround, I could use some conditional macros, but I am just wondering if this is how it should be. |
I'm pretty sure Asciidoctor and AsciiDoc Python have the same behavior. However, it's possible that in both cases it's incorrect. You can see that AsciiDoc Python uses width and height if present, even if scaledwidth is present. https://github.com/asciidoc/asciidoc/blob/master/docbook45.conf#L88 If you think a change is warranted, let's move forward with a separate issue that proposes the change. (not that this may be an Asciidoctor PDF issue because I know that scaling isn't working quite as we expect there). |
Yes, you are correct! I compared the docbook outputs asciidoc and asciidoctor and they are the same. Must have been something else, maybe related to #1059 and the FOP backend I am using. Scaling to different media is quite a bit of PITA... |
I agree. And PDF doesn't make reasoning about it easy in my experience. |
Add the following image scaling attributes to the block image output in the DocBook backend:
When the scaledwidth attribute is specified, the
scalefit="1"
attribute should be added to the<imagedata>
tag as well.Example:
Output:
Note that in Python AsciiDoc, it's necessary to define the alt attribute explicitly when any other attribute is present. For example:
The text was updated successfully, but these errors were encountered: