mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Image paths can now be absolute (like `/images/foo.png`).
They are treated as relative to the top source directory.
This commit is contained in:
7
CHANGES
7
CHANGES
@@ -37,6 +37,9 @@ New features added
|
||||
the directive -- this allows you to define your document
|
||||
structure, but place the links yourself.
|
||||
|
||||
- Image paths can now be absolute (like ``/images/foo.png``).
|
||||
They are treated as relative to the top source directory.
|
||||
|
||||
- #52: There is now a ``hlist`` directive, creating a compact
|
||||
list by placing distributing items into multiple columns.
|
||||
|
||||
@@ -49,8 +52,8 @@ New features added
|
||||
- #23: Added a ``classmethod`` directive along with ``method``
|
||||
and ``staticmethod``.
|
||||
|
||||
- Added a ``toctree`` variable to the templates, and the ability to
|
||||
include external links in toctrees.
|
||||
- Added a ``toctree`` callable to the templates, and the ability
|
||||
to include external links in toctrees.
|
||||
|
||||
* Configuration:
|
||||
|
||||
|
||||
@@ -647,7 +647,11 @@ class BuildEnvironment:
|
||||
candidates['?'] = imguri
|
||||
continue
|
||||
# imgpath is the image path *from srcdir*
|
||||
imgpath = path.normpath(path.join(docdir, imguri))
|
||||
if imguri.startswith('/') or imguri.startswith(os.sep):
|
||||
# absolute path (= relative to srcdir)
|
||||
imgpath = path.normpath(imguri[1:])
|
||||
else:
|
||||
imgpath = path.normpath(path.join(docdir, imguri))
|
||||
# set imgpath as default URI
|
||||
node['uri'] = imgpath
|
||||
if imgpath.endswith(os.extsep + '*'):
|
||||
|
||||
@@ -2,3 +2,5 @@ Image including source in subdir
|
||||
================================
|
||||
|
||||
.. image:: img.*
|
||||
|
||||
.. image:: /rimg.png
|
||||
|
||||
@@ -61,6 +61,7 @@ HTML_XPATH = {
|
||||
},
|
||||
'subdir/images.html': {
|
||||
".//img[@src='../_images/img1.png']": '',
|
||||
".//img[@src='../_images/rimg.png']": '',
|
||||
},
|
||||
'includes.html': {
|
||||
".//pre": u'Max Strauß',
|
||||
|
||||
Reference in New Issue
Block a user