SF.net SVN: docutils:[9542] trunk/docutils

milde--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9542
          http://sourceforge.net/p/docutils/code/9542
Author:   milde
Date:     2024-02-17 10:37:23 +0000 (Sat, 17 Feb 2024)
Log Message:
-----------
Revert [r9410] "Prevent the 'theme' default overriding 'theme_url'."

As documented in docutils/docs/user/config.html#override,
"Client programs which specify defaults that override other settings must
do the overriding explicitly". This affects not only "theme"/"theme_url",
but also "stlesheet"/"stylesheet_path" (HTML and LaTeX), and
"footnote_references"/"trim_footnote_reference_space".

Exlicitly override "theme" in the S5 functional test setup instead.

Modified Paths:
--------------
    trunk/docutils/docutils/writers/s5_html/__init__.py
    trunk/docutils/test/functional/tests/standalone_rst_s5_html_1.py

Modified: trunk/docutils/docutils/writers/s5_html/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/s5_html/__init__.py	2024-02-17 10:37:13 UTC (rev 9541)
+++ trunk/docutils/docutils/writers/s5_html/__init__.py	2024-02-17 10:37:23 UTC (rev 9542)
@@ -44,9 +44,8 @@
           'destination file (output HTML).  Note that existing theme files '
           'will not be overwritten (unless --overwrite-theme-files is used).',
           ['--theme'],
-          {'metavar': '<name>', 'overrides': 'theme_url'
-           # default is set later as it would override theme-url
-           }),
+          {'default': 'default', 'metavar': '<name>',
+           'overrides': 'theme_url'}),
          ('Specify an S5 theme URL.  The destination file (output HTML) will '
           'link to this theme; nothing will be copied.  Overrides --theme.',
           ['--theme-url'],
@@ -174,10 +173,13 @@
         self.theme_files_copied = None
 
     def setup_theme(self):
-        if self.document.settings.theme_url:
+        if self.document.settings.theme:
+            self.copy_theme()
+        elif self.document.settings.theme_url:
             self.theme_file_path = self.document.settings.theme_url
         else:
-            self.copy_theme()
+            raise docutils.ApplicationError(
+                'No theme specified for S5/HTML writer.')
 
     def copy_theme(self):
         """
@@ -188,9 +190,6 @@
         from the specified theme, any base themes, and 'default'.
         """
         settings = self.document.settings
-        if not settings.theme:
-            # set default here to avoid overriding theme-url.
-            settings.theme = self.default_theme
         path = find_theme(settings.theme)
         theme_paths = [path]
         self.theme_files_copied = {}

Modified: trunk/docutils/test/functional/tests/standalone_rst_s5_html_1.py
===================================================================
--- trunk/docutils/test/functional/tests/standalone_rst_s5_html_1.py	2024-02-17 10:37:13 UTC (rev 9541)
+++ trunk/docutils/test/functional/tests/standalone_rst_s5_html_1.py	2024-02-17 10:37:23 UTC (rev 9542)
@@ -7,6 +7,8 @@
 settings_overrides = {
     'sectsubtitle_xform': True,
     'theme_url': 'ui/small-black',  # don't attempt to copy theme files
+    'theme': None,  # explicitely reset overriding option
+                    # (cf. ../../../docs/user/config.html#override)
     # local copy of default stylesheet:
     'stylesheet_path': 'functional/input/data/html4css1.css',
     }

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.