You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2018/02/24 17:22:29 UTC

[whimsy] branch master updated: only mark private full lines

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

rubys 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 5ac70e1  only mark private full lines
5ac70e1 is described below

commit 5ac70e1c0817ff574944f9d02e864a05e0de8123
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sat Feb 24 12:21:32 2018 -0500

    only mark private full lines
    
    flag remaining markers as errors
---
 www/board/agenda/public/stylesheets/app.css |  1 +
 www/board/agenda/views/pages/report.js.rb   | 26 +++++++++++++++++---------
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/www/board/agenda/public/stylesheets/app.css b/www/board/agenda/public/stylesheets/app.css
index a04da02..982b5dc 100644
--- a/www/board/agenda/public/stylesheets/app.css
+++ b/www/board/agenda/public/stylesheets/app.css
@@ -6,6 +6,7 @@ footer ul {list-style-type: none; padding: 0}
 a {color: #000}
 .shell {border: 1px solid black;  border-radius: 1em; margin: 0 25%}
 .private {background-color: #CCC; border: 1px solid #444; color: #000}
+.error {background-color: #F88}
 
 /* row colors */
 .blank      {background-color: #DDD !important}
diff --git a/www/board/agenda/views/pages/report.js.rb b/www/board/agenda/views/pages/report.js.rb
index 7f5f3c7..395234f 100644
--- a/www/board/agenda/views/pages/report.js.rb
+++ b/www/board/agenda/views/pages/report.js.rb
@@ -246,21 +246,29 @@ class Report < Vue
   # highlight private sections - these sections appear in the agenda but
   # will be removed when the minutes are produced (see models/minutes.rb)
   def privates(text)
-    # inline <private>...</private> sections (and preceding spaces and tabs)
-    # where the <private> and </private> are on the same line.
-    private_inline = Regexp.new('([ \t]*&lt;private&gt;.*?&lt;\/private&gt;)',
-      'ig')
-
     # block of lines (and preceding whitespace) where the first line starts
     # with <private> and the last line ends </private>.
     private_lines =
       Regexp.new('^([ \t]*&lt;private&gt;(?:\n|.)*?&lt;/private&gt;)(\s*)$',
       'mig')
 
-    # return the text with private sections marked with class private
-    return text.
-      gsub(private_inline, '<span class="private">$1</span>').
-      gsub(private_lines, '<div class="private">$1</div>')
+    # mark private sections with class private
+    text.gsub!(private_lines) do |match, text|
+      "<div class='private'>#{text}</div>"
+    end
+
+    # flag remaining private markers
+    text.gsub! /(.)(&lt;\/?private&gt;)(.)/ do |match, before, text, after|
+      if before == '>' or after == '<'
+        match
+      else
+        "#{before}<span class='error' " +
+        "title='private sections must consist only of full lines of text'" +
+        ">#{text}</span>#{after}"
+      end
+    end
+
+    return text
   end
   
   # expand president's attachments

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