aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-05-14 12:56:09 -0400
committerNick Mathewson <nickm@torproject.org>2014-05-14 12:56:09 -0400
commit747f368c6d72cc6a68bb0a12c4209c534517b656 (patch)
tree413daa488159ad96a92782010eb70d3e2784b2c5 /scripts
parent585582fc8c77a19981af2887e0a9d7691c0a4845 (diff)
downloadtor-747f368c6d72cc6a68bb0a12c4209c534517b656.tar
tor-747f368c6d72cc6a68bb0a12c4209c534517b656.tar.gz
make the changelog text wrapper respect arma's no-initial-openparen rule
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/maint/format_changelog.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/maint/format_changelog.py b/scripts/maint/format_changelog.py
index 35044b318..ac96a7e8e 100755
--- a/scripts/maint/format_changelog.py
+++ b/scripts/maint/format_changelog.py
@@ -23,6 +23,8 @@ import sys
# 100 * the fourth power of overflowed characters
# PLUS
# .1 * a bit more than the cube of ragged space on the last line.
+# PLUS
+# OPENPAREN_PENALTY for each line that starts with (
#
# We use an obvious dynamic programming algorithm to sorta approximate this.
# It's not coded right or optimally, but it's fast enough for changelogs
@@ -44,6 +46,8 @@ OVERFLOW_PENALTY = 2000
ORPHAN_PENALTY = 10000
+OPENPAREN_PENALTY = 200
+
def generate_wrapping(words, divisions):
lines = []
last = 0
@@ -65,6 +69,9 @@ def wrapping_quality(words, divisions, width1, width2):
else:
width = width2
+ if line[0:1] == '(':
+ total += OPENPAREN_PENALTY
+
if length > width:
total += OVERFLOW_PENALTY * (
(length - width) ** OVERFLOW_EXPONENT )