You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by cu...@apache.org on 2018/04/04 13:33:06 UTC

[whimsy] branch parse-pre-2007 updated: Allow fallback parsing of pre-2007 agendas

This is an automated email from the ASF dual-hosted git repository.

curcuru pushed a commit to branch parse-pre-2007
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/parse-pre-2007 by this push:
     new 6e0b61a  Allow fallback parsing of pre-2007 agendas
6e0b61a is described below

commit 6e0b61ae5e8761096385c7e3ff8f5d16c092782f
Author: Shane Curcuru <as...@shanecurcuru.org>
AuthorDate: Wed Apr 4 09:32:57 2018 -0400

    Allow fallback parsing of pre-2007 agendas
    
    Produces results for pre-2007 agendas, and doesn’t affect parsing of
    later ones.  Needs review
---
 lib/whimsy/asf/agenda.rb              | 3 +++
 lib/whimsy/asf/agenda/exec-officer.rb | 6 ++++--
 lib/whimsy/asf/agenda/minutes.rb      | 2 +-
 lib/whimsy/asf/agenda/special.rb      | 4 ++--
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/lib/whimsy/asf/agenda.rb b/lib/whimsy/asf/agenda.rb
index 63503ce..a894277 100644
--- a/lib/whimsy/asf/agenda.rb
+++ b/lib/whimsy/asf/agenda.rb
@@ -29,6 +29,9 @@ class ASF::Board::Agenda
     '9.' => 'Action Items'
   }
 
+  # Regex for start of officer reports (accounts for style differences in early agendas)
+  OFFICER_SEPARATOR = /^\s*4. (Executive )?Officer Reports/
+
   @@parsers = []
   # convenience method.  If passed a file, will create an instance of this
   # class and call the parse method on that object.  If passed a block, will
diff --git a/lib/whimsy/asf/agenda/exec-officer.rb b/lib/whimsy/asf/agenda/exec-officer.rb
index 69d815a..795b28a 100644
--- a/lib/whimsy/asf/agenda/exec-officer.rb
+++ b/lib/whimsy/asf/agenda/exec-officer.rb
@@ -2,8 +2,10 @@
 
 class ASF::Board::Agenda
   parse do
-    reports = @file.split(/^ 4. Executive Officer Reports/,2).last.
-      split(/^ 5. Additional Officer Reports/,2).first
+    reports = @file.split(OFFICER_SEPARATOR,2).last
+    a = reports.split(/^ 5. Additional Officer Reports/,2).first
+    b = reports.split(/^ 5. Committee Reports/,2).first   # Allow parsing of pre-2007 reports
+    (a.length > b.length) ? reports = b : reports = a
 
     pattern = /
       \s{4}(?<section>[A-Z])\.
diff --git a/lib/whimsy/asf/agenda/minutes.rb b/lib/whimsy/asf/agenda/minutes.rb
index db5b67f..4e48e45 100644
--- a/lib/whimsy/asf/agenda/minutes.rb
+++ b/lib/whimsy/asf/agenda/minutes.rb
@@ -3,7 +3,7 @@
 class ASF::Board::Agenda
   parse do
     minutes = @file.split(/^ 3. Minutes from previous meetings/,2).last.
-      split(/^ 4. Executive Officer Reports/,2).first
+      split(OFFICER_SEPARATOR,2).first
 
     pattern = /
       \s{4}(?<section>[A-Z])\.
diff --git a/lib/whimsy/asf/agenda/special.rb b/lib/whimsy/asf/agenda/special.rb
index ae390c1..3b1bb29 100644
--- a/lib/whimsy/asf/agenda/special.rb
+++ b/lib/whimsy/asf/agenda/special.rb
@@ -2,8 +2,8 @@
 
 class ASF::Board::Agenda
   parse do
-    orders = @file.split(/^ 7. Special Orders/,2).last.
-      split(/^ 8. Discussion Items/,2).first
+    orders = @file.split(/^ \d. Special Orders/,2).last.
+      split(/^ \d. Discussion Items/,2).first
 
     pattern = /
       \n+(?<indent>\s{3,5})(?<section>[A-Z])\.

-- 
To stop receiving notification emails like this one, please contact
curcuru@apache.org.