SF.net SVN: docutils:[9917] trunk/docutils/docutils/writers/_html_base.py
milde--- via Docutils-checkins <[email protected]>
| Newsgroups | gmane.text.docutils.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 9917
http://sourceforge.net/p/docutils/code/9917
Author: milde
Date: 2024-09-03 09:35:59 +0000 (Tue, 03 Sep 2024)
Log Message:
-----------
Update documentation of `uri2imagepath()` method.
Update wording around `URI references`__. Cf. [r9883].
__ https://www.rfc-editor.org/rfc/rfc3986.html#section-4.1
Modified Paths:
--------------
trunk/docutils/docutils/writers/_html_base.py
Modified: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py 2024-08-21 13:45:27 UTC (rev 9916)
+++ trunk/docutils/docutils/writers/_html_base.py 2024-09-03 09:35:59 UTC (rev 9917)
@@ -609,18 +609,21 @@
def uri2imagepath(self, uri):
"""Get filesystem path corresponding to an URI.
- The image directive expects an image URI. Some writers require the
+ The image directive expects an image URI__. Some writers require the
corresponding image path to read the image size from the file or to
embed the image in the output.
- Absolute URIs consider the "root_prefix" setting.
+ URIs with absolute "path" part consider the ``root_prefix`` setting.
- In order to work in the output document, relative image URIs relate
- to the output directory. For access by the writer, the corresponding
- image path must be relative to the current working directory.
+ In order to work in the output document, URI references with relative
+ path relate to the output directory. For access by the writer, the
+ corresponding image path must be relative to the current working
+ directory.
Provisional: the function's location, interface and behaviour
may change without advance warning.
+
+ __ https://www.rfc-editor.org/rfc/rfc3986.html
"""
destination = self.settings._destination or ''
uri_parts = urllib.parse.urlparse(uri)
@@ -630,7 +633,7 @@
if imagepath.startswith('/'): # cf. config.html#root-prefix
root_prefix = Path(self.settings.root_prefix)
imagepath = (root_prefix/imagepath[1:]).as_posix()
- elif not os.path.isabs(imagepath): # exclude absolute Windows paths
+ elif not os.path.isabs(imagepath): # path may be absolute Windows path
destdir = os.path.abspath(os.path.dirname(destination))
imagepath = utils.relative_path(None,
os.path.join(destdir, imagepath))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.