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

milde--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9539
          http://sourceforge.net/p/docutils/code/9539
Author:   milde
Date:     2024-02-17 10:36:51 +0000 (Sat, 17 Feb 2024)
Log Message:
-----------
Use True/False instead of 1/0.

Fix some left-overs from the time Python did not have "real" booleans.

Modified Paths:
--------------
    trunk/docutils/docutils/frontend.py
    trunk/docutils/docutils/readers/standalone.py
    trunk/docutils/docutils/writers/_html_base.py
    trunk/docutils/docutils/writers/html5_polyglot/__init__.py
    trunk/docutils/docutils/writers/latex2e/__init__.py

Modified: trunk/docutils/docutils/frontend.py
===================================================================
--- trunk/docutils/docutils/frontend.py	2024-02-14 17:42:58 UTC (rev 9538)
+++ trunk/docutils/docutils/frontend.py	2024-02-17 10:36:51 UTC (rev 9539)
@@ -601,7 +601,7 @@
           {'dest': 'toc_backlinks', 'action': 'store_false'}),
          ('Link from footnotes/citations to references. (default)',
           ['--footnote-backlinks'],
-          {'action': 'store_true', 'default': 1,
+          {'action': 'store_true', 'default': True,
            'validator': validate_boolean}),
          ('Disable backlinks from footnotes and citations.',
           ['--no-footnote-backlinks'],
@@ -609,7 +609,7 @@
          ('Enable section numbering by Docutils.  (default)',
           ['--section-numbering'],
           {'action': 'store_true', 'dest': 'sectnum_xform',
-           'default': 1, 'validator': validate_boolean}),
+           'default': True, 'validator': validate_boolean}),
          ('Disable section numbering by Docutils.',
           ['--no-section-numbering'],
           {'action': 'store_false', 'dest': 'sectnum_xform'}),

Modified: trunk/docutils/docutils/readers/standalone.py
===================================================================
--- trunk/docutils/docutils/readers/standalone.py	2024-02-14 17:42:58 UTC (rev 9538)
+++ trunk/docutils/docutils/readers/standalone.py	2024-02-17 10:36:51 UTC (rev 9539)
@@ -28,18 +28,18 @@
           'document title (and subsequent section title to document '
           'subtitle promotion; enabled by default).',
           ['--no-doc-title'],
-          {'dest': 'doctitle_xform', 'action': 'store_false', 'default': 1,
-           'validator': frontend.validate_boolean}),
+          {'dest': 'doctitle_xform', 'action': 'store_false',
+           'default': True, 'validator': frontend.validate_boolean}),
          ('Disable the bibliographic field list transform (enabled by '
           'default).',
           ['--no-doc-info'],
-          {'dest': 'docinfo_xform', 'action': 'store_false', 'default': 1,
-           'validator': frontend.validate_boolean}),
+          {'dest': 'docinfo_xform', 'action': 'store_false',
+           'default': True, 'validator': frontend.validate_boolean}),
          ('Activate the promotion of lone subsection titles to '
           'section subtitles (disabled by default).',
           ['--section-subtitles'],
-          {'dest': 'sectsubtitle_xform', 'action': 'store_true', 'default': 0,
-           'validator': frontend.validate_boolean}),
+          {'dest': 'sectsubtitle_xform', 'action': 'store_true',
+           'default': False, 'validator': frontend.validate_boolean}),
          ('Deactivate the promotion of lone subsection titles.',
           ['--no-section-subtitles'],
           {'dest': 'sectsubtitle_xform', 'action': 'store_false'}),

Modified: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py	2024-02-14 17:42:58 UTC (rev 9538)
+++ trunk/docutils/docutils/writers/_html_base.py	2024-02-17 10:36:51 UTC (rev 9539)
@@ -69,7 +69,7 @@
          ('Embed the stylesheet(s) in the output HTML file.  The stylesheet '
           'files must be accessible during processing. (default)',
           ['--embed-stylesheet'],
-          {'default': 1, 'action': 'store_true',
+          {'default': True, 'action': 'store_true',
            'validator': frontend.validate_boolean}),
          ('Link to the stylesheet(s) in the output HTML file. ',
           ['--link-stylesheet'],

Modified: trunk/docutils/docutils/writers/html5_polyglot/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/__init__.py	2024-02-14 17:42:58 UTC (rev 9538)
+++ trunk/docutils/docutils/writers/html5_polyglot/__init__.py	2024-02-17 10:36:51 UTC (rev 9539)
@@ -95,7 +95,7 @@
            }),
          ('Append a self-link to section headings.',
           ['--section-self-link'],
-          {'default': 0, 'action': 'store_true'}),
+          {'default': False, 'action': 'store_true'}),
          ('Do not append a self-link to section headings. (default)',
           ['--no-section-self-link'],
           {'dest': 'section_self_link', 'action': 'store_false'}),

Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py	2024-02-14 17:42:58 UTC (rev 9538)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py	2024-02-17 10:36:51 UTC (rev 9539)
@@ -1344,7 +1344,7 @@
                            for path in stylesheet_list]
 
         # PDF setup
-        if self.hyperlink_color in ('0', 'false', 'False', ''):
+        if self.hyperlink_color.lower() in ('0', 'false', ''):
             self.hyperref_options = ''
         else:
             self.hyperref_options = ('colorlinks=true,'

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.