MishaS schrieb: >> 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. > Thanks for the suggestion! :) I could not get this working though: > Image is not available in the specified module (maybe, I'm using a > wrong version of docutils, however the standard ``.. image:`` works > just fine). > > While changing ``Image`` to ``image`` and ``.option_spec`` to > ``.options`` I got it to ``.run()``, where I am now completely > clueless. > > Could you please help? :)
So you're running docutils 0.4.x -- I think it should work if, in addition to your replacements, you replace Image(...).run() by image(). Georg --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sphinx-dev" group. To post to this group, send email to sphinx-dev@googlegroups.com To unsubscribe from this group, send email to sphinx-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en -~----------~----~----~----~------~----~------~--~---