Skip to content
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

Error when attempting to align an image to the right #64

Open
HalosGhost opened this issue Oct 15, 2014 · 5 comments
Open

Error when attempting to align an image to the right #64

HalosGhost opened this issue Oct 15, 2014 · 5 comments

Comments

@HalosGhost
Copy link

I have the following snippet in my index.rst:

.. |hackerlogo| image:: hackerlogo.png
                :alt: hacker-emblem
                :align: bottom
                :target: http://www.catb.org/hacker-emblem/

This works just fine; however, if I change bottom to right (a valid value according to the docutils documentation), I get the following error when running rst2html5:

index.rst:55: (ERROR/3) Error in "image" directive: "right" is not a valid value for the "align" option within a substitution definition.  Valid values for "align" are: "top", "middle", "bottom".
index.rst:55: (WARNING/2) Substitution definition "hackerlogo" empty or invalid.

.. |hackerlogo| image:: hackerlogo.png
                :alt: hacker-emblem
                :align: right
                :target: http://www.catb.org/hacker-emblem/
index.rst:51: (ERROR/3) Undefined substitution referenced: "hackerlogo".

As a result, to get the desired affect, I'm going into the generated index.html and manually changeing class="align-bottom" to class="align-right". Ideally, rst2html5 would recognize right as a valid value and set the class accordingly.

@pcav
Copy link

pcav commented Dec 8, 2014

I cannot confirm this.

@HalosGhost
Copy link
Author

I will check again tonight when I am at a computer which can access the source file on which this error was occurring. If I can still reproduce the error, I will post my full source file and the command I used to generate the HTML. If not, I will close this issue as noise and apologize fully.

Yes, this error still exists for me. Here is the source file. When generating an html file from this source file using the following command, I get the error mentioned in the OP:

rst2html5 --title="/home/halosghost" --favicon=favicon.ico index.rst > index.html

@asermax
Copy link
Contributor

asermax commented Jun 3, 2015

Can't reproduce this error either, the right value seems to be valid for the align property on images.

@HalosGhost
Copy link
Author

This error is still present for me. To elaborate a little further, the definition for the align-right class appears correct, but using :align: right on that image still generates this error. My workaround is still to use :align: bottom and then manually change the image's class to align-right.

@asermax
Copy link
Contributor

asermax commented Jun 8, 2015

Ohh I missed your example being a definition for inline substitution (I'm still learning some aspects of RST).

Based on this mailing list thread, I think the behaviour you're experiencing is the expected one. The way you're defining your image is used for inline substitution, which means using the image within a line a text, in which case only the top, bottom and middle values make sense (which is what the error says).

If instead you remove the reference (|hackerlogo|) and use the image directive directly where the logo will be used, you will be able to use the right value for the align property (this is what I have tested and works correctly).

In any case, if you still think this is a bug, you should probably report it upstream, since that's how docutils is implemented.

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

No branches or pull requests

3 participants