Skip to content

Commit 4dd708c

Browse files
author
Matthias Koeppe
committed
sage --package create: Attempt to bring SPKG.rst title to a common style
1 parent 998de5f commit 4dd708c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

build/sage_bootstrap/creator.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ def set_description(self, description, license, upstream_contact):
6363
Write the ``SPKG.rst`` file
6464
"""
6565
with open(os.path.join(self.path, 'SPKG.rst'), 'w+') as f:
66+
# Attempt to bring title to a common style
67+
if description.startswith(self.package_name + ':'):
68+
description = description[len(self.package_name + ':'):]
69+
if description.startswith(self.package_name + ' is'):
70+
description = description[len(self.package_name + ' is'):]
71+
description = description.strip()
72+
if not description.endswith('etc.'):
73+
description = description.rstrip('.')
74+
if description.startswith('A ') or description.startswith('a '):
75+
description = description[2:].strip()
76+
if description.startswith('An ') or description.startswith('an '):
77+
description = description[3:].strip()
78+
if description:
79+
description = description[0].upper() + description[1:]
80+
6681
def heading(title, char='-'):
6782
return '{0}\n{1}\n\n'.format(title, char * len(title))
6883
if description:

0 commit comments

Comments
 (0)