MishaS schrieb:
> No suggestions? :) I looked at the code and it seems that it's not
> possible to specify where to look for images. But I'd appreciate a
> confirmation from developers :)
>
> --
> Misha
>
> On Jan 11, 5:04 pm, MishaS <[email protected]> wrote:
>> Hi,
>>
>> (Maybe I did not RTFM well enough. Sorry, if it's the case)
>>
>> I'm writing documentation for an application and there are two things
>> I do not know how to do :)
>>
>> 1. I would like to refer to toolbar images application offers, however
>> I do not really want to copy images to the directory where
>> documentation sources reside.
>>
>> 2. The application has slightly different icons depending on the
>> target platform. I'd like the documentation to show correct icons
>> when generated for those different platforms.
Hi Misha,
image paths are always relative to the directory of the document that
contains them.
Your problem could be solved by a custom image directive, e.g. add this
to your conf.py (this assumes docutils 0.5):
from docutils.parsers.rst.directives.images import Image
def platimage_directive(desctype, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
# run the standard Image directive
ret = Image('image', arguments, options, content, lineno,
content_offset, block_text, state, state_machine).run()
# fetch the config value and modify the URI of the image node
env = state.document.settings.env
ret[-1]['uri'] = env.config.platform + '/' + ret[-1]['uri']
# return everything the image directive returned
return ret
def setup(app):
# register the new directive and the new config value
app.add_directive('platimage', platimage_directive, 0, (1, 0, 1),
**Image.option_spec)
app.add_config_value('platform', 'win', True)
Then use .. platimage:: instead of .. image:: and set the "platform"
value in conf.py accordingly.
cheers,
Georg
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sphinx-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sphinx-dev?hl=en
-~----------~----~----~----~------~----~------~--~---