From 154fd687b4b16eedbe1bf774b9ecdeab84c9694b Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Mon, 23 May 2011 21:56:12 -0400
Subject: v3: html, close files; syslink index.html to toc.html

* syslink will need revisit (will only "work" properly with by_language dir
  structure)
---
 data/doc/sisu/CHANGELOG_v3 |  5 +++++
 lib/sisu/v3/html.rb        | 13 +++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index a17ce05b..a3252781 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -44,6 +44,11 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.10.orig.tar.gz
     * show language versions published
       (needs 2 runs of manifest, polls output as to whether manifest files exist)
 
+  * html
+    * close files
+    * syslink index.html to toc.html, needs revisit
+      (will only "work" properly with by_language directory structure)
+
 %% 3.0.9.orig.tar.gz (2011-05-17:20/2)
 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/3.0.9-1
 http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.9.orig.tar.gz
diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v3/html.rb
index b569653f..d586c25d 100644
--- a/lib/sisu/v3/html.rb
+++ b/lib/sisu/v3/html.rb
@@ -628,6 +628,7 @@ WOK
             end
           end
         rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error
+        ensure; @filename_html_scroll.close
         end
       end
       def segtoc
@@ -645,6 +646,18 @@ WOK
             end
           end
         rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error
+        ensure
+          @filename_html_segtoc.close
+          @filename_html_index.close
+          ## only works properly for directory_structure_by language, fix
+          unless FileTest.file?("#{@file.output_path.html.dir}/index.html")
+            pwd_set=Dir.pwd
+            Dir.chdir(@file.output_path.html.dir)
+              system("
+                ln -s #{@file.base_filename.html_segtoc} index.html
+              ")
+            Dir.chdir(pwd_set)
+          end
         end
       end
     end
-- 
cgit v1.2.3