whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] 01/01: add support for inline private sections
Date Tue, 19 Jul 2016 10:54:39 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch inline-privates
in repository https://git-dual.apache.org/repos/asf/whimsy.git

commit d5a40de7a2e9f779c9d81b48c41f6d2136442243
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Mon Jul 18 22:26:05 2016 -0400

    add support for inline private sections
    
    Two forms will be supported:
    
    1) entirely contained on one line, optionally with text before and after.
    
    2) where <private> is the first non-blank on a line, and </private> is the
    last non-blank on a line.  Note: text may follow the open tag and precede
    the close tag.
    
    It turns out the hardest part of this is determining what white space
    needs to be removed in conjunction with the private markers.
---
 www/board/agenda/models/minutes.rb        | 2 ++
 www/board/agenda/views/pages/report.js.rb | 8 ++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/www/board/agenda/models/minutes.rb b/www/board/agenda/models/minutes.rb
index 0f610f9..b91e4ae 100755
--- a/www/board/agenda/models/minutes.rb
+++ b/www/board/agenda/models/minutes.rb
@@ -164,6 +164,8 @@ class Minutes
     minutes.sub! /^End of agenda/, 'End of minutes'
 
     minutes.gsub! /^\s*<private>.*?<\/private>\s*?\n/mi, ''
+    minutes.gsub! /[ \t]*<private>.*?<\/private>/i, ''
+
     minutes.gsub! /\n( *)\[ comments:.*?\n\1 ? ?\]/m, ''
 
     minutes
diff --git a/www/board/agenda/views/pages/report.js.rb b/www/board/agenda/views/pages/report.js.rb
index d0a67cd..e23fe00 100644
--- a/www/board/agenda/views/pages/report.js.rb
+++ b/www/board/agenda/views/pages/report.js.rb
@@ -232,11 +232,15 @@ class Report < React
 
   # private sections
   def privates(text)
-    private_sections =
+    private_inline = /([ \t]*&lt;private&gt;.*?&lt;\/private&gt;)/
+
+    private_lines =
       Regexp.new('^([ \t]*&lt;private&gt;(?:\n|.)*?&lt;/private&gt;)(\s*)$',
       'mig')
 
-    return text.gsub(private_sections, '<div class="private">$1</div>')
+    return text.
+      gsub(private_inline, '<span class="private">$1</span>').
+      gsub(private_lines, '<div class="private">$1</div>')
   end
   
   # expand president's attachments

-- 
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <commits@whimsical.apache.org>.

Mime
View raw message