This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 403c3ee7 Dynamically size PMC entries
403c3ee7 is described below
commit 403c3ee75d44680e501dd744ab1feeca354c4657
Author: Sebb <[email protected]>
AuthorDate: Sun Apr 30 19:59:48 2023 +0100
Dynamically size PMC entries
---
lib/whimsy/asf/committee.rb | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/lib/whimsy/asf/committee.rb b/lib/whimsy/asf/committee.rb
index f2e89ae4..9eb77035 100644
--- a/lib/whimsy/asf/committee.rb
+++ b/lib/whimsy/asf/committee.rb
@@ -399,9 +399,23 @@ module ASF
sections.delete_if {|section| section.downcase.start_with? pmc.downcase}
# build new section
+ # first check if need to increase column sizes
+ namelen = 26 # original
+ nameaddrlen = 59 # original
+ idlen = 0
+ people.map do |id, person|
+ namel = person[:name].size + 1
+ namelen = namel if namel > namelen
+ idl = id.size
+ idlen = idl if idl > idlen
+ end
+ idlen += 15 # '<@apache.org> ' # allowing for two trailing spaces
minimum
+ adjust = namelen + idlen - nameaddrlen
+ nameaddrlen += adjust if adjust > 0
+
people = people.map do |id, person|
- name = "#{person[:name].ljust(26)} <#{id}@apache.org>"
- " #{(name).ljust(59)} [#{date.strftime('%Y-%m-%d')}]"
+ name = "#{person[:name].ljust(namelen)} <#{id}@apache.org>"
+ " #{(name).ljust(nameaddrlen)} [#{date.strftime('%Y-%m-%d')}]"
end
section = ["#{pmc} (est. #{date.strftime('%m/%Y')})"] + people.sort