From d0fd14adeb55b4dfffed43c413207b2328c654dd Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Thu, 9 Jun 2011 22:05:51 -0400
Subject: v3: sysenv, limit/prevent the creation of spurious language output
 directories

---
 data/doc/sisu/CHANGELOG_v3 | 3 +++
 lib/sisu/v3/embedded.rb    | 4 ++--
 lib/sisu/v3/sysenv.rb      | 5 ++++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index 866bd075..c80dfc33 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -25,6 +25,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.12.orig.tar.gz
     * carry information on document language (from filename and or directory
     * (additional test)
 
+  * sysenv, limit/prevent the creation of spurious output directories (based on
+    language subdirectories), revisit
+
   * manifest, fix a full name
 
   * html, index.html syslink, remove and remake syslink
diff --git a/lib/sisu/v3/embedded.rb b/lib/sisu/v3/embedded.rb
index fad1fb29..fb2245c9 100644
--- a/lib/sisu/v3/embedded.rb
+++ b/lib/sisu/v3/embedded.rb
@@ -87,8 +87,8 @@ module SiSU_Embedded
     def images
       src="#{@base_src_dir}/_sisu/image"
       src_img='_sisu/image'
-      ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}"
-      img_dir="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"
+      ldest=@env.path.output
+      img_dir="#{@env.path.output}/_sisu/image"
       @rhost.each do |remote_conn|
         rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image"
         remote_rel=remote_conn[:name] + '/' + @f.output_path.stub.rcp
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index 944df010..d0c88deb 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -1642,7 +1642,10 @@ WOK
         "#{path.webserv}/#{images}"
       end
       def output                                                               #web/webserv output directory... subdirectory into which further subdirectories are made based on file names
-        "#{path.webserv}/#{@stub_pwd}"
+        r=Px[:lng_lst].join('|')
+        u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
+        base_stub=@sys.pwd.gsub(u,'\1')
+        "#{path.webserv}/#{base_stub}"
       end
       def feed
         (defined? @rc['webserv']['feed']) \
-- 
cgit v1.2.3