From 307dc2a385a62e9c390e045f39c1b288631c9481 Mon Sep 17 00:00:00 2001
From: Hans Hagen <pragma@wxs.nl>
Date: Thu, 22 Mar 2007 13:34:00 +0100
Subject: stable 2007.03.22 13:34

---
 scripts/context/ruby/ctxtools.rb | 15 +++++++++++++--
 scripts/context/ruby/xmltools.rb |  2 +-
 2 files changed, 14 insertions(+), 3 deletions(-)

(limited to 'scripts')

diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb
index a70501cd5..27240583a 100644
--- a/scripts/context/ruby/ctxtools.rb
+++ b/scripts/context/ruby/ctxtools.rb
@@ -2596,7 +2596,17 @@ class Commands
 
         def fetchfile(site, name, target=nil)
             begin
-                http = Net::HTTP.new(site)
+                proxy = @commandline.option('proxy')
+                if proxy && ! proxy.empty? then
+                    address, port = proxy.split(":")
+                    if address && port then
+                        http = Net::HTTP::Proxy(address, port).new(site)
+                    else
+                        http = Net::HTTP::Proxy(proxy, 80).new(site)
+                    end
+                else
+                    http = Net::HTTP.new(site)
+                end
                 resp, data = http.get(name.gsub(/^\/*/, '/'))
             rescue
                 return false
@@ -2697,12 +2707,13 @@ commandline.registeraction('listentities'      , 'create doctype entity definiti
 commandline.registeraction('brandfiles'        , 'add context copyright notice [--force]')
 commandline.registeraction('platformize'       , 'replace line-endings [--recurse --force] [pattern]')
 commandline.registeraction('dependencies'      , 'analyze depedencies within context [--save --compact --filter=[macros|filenames]] [filename]')
-commandline.registeraction('updatecontext'     , 'download latest version and remake formats')
+commandline.registeraction('updatecontext'     , 'download latest version and remake formats [--proxy]')
 commandline.registeraction('disarmutfbom'      , 'remove utf bom [--force]')
 
 commandline.registervalue('type','')
 commandline.registervalue('filter','')
 commandline.registervalue('maproot','')
+commandline.registervalue('proxy','')
 
 commandline.registerflag('recurse')
 commandline.registerflag('force')
diff --git a/scripts/context/ruby/xmltools.rb b/scripts/context/ruby/xmltools.rb
index e0ff3c0f7..c28df200d 100644
--- a/scripts/context/ruby/xmltools.rb
+++ b/scripts/context/ruby/xmltools.rb
@@ -476,7 +476,7 @@ class Commands
                 "<#{elements.length}>"
             end
             # abc[-/]def
-            data.gsub!(/([a-z]{3,})([\/\-\(\)])([a-z]{3,})/moi) do
+            data.gsub!(/([a-z]{3,})([\/\-\(\)]+)([a-z]{3,})/moi) do
                 done = true
                 report("compound: #{$1}#{$2}#{$3}") if verbose
                 "#{$1}<compound token='#{$2}'/>#{$3}"
-- 
cgit v1.2.3