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

grubert--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9717
          http://sourceforge.net/p/docutils/code/9717
Author:   grubert
Date:     2024-05-19 16:03:42 +0000 (Sun, 19 May 2024)
Log Message:
-----------
Stop converting text to full capitals (bug #481).

Modified Paths:
--------------
    trunk/docutils/HISTORY.txt
    trunk/docutils/docutils/writers/manpage.py
    trunk/docutils/test/functional/expected/standalone_rst_manpage.man
    trunk/docutils/test/test_writers/test_manpage.py

Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt	2024-05-19 10:38:12 UTC (rev 9716)
+++ trunk/docutils/HISTORY.txt	2024-05-19 16:03:42 UTC (rev 9717)
@@ -54,8 +54,8 @@
   - Remove code for unused emdash bullets.
   - Feature-request #105 more informative document comments.
     docutils version in header
+  - Stop converting text to full capitals (bug #481).
 
-
 Release 0.21.2 (2024-04-23)
 ===========================
 

Modified: trunk/docutils/docutils/writers/manpage.py
===================================================================
--- trunk/docutils/docutils/writers/manpage.py	2024-05-19 10:38:12 UTC (rev 9716)
+++ trunk/docutils/docutils/writers/manpage.py	2024-05-19 16:03:42 UTC (rev 9717)
@@ -24,19 +24,19 @@
 Man pages have no subsection only parts.
 Standard parts
 
-  NAME ,
-  SYNOPSIS ,
-  DESCRIPTION ,
-  OPTIONS ,
-  FILES ,
-  SEE ALSO ,
-  BUGS ,
+  Name ,
+  Synopsis ,
+  Description ,
+  Options ,
+  Files ,
+  See also ,
+  Bugs ,
 
 and
 
-  AUTHOR .
+  AUthor .
 
-A unix-like system keeps an index of the DESCRIPTIONs, which is accessible
+A unix-like system keeps an index of the Descriptions, which is accessible
 by the command whatis or apropos.
 
 """
@@ -195,10 +195,10 @@
         self.compact_simple = None
         # the list style "*" bullet or "#" numbered
         self._list_char = []
-        # writing the header .TH and .SH NAME is postboned after
+        # writing the header .TH and .SH Name is postboned after
         # docinfo.
         self._docinfo = {
-                "title": "", "title_upper": "",
+                "title": "", 
                 "subtitle": "",
                 "manual_section": "", "manual_group": "",
                 "author": [],
@@ -388,19 +388,19 @@
         self._list_char.pop()
 
     def header(self):
-        th = (".TH \"%(title_upper)s\" \"%(manual_section)s\""
+        th = (".TH \"%(title)s\" \"%(manual_section)s\""
               " \"%(date)s\" \"%(version)s\"") % self._docinfo
         if self._docinfo["manual_group"]:
             th += " \"%(manual_group)s\"" % self._docinfo
         th += "\n"
-        sh_tmpl = (".SH NAME\n"
+        sh_tmpl = (".SH Name\n"
                    "%(title)s \\- %(subtitle)s\n")
         return th + sh_tmpl % self._docinfo
 
     def append_header(self):
-        """append header with .TH and .SH NAME"""
+        """append header with .TH and .SH Name"""
         # NOTE before everything
-        # .TH title_upper section date source manual
+        # .TH title section date source manual
         # BUT macros before .TH for whatis database generators.
         if self.header_written:
             return
@@ -428,7 +428,7 @@
             self.body.append('.sp\n')
             name = '%s%s:%s\n' % (
                 self.defs['strong'][0],
-                self.language.labels.get(name, name).upper(),
+                self.language.labels.get(name, name),
                 self.defs['strong'][1],
                 )
             self.body.append(name)
@@ -607,12 +607,12 @@
 
     def depart_document(self, node):
         if self._docinfo['author']:
-            self.body.append('.SH AUTHOR\n%s\n'
+            self.body.append('.SH Author\n%s\n'
                              % ', '.join(self._docinfo['author']))
         skip = ('author', 'copyright', 'date',
                 'manual_group', 'manual_section',
                 'subtitle',
-                'title', 'title_upper', 'version')
+                'title', 'version')
         for name in self._docinfo_keys:
             if name == 'address':
                 self.body.append("\n%s:\n%s%s.nf\n%s\n.fi\n%s%s" % (
@@ -629,7 +629,7 @@
                     label = self.language.labels.get(name, name)
                 self.body.append("\n%s: %s\n" % (label, self._docinfo[name]))
         if self._docinfo['copyright']:
-            self.body.append('.SH COPYRIGHT\n%s\n'
+            self.body.append('.SH Copyright\n%s\n'
                              % self._docinfo['copyright'])
         self.body.append(self.comment_begin('End of generated man page.'))
 
@@ -1159,11 +1159,9 @@
             self.body.append('.IP "')
         elif self.section_level == 0:
             self._docinfo['title'] = node.astext()
-            # document title for .TH
-            self._docinfo['title_upper'] = node.astext().upper()
             raise nodes.SkipNode
         elif self.section_level == 1:
-            self.body.append('.SH %s\n'%self.deunicode(node.astext().upper()))
+            self.body.append('.SH %s\n'%self.deunicode(node.astext()))
             raise nodes.SkipNode
         else:
             self.body.append('.SS ')

Modified: trunk/docutils/test/functional/expected/standalone_rst_manpage.man
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_manpage.man	2024-05-19 10:38:12 UTC (rev 9716)
+++ trunk/docutils/test/functional/expected/standalone_rst_manpage.man	2024-05-19 16:03:42 UTC (rev 9717)
@@ -28,8 +28,8 @@
 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
 ..
-.TH "RST2MAN" "1" "2006-10-22" "0.1" "text processing"
-.SH NAME
+.TH "rst2man" "1" "2006-10-22" "0.1" "text processing"
+.SH Name
 rst2man \- generate unix manpages from reStructured text
 .\" TODO: authors and author with name <email>
 .
@@ -100,8 +100,8 @@
 .UNINDENT
 .sp
 Discussion is still open.
-.SH AUTHOR
+.SH Author
 [email protected]
-.SH COPYRIGHT
+.SH Copyright
 public domain
 .\" End of generated man page.

Modified: trunk/docutils/test/test_writers/test_manpage.py
===================================================================
--- trunk/docutils/test/test_writers/test_manpage.py	2024-05-19 10:38:12 UTC (rev 9716)
+++ trunk/docutils/test/test_writers/test_manpage.py	2024-05-19 16:03:42 UTC (rev 9717)
@@ -77,7 +77,7 @@
 totest['blank'] = [
         ["",
          document_start + indend_macros + """.TH "" "" "" ""
-.SH NAME
+.SH Name
  \\- \n\
 .\\" End of generated man page.
 """],
@@ -89,11 +89,11 @@
 
 """,
          document_start + indend_macros +
-""".TH "HELLO, WORLD." "" "" ""
-.SH NAME
+""".TH "Hello, world." "" "" ""
+.SH Name
 Hello, world. \\- \n\
 .sp
-\\fBWARNING:\\fP
+\\fBWarning:\\fP
 .INDENT 0.0
 .INDENT 3.5
 This broke docutils\\-sphinx.
@@ -165,8 +165,8 @@
 """,
          document_start + indend_macros +
 """\
-.TH "SIMPLE" "1" "2009-08-05" "0.1" "text processing"
-.SH NAME
+.TH "simple" "1" "2009-08-05" "0.1" "text processing"
+.SH Name
 simple \\- The way to go
 .SH SYNOPSIS
 .INDENT 0.0
@@ -192,13 +192,13 @@
 .B  \\-\\-help\\fP,\\fB  \\-h
 Show this help message and exit.
 .UNINDENT
-.SH OTHER SECTION
+.SH OtHeR SECTION
 .sp
 link to  <http://docutils.sourceforge.io> \n\
 .sp
 With mixed case.
 .sp
-\\fBATTENTION!:\\fP
+\\fBAttention!:\\fP
 .INDENT 0.0
 .INDENT 3.5
 Admonition with title
@@ -222,11 +222,11 @@
 .sp
 and . in a line and at line start
 \\&.in a paragraph
-.SH AUTHOR
+.SH Author
 [email protected]
 
 Arbitrary field: some text
-.SH COPYRIGHT
+.SH Copyright
 public domain
 .\\" End of generated man page.
 """],
@@ -244,7 +244,7 @@
 '''\
 \'\\" t
 ''' + document_start + indend_macros + '''.TH "" "" "" ""
-.SH NAME
+.SH Name
  \\- \n\
 .INDENT 0.0
 .INDENT 3.5
@@ -295,7 +295,7 @@
    bla bla bla
 """,
 document_start + indend_macros + """.TH "" "" "" ""
-.SH NAME
+.SH Name
  \\- \n\
 optin group with dot as group item
 .INDENT 0.0
@@ -347,13 +347,13 @@
     Description of Term 1 Description of Term 1
 
 """,
-document_start + indend_macros + '''.TH "DEFINITION LIST TEST" "" "" ""
-.SH NAME
+document_start + indend_macros + '''.TH "Definition List Test" "" "" ""
+.SH Name
 Definition List Test \\- \n\
 ''' + '''.SS Abstract
 .sp
 Docinfo is required.
-.SH SECTION
+.SH Section
 .INDENT 0.0
 .TP
 .B term1
@@ -374,7 +374,7 @@
   -i DEVICE, --input DEVICE  input device
 """,
 document_start + indend_macros + """.TH "" "" "" ""
-.SH NAME
+.SH Name
  \\- \n\
 .INDENT 0.0
 .TP
@@ -400,7 +400,7 @@
 .. [empty_citation]
 """,
 document_start + indend_macros + """.TH "" "" "" ""
-.SH NAME
+.SH Name
  \\- \n\
 .IP [docutils] 5
 blah blah blah
@@ -416,7 +416,7 @@
 - a list
 """,
 document_start + indend_macros + """.TH "" "" "" ""
-.SH NAME
+.SH Name
  \\- \n\
 some rubric
 .INDENT 0.0
@@ -436,7 +436,7 @@
 They are "escaped" anywhere.
 """,
 document_start + indend_macros + """.TH "" "" "" ""
-.SH NAME
+.SH Name
  \\- \n\
 .INDENT 0.0
 .TP
@@ -465,8 +465,8 @@
 
 Test title, docinfo to man page header.
 """,
-document_start + indend_macros + r""".TH "PAGE TITLE" "3" "3/Nov/2022" "0.0" "the books"
-.SH NAME
+document_start + indend_macros + r""".TH "page title" "3" "3/Nov/2022" "0.0" "the books"
+.SH Name
 page title \- in short
 .sp
 Test title, docinfo to man page header.

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.