From 4ab5d6eb5296782ff609d4731deaf1bff1870c65 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Thu, 23 Jan 2014 10:24:58 +0100 Subject: [PATCH 1/3] Closes #1358: Fix handling of image paths outside of the source directory when using the "wildcard" style reference. --- CHANGES | 2 ++ sphinx/environment.py | 3 ++- sphinx/transforms.py | 3 ++- sphinx/util/__init__.py | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index b970416af..d043ce4f6 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,8 @@ Bugs fixed * PR#213: Fix a missing import in the setup command. * #1357: Option names documented by :rst:dir:`option` are now again allowed to not start with a dash or slash, and referencing them will work correctly. +* #1358: Fix handling of image paths outside of the source directory when using + the "wildcard" style reference. Documentation ------------- diff --git a/sphinx/environment.py b/sphinx/environment.py index c84f5752c..e3e1cd0aa 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -799,7 +799,8 @@ class BuildEnvironment: node['uri'] = rel_imgpath if rel_imgpath.endswith(os.extsep + '*'): for filename in glob(full_imgpath): - new_imgpath = relative_path(self.srcdir, filename) + new_imgpath = relative_path(path.join(self.srcdir, 'dummy'), + filename) if filename.lower().endswith('.pdf'): candidates['application/pdf'] = new_imgpath elif filename.lower().endswith('.svg'): diff --git a/sphinx/transforms.py b/sphinx/transforms.py index 53bbadb0e..64310d7f6 100644 --- a/sphinx/transforms.py +++ b/sphinx/transforms.py @@ -163,7 +163,8 @@ class Locale(Transform): settings, source = self.document.settings, self.document['source'] # XXX check if this is reliable assert source.startswith(env.srcdir) - docname = path.splitext(relative_path(env.srcdir, source))[0] + docname = path.splitext(relative_path(path.join(env.srcdir, 'dummy'), + source))[0] textdomain = find_catalog(docname, self.document.settings.gettext_compact) diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index a20fc19be..0fd4d49bb 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -142,7 +142,7 @@ def copy_static_entry(source, targetdir, builder, context={}, Handles all possible cases of files, directories and subdirectories. """ if exclude_matchers: - relpath = relative_path(builder.srcdir, source) + relpath = relative_path(path.join(builder.srcdir, 'dummy'), source) for matcher in exclude_matchers: if matcher(relpath): return From 25ac2dda9c84f5ed0bb9997a59604d97409e5a32 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 24 Jan 2014 20:22:58 +0100 Subject: [PATCH 2/3] add link --- doc/extdev/envapi.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/extdev/envapi.rst b/doc/extdev/envapi.rst index 56771f733..84ad3e0d9 100644 --- a/doc/extdev/envapi.rst +++ b/doc/extdev/envapi.rst @@ -9,7 +9,7 @@ Build environment API .. attribute:: app - Reference to the application object. + Reference to the :class:`.Sphinx` (application) object. .. attribute:: config From cf60ef0e75143806985bb1c502a69cb40dcf6779 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 26 Jan 2014 11:40:22 +0100 Subject: [PATCH 3/3] Update list of extensions in sphinx-contrib. --- doc/develop.rst | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/doc/develop.rst b/doc/develop.rst index faece78d0..41a75dcba 100644 --- a/doc/develop.rst +++ b/doc/develop.rst @@ -25,30 +25,40 @@ releases on PyPI, others you can install from a checkout. This is the current list of contributed extensions in that repository: -- aafig: render embeded ASCII art as nice images using aafigure_. +- aafig: render embedded ASCII art as nice images using aafigure_. - actdiag: embed activity diagrams by using actdiag_ - adadomain: an extension for Ada support (Sphinx 1.0 needed) - ansi: parse ANSI color sequences inside documents -- autorun: Execute code in a runblock directive. +- autorun: Execute code in a ``runblock`` directive. - blockdiag: embed block diagrams by using blockdiag_ - cheeseshop: easily link to PyPI packages - clearquest: create tables from ClearQuest_ queries. +- cmakedomain_: a domain for CMake_ - coffeedomain: a domain for (auto)documenting CoffeeScript source code. - context: a builder for ConTeXt. - doxylink: Link to external Doxygen-generated HTML documentation +- domaintools_: A tool for easy domain creation. - email: obfuscate email addresses - erlangdomain: an extension for Erlang support (Sphinx 1.0 needed) - exceltable: embed Excel spreadsheets into documents using exceltable_ - feed: an extension for creating syndication feeds and time-based overviews from your site content +- findanything_: an extension to add Sublime Text 2-like findanything panels + to your documentation to find pages, sections and index entries while typing - gnuplot: produces images using gnuplot_ language. -- googleanalytics: track html visitors statistics +- googleanalytics: track web visitor statistics by using `Google Analytics`_ - googlechart: embed charts by using `Google Chart`_ - googlemaps: embed maps by using `Google Maps`_ - httpdomain: a domain for documenting RESTful HTTP APIs. - hyphenator: client-side hyphenation of HTML using hyphenator_ +- inlinesyntaxhighlight_: inline syntax highlighting +- lassodomain: a domain for documenting Lasso_ source code - lilypond: an extension inserting music scripts from Lilypond_ in PNG format. +- makedomain_: a domain for `GNU Make`_ +- matlabdomain: document MATLAB_ code. +- mockautodoc: mock imports. - mscgen: embed mscgen-formatted MSC (Message Sequence Chart)s. +- napoleon: supports `Google style`_ and `NumPy style`_ docstrings. - nicoviceo: embed videos from nicovideo - nwdiag: embed network diagrams by using nwdiag_ - omegat: support tools to collaborate with OmegaT_ (Sphinx 1.1 needed) @@ -56,16 +66,18 @@ This is the current list of contributed extensions in that repository: - paverutils: an alternate integration of Sphinx with Paver_. - phpdomain: an extension for PHP support - plantuml: embed UML diagram by using PlantUML_ +- py_directive: Execute python code in a ``py`` directive and return a math node. - rawfiles: copy raw files, like a CNAME. - requirements: declare requirements wherever you need (e.g. in test docstrings), mark statuses and collect them in a single list +- restbuilder: a builder for reST (reStructuredText) files. - rubydomain: an extension for Ruby support (Sphinx 1.0 needed) - sadisplay: display SqlAlchemy model sadisplay_ -- sdedit: an extension inserting sequence diagram by using Quick Sequence. +- sdedit: an extension inserting sequence diagram by using Quick Sequence Diagram Editor (sdedit_) - seqdiag: embed sequence diagrams by using seqdiag_ - slide: embed presentation slides on slideshare_ and other sites. -- swf: embed flash files +- swf_: embed flash files - sword: an extension inserting Bible verses from Sword_. - tikz: draw pictures with the `TikZ/PGF LaTeX package`_. - traclinks: create TracLinks_ to a Trac_ instance from within Sphinx @@ -94,8 +106,11 @@ own extensions. .. _seqdiag: http://blockdiag.com/en/ .. _actdiag: http://blockdiag.com/en/ .. _nwdiag: http://blockdiag.com/en/ +.. _Google Analytics: http://www.google.com/analytics/ .. _Google Chart: https://developers.google.com/chart/ .. _Google Maps: https://maps.google.com/ +.. _Google style: http://google-styleguide.googlecode.com/svn/trunk/pyguide.html +.. _NumPy style: https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt .. _hyphenator: http://code.google.com/p/hyphenator/ .. _exceltable: http://pythonhosted.org/sphinxcontrib-exceltable/ .. _YouTube: http://www.youtube.com/ @@ -103,3 +118,14 @@ own extensions. .. _Zope interfaces: http://docs.zope.org/zope.interface/README.html .. _slideshare: http://www.slideshare.net/ .. _TikZ/PGF LaTeX package: http://sourceforge.net/projects/pgf/ +.. _MATLAB: http://www.mathworks.com/products/matlab/ +.. _swf: http://bitbucket.org/klorenz/sphinxcontrib-swf +.. _findanything: http://bitbucket.org/klorenz/sphinxcontrib-findanything +.. _cmakedomain: http://bitbucket.org/klorenz/sphinxcontrib-cmakedomain +.. _GNU Make: http://www.gnu.org/software/make/ +.. _makedomain: http://bitbucket.org/klorenz/sphinxcontrib-makedomain +.. _inlinesyntaxhighlight: http://sphinxcontrib-inlinesyntaxhighlight.readthedocs.org +.. _CMake: http://cmake.org +.. _domaintools: http://bitbucket.org/klorenz/sphinxcontrib-domaintools +.. _restbuilder: https://pypi.python.org/pypi/sphinxcontrib-restbuilder +.. _Lasso: http://www.lassosoft.com/