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 d420779f Move monkey patch to separate file
d420779f is described below

commit d420779f26271fbdbee2fe3a3f6b5276ad04c952
Author: Sebb <[email protected]>
AuthorDate: Sat Feb 18 23:15:33 2023 +0000

    Move monkey patch to separate file
---
 lib/whimsy/asf/wunderbar_updates.rb | 37 +++++++++++++++++++++++++++++++++++
 www/members/member_nominations.cgi  | 39 +------------------------------------
 2 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/lib/whimsy/asf/wunderbar_updates.rb 
b/lib/whimsy/asf/wunderbar_updates.rb
new file mode 100644
index 00000000..fb32fa62
--- /dev/null
+++ b/lib/whimsy/asf/wunderbar_updates.rb
@@ -0,0 +1,37 @@
+# Hack to ensure multiple lines are in the same 'pre' block
+module Wunderbar
+  class XmlMarkup
+    def system(*args)
+      opts = {}
+      opts = args.pop if Hash === args.last
+
+      tag = opts[:tag] || 'pre'
+      merge_lines = tag == 'pre' # merge lines of the same type
+      output_class = opts[:class] || {}
+      output_class[:stdin]  ||= '_stdin'
+      output_class[:stdout] ||= '_stdout'
+      output_class[:stderr] ||= '_stderr'
+      output_class[:hilite] ||= '_stdout _hilite'
+
+      out = []
+      okind = nil
+      rc = super(*args, opts) do |kind, line|
+        if merge_lines
+          if okind && kind != okind && !out.empty? # change of kind
+            tag! tag, out.join("\n"), class: output_class[okind]
+            out = []
+          end
+          out << line
+        else # normal; no accumulation of lines
+          tag! tag, line, class: output_class[kind]
+        end
+        okind = kind
+      end
+      # Output last line(s)
+      unless out.empty?
+        tag! tag, out.join("\n"), class: output_class[okind]
+      end
+      return rc
+    end
+  end
+end
diff --git a/www/members/member_nominations.cgi 
b/www/members/member_nominations.cgi
index 16bb1e2d..6f298037 100755
--- a/www/members/member_nominations.cgi
+++ b/www/members/member_nominations.cgi
@@ -8,6 +8,7 @@ require 'wunderbar/bootstrap'
 require 'whimsy/asf'
 require 'whimsy/asf/forms'
 require 'whimsy/asf/member-files'
+require 'whimsy/asf/wunderbar_updates'
 
 def emit_form(title, prev_data)
   _whimsy_panel(title, style: 'panel-success') do
@@ -40,44 +41,6 @@ def validate_form(formdata: {})
   return 'OK'
 end
 
-# Hack to ensure multiple lines are in the same 'pre' block
-module Wunderbar
-  class XmlMarkup
-    def system(*args)
-      opts = {}
-      opts = args.pop if Hash === args.last
-
-      tag = opts[:tag] || 'pre'
-      merge_lines = tag == 'pre' # merge lines of the same type
-      output_class = opts[:class] || {}
-      output_class[:stdin]  ||= '_stdin'
-      output_class[:stdout] ||= '_stdout'
-      output_class[:stderr] ||= '_stderr'
-      output_class[:hilite] ||= '_stdout _hilite'
-
-      out = []
-      okind = nil
-      rc = super(*args, opts) do |kind, line|
-        if merge_lines
-          if okind && kind != okind && !out.empty? # change of kind
-            tag! tag, out.join("\n"), class: output_class[okind]
-            out = []
-          end
-          out << line
-        else # normal; no accumulation of lines
-          tag! tag, line, class: output_class[kind]
-        end
-        okind = kind
-      end
-      # Output last line(s)
-      unless out.empty?
-        tag! tag, out.join("\n"), class: output_class[okind]
-      end
-      return rc
-    end
-  end
-end
-
 # Handle submission (checkout user's apacheid.json, write form data, checkin 
file)
 # @return true if we think it succeeded; false in all other cases
 def process_form(formdata: {}, wunderbar: {})

Reply via email to