SF.net SVN: docutils:[9853 ] trunk/docutils/docutils/w riters/_html_base.py

milde--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9853
          http://sourceforge.net/p/docutils/code/9853
Author:   milde
Date:     2024-08-06 08:01:54 +0000 (Tue, 06 Aug 2024)
Log Message:
-----------
Use "root_prefix" only for path starting with {U+201C}/{U+201D}.

... not for Windows-paths starting with a backslash.

* This is the documented behaviour.
* It should be consistent accross tables, images, ...
  (In rST, the image location is specified as an URI, not as path.)

Fixup for [r9785]

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-03 21:31:01 UTC (rev 9852)
+++ trunk/docutils/docutils/writers/_html_base.py	2024-08-06 08:01:54 UTC (rev 9853)
@@ -631,7 +631,7 @@
         if uri_parts.scheme not in ('', 'file'):
             raise ValueError('Can only read local images.')
         imagepath = urllib.request.url2pathname(uri_parts.path)
-        if imagepath.startswith(('/', '\\')):  # UNIX- or Windows-style
+        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

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.