From 3a3037c4a06759a752c60c715f9ccae8c219c7b0 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Tue, 15 Jul 2014 18:52:57 -0400
Subject: v5 v6: base images & css

---
 lib/sisu/v5/conf.rb   | 73 +++++++++++++++++++++++++++++++++++++--------------
 lib/sisu/v5/css.rb    |  6 ++---
 lib/sisu/v5/html.rb   |  1 +
 lib/sisu/v5/sysenv.rb | 23 +++++++++++-----
 lib/sisu/v6/conf.rb   | 73 +++++++++++++++++++++++++++++++++++++--------------
 lib/sisu/v6/css.rb    |  6 ++---
 lib/sisu/v6/html.rb   |  1 +
 lib/sisu/v6/sysenv.rb | 23 +++++++++++-----
 8 files changed, 148 insertions(+), 58 deletions(-)

(limited to 'lib')

diff --git a/lib/sisu/v5/conf.rb b/lib/sisu/v5/conf.rb
index 1365a90e..b13b4bb1 100644
--- a/lib/sisu/v5/conf.rb
+++ b/lib/sisu/v5/conf.rb
@@ -86,46 +86,81 @@ module SiSU_Initialize
     def initialize(opt)
       @opt=opt
       @env=SiSU_Env::InfoEnv.new(@opt.fns)
-      @suffix,@path={},{}
-      @suffix[:rnc]='rnc'
-      @suffix[:rng]='rng'
-      @suffix[:xsd]='xsd'
-      @path[:xml]= @env.path.output + '/_sisu/xml'
-      @path[:xsd]= @env.path.output + '/_sisu/xml/xsd'
-      @path[:rnc]= @env.path.output + '/_sisu/xml/rnc'
-      @path[:rng]= @env.path.output + '/_sisu/xml/rng'
+      @suffix={
+        rnc: 'rnc',
+        rng: 'rng',
+        xsd: 'xsd',
+      }
+      @path={
+        xml: @env.path.output + '/_sisu/xml',
+        xsd: @env.path.output + '/_sisu/xml/xsd',
+        rnc: @env.path.output + '/_sisu/xml/rnc',
+        rng: @env.path.output + '/_sisu/xml/rng',
+        style: @env.path.output + '/' + @env.path.style,
+      }
       @pwd,@home=Dir.pwd,@env.path.home
     end
     def make_homepage
-      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Make homepage','').colorize unless @opt.act[:quiet][:set]==:on
+      SiSU_Screen::Ansi.new(
+        @opt.act[:color_state][:set],
+        'invert',
+        'Make homepage',
+        ''
+      ).colorize unless @opt.act[:quiet][:set]==:on
       SiSU_Env::CreateSite.new(@opt.cmd).homepage
     end
     def cp_local_images
-      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Copy images','').colorize unless @opt.act[:quiet][:set]==:on
+      SiSU_Screen::Ansi.new(
+        @opt.act[:color_state][:set],
+        'invert',
+        'Copy images',
+        ''
+      ).colorize unless @opt.act[:quiet][:set]==:on
       SiSU_Env::CreateSite.new(@opt.cmd).cp_local_images
       SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images_local #this should not have been necessary
       SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images #base images (nav etc.) used by all html
     end
     def cp_external_images
-      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Copy external images','').colorize if @opt.act[:verbose_plus][:set]==:on
+      SiSU_Screen::Ansi.new(
+        @opt.act[:color_state][:set],
+        'invert',
+        'Copy external images',
+        ''
+      ).colorize if @opt.act[:verbose_plus][:set]==:on
       SiSU_Env::CreateSite.new(@opt.cmd).cp_external_images
     end
     def cp_webserver_images
-      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Copy webserver/output file images','').colorize unless @opt.act[:quiet][:set]==:on
+      SiSU_Screen::Ansi.new(
+        @opt.act[:color_state][:set],
+        'invert',
+        'Copy webserver/output file images',
+        ''
+      ).colorize unless @opt.act[:quiet][:set]==:on
       SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images
     end
     def css
-      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Configuring CSSs','').colorize unless @opt.act[:quiet][:set]==:on
+      SiSU_Screen::Ansi.new(
+        @opt.act[:color_state][:set],
+        'invert',
+        'Configuring CSSs',
+        ''
+      ).colorize unless @opt.act[:quiet][:set]==:on
       SiSU_Env::CreateSite.new(@opt.cmd).cp_css
     end
     def dtd
-      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Configuring DTDs','').colorize unless @opt.act[:quiet][:set]==:on
+      SiSU_Screen::Ansi.new(
+        @opt.act[:color_state][:set],
+        'invert',
+        'Configuring DTDs',
+        ''
+      ).colorize unless @opt.act[:quiet][:set]==:on
       @rxng=SiSU_Relaxng::RelaxNG.new
-      @path.each { |d| FileUtils::mkdir_p(d[1]) unless FileTest.directory?(d[1]) }
+      @path.each { |d| FileUtils::mkdir_p(d[1]) \
+      unless FileTest.directory?(d[1]) }
       #ugly code, sort later
       if @rxng.methods.join =~/[^_]dtd_sax\b/
         if @rxng.dtd_sax.length > 200
-          dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.output_sax}",'w')
+          dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_sax}",'w')
           dtd << @rxng.dtd_sax
           dtd.close
         else trang_rnc_model_output_sax
@@ -134,7 +169,7 @@ module SiSU_Initialize
       end
       if @rxng.methods.join =~/[^_]dtd_dom\b/
         if @rxng.dtd_dom.length > 200
-          dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.output_dom}",'w')
+          dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_dom}",'w')
           dtd << @rxng.dtd_dom
           dtd.close
         else trang_rnc_model_output_dom
@@ -143,7 +178,7 @@ module SiSU_Initialize
       end
       if @rxng.methods.join =~/[^_]dtd_node\b/
         if @rxng.dtd_node.length > 200
-          dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.input_node}",'w')
+          dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.input_node}",'w')
           dtd << @rxng.dtd_node
           dtd.close
         else trang_rnc_model_input_node
@@ -152,7 +187,7 @@ module SiSU_Initialize
       end
       if @rxng.methods.join =~/[^_]dtd_xhtml\b/
         if @rxng.dtd_xhtml.length > 200
-          dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.output_xhtml}",'w')
+          dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_xhtml}",'w')
           dtd << @rxng.dtd_xhtml
           dtd.close
         else trang_rnc_model_output_xhtml
diff --git a/lib/sisu/v5/css.rb b/lib/sisu/v5/css.rb
index 50e80f5b..d9b2aa8c 100644
--- a/lib/sisu/v5/css.rb
+++ b/lib/sisu/v5/css.rb
@@ -1255,7 +1255,7 @@ WOK
   }
 
   li {
-    background: url(../image/bullet_09.png) no-repeat 0px 6px;
+    background: url(../image_sys/bullet_09.png) no-repeat 0px 6px;
   }
 
   ul {
@@ -1280,7 +1280,7 @@ WOK
     text-align: left;
   }
   li.doc {
-    background: url(../image/bullet_09.png) no-repeat 0px 6px;
+    background: url(../image_sys/bullet_09.png) no-repeat 0px 6px;
     padding-left: 16px;
     margin-left: 10px;
     margin-right: 0px;
@@ -1292,7 +1292,7 @@ WOK
     color: #777777;
   }
   li.refcenter {
-    background: url(../image/bullet_09.png) no-repeat 0px 6px;
+    background: url(../image_sys/bullet_09.png) no-repeat 0px 6px;
     padding-left: 20px;
     margin-left: 10%;
     font-size: 9px;
diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb
index 4a911d2c..d1ee22e5 100644
--- a/lib/sisu/v5/html.rb
+++ b/lib/sisu/v5/html.rb
@@ -90,6 +90,7 @@ module SiSU_HTML
         songsheet
       ensure
         SiSU_Env::CreateSite.new(@opt.cmd).cp_css
+        SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images
       end
     end
     def songsheet
diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb
index 13aba203..bca188d3 100644
--- a/lib/sisu/v5/sysenv.rb
+++ b/lib/sisu/v5/sysenv.rb
@@ -7128,8 +7128,13 @@ WOK
       end
     end
     def cp_css
-      FileUtils::mkdir_p("#{@env.path.output}/#{@env.path.style}") unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}")
-      css_path=['/etc/sisu/css',"#{@home}/.sisu/css","#{@pwd}/_sisu/css"] #BROKEN
+      FileUtils::mkdir_p("#{@env.path.output}/#{@env.path.style}") \
+        unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}")
+      css_path=[
+        '/etc/sisu/css',
+        "#{@home}/.sisu/css",
+        "#{@pwd}/_sisu/css",
+      ] #BROKEN
       if defined? @rc['permission_set']['css_modify'] \
       and @rc['permission_set']['css_modify']
         SiSU_Screen::Ansi.new(@cmd,"*WARN* modify is css set to: #{@rc['permission_set']['css_modify']}").warn if @cmd=~/[MV]/
@@ -7146,7 +7151,11 @@ WOK
             FileUtils::cd(@pwd)
           end
         end
-      else SiSU_Screen::Ansi.new(@cmd,"*WARN* modify css is not set or is set to: false").warn if @cmd=~/[MV]/
+      else
+        SiSU_Screen::Ansi.new(
+          @cmd,
+          "*WARN* modify css is not set or is set to: false"
+        ).warn if @cmd=~/[MV]/
       end
       fn_css=SiSU_Env::CSS_Default.new
       css=SiSU_Style::CSS.new
@@ -7178,28 +7187,28 @@ WOK
       end
       if @cmd =~/C/ \
       or (@cmd =~/[x]/ \
-        and not FileTest.file?("#{path_style}/#{fn_css.xml_sax}"))
+      and not FileTest.file?("#{path_style}/#{fn_css.xml_sax}"))
         style=File.new("#{path_style}/#{fn_css.xml_sax}",'w')
         style << css.xml_sax
         style.close
       end
       if @cmd =~/C/ \
       or (@cmd =~/[X]/ \
-        and not FileTest.file?("#{path_style}/#{fn_css.xml_dom}"))
+      and not FileTest.file?("#{path_style}/#{fn_css.xml_dom}"))
         style=File.new("#{path_style}/#{fn_css.xml_dom}",'w')
         style << css.xml_dom
         style.close
       end
       if @cmd =~/C/ \
       or (@cmd =~/[xX]/ \
-        and not FileTest.file?("#{path_style}/#{fn_css.xml_docbook}"))
+      and not FileTest.file?("#{path_style}/#{fn_css.xml_docbook}"))
         style=File.new("#{path_style}/#{fn_css.xml_docbook}",'w')
         style << css.xml_docbook
         style.close
       end
       if @cmd =~/C/ \
       or (@cmd =~/[b]/ \
-        and not FileTest.file?("#{path_style}/#{fn_css.xhtml}"))
+      and not FileTest.file?("#{path_style}/#{fn_css.xhtml}"))
         style=File.new("#{path_style}/#{fn_css.xhtml}",'w')
         style << css.xhtml
         style.close
diff --git a/lib/sisu/v6/conf.rb b/lib/sisu/v6/conf.rb
index c2333191..8795d8d3 100644
--- a/lib/sisu/v6/conf.rb
+++ b/lib/sisu/v6/conf.rb
@@ -86,46 +86,81 @@ module SiSU_Initialize
     def initialize(opt)
       @opt=opt
       @env=SiSU_Env::InfoEnv.new(@opt.fns)
-      @suffix,@path={},{}
-      @suffix[:rnc]='rnc'
-      @suffix[:rng]='rng'
-      @suffix[:xsd]='xsd'
-      @path[:xml]= @env.path.output + '/_sisu/xml'
-      @path[:xsd]= @env.path.output + '/_sisu/xml/xsd'
-      @path[:rnc]= @env.path.output + '/_sisu/xml/rnc'
-      @path[:rng]= @env.path.output + '/_sisu/xml/rng'
+      @suffix={
+        rnc: 'rnc',
+        rng: 'rng',
+        xsd: 'xsd',
+      }
+      @path={
+        xml: @env.path.output + '/_sisu/xml',
+        xsd: @env.path.output + '/_sisu/xml/xsd',
+        rnc: @env.path.output + '/_sisu/xml/rnc',
+        rng: @env.path.output + '/_sisu/xml/rng',
+        style: @env.path.output + '/' + @env.path.style,
+      }
       @pwd,@home=Dir.pwd,@env.path.home
     end
     def make_homepage
-      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Make homepage','').colorize unless @opt.act[:quiet][:set]==:on
+      SiSU_Screen::Ansi.new(
+        @opt.act[:color_state][:set],
+        'invert',
+        'Make homepage',
+        ''
+      ).colorize unless @opt.act[:quiet][:set]==:on
       SiSU_Env::CreateSite.new(@opt.cmd).homepage
     end
     def cp_local_images
-      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Copy images','').colorize unless @opt.act[:quiet][:set]==:on
+      SiSU_Screen::Ansi.new(
+        @opt.act[:color_state][:set],
+        'invert',
+        'Copy images',
+        ''
+      ).colorize unless @opt.act[:quiet][:set]==:on
       SiSU_Env::CreateSite.new(@opt.cmd).cp_local_images
       SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images_local #this should not have been necessary
       SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images #base images (nav etc.) used by all html
     end
     def cp_external_images
-      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Copy external images','').colorize if @opt.act[:verbose_plus][:set]==:on
+      SiSU_Screen::Ansi.new(
+        @opt.act[:color_state][:set],
+        'invert',
+        'Copy external images',
+        ''
+      ).colorize if @opt.act[:verbose_plus][:set]==:on
       SiSU_Env::CreateSite.new(@opt.cmd).cp_external_images
     end
     def cp_webserver_images
-      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Copy webserver/output file images','').colorize unless @opt.act[:quiet][:set]==:on
+      SiSU_Screen::Ansi.new(
+        @opt.act[:color_state][:set],
+        'invert',
+        'Copy webserver/output file images',
+        ''
+      ).colorize unless @opt.act[:quiet][:set]==:on
       SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images
     end
     def css
-      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Configuring CSSs','').colorize unless @opt.act[:quiet][:set]==:on
+      SiSU_Screen::Ansi.new(
+        @opt.act[:color_state][:set],
+        'invert',
+        'Configuring CSSs',
+        ''
+      ).colorize unless @opt.act[:quiet][:set]==:on
       SiSU_Env::CreateSite.new(@opt.cmd).cp_css
     end
     def dtd
-      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Configuring DTDs','').colorize unless @opt.act[:quiet][:set]==:on
+      SiSU_Screen::Ansi.new(
+        @opt.act[:color_state][:set],
+        'invert',
+        'Configuring DTDs',
+        ''
+      ).colorize unless @opt.act[:quiet][:set]==:on
       @rxng=SiSU_Relaxng::RelaxNG.new
-      @path.each { |d| FileUtils::mkdir_p(d[1]) unless FileTest.directory?(d[1]) }
+      @path.each { |d| FileUtils::mkdir_p(d[1]) \
+      unless FileTest.directory?(d[1]) }
       #ugly code, sort later
       if @rxng.methods.join =~/[^_]dtd_sax\b/
         if @rxng.dtd_sax.length > 200
-          dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.output_sax}",'w')
+          dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_sax}",'w')
           dtd << @rxng.dtd_sax
           dtd.close
         else trang_rnc_model_output_sax
@@ -134,7 +169,7 @@ module SiSU_Initialize
       end
       if @rxng.methods.join =~/[^_]dtd_dom\b/
         if @rxng.dtd_dom.length > 200
-          dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.output_dom}",'w')
+          dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_dom}",'w')
           dtd << @rxng.dtd_dom
           dtd.close
         else trang_rnc_model_output_dom
@@ -143,7 +178,7 @@ module SiSU_Initialize
       end
       if @rxng.methods.join =~/[^_]dtd_node\b/
         if @rxng.dtd_node.length > 200
-          dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.input_node}",'w')
+          dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.input_node}",'w')
           dtd << @rxng.dtd_node
           dtd.close
         else trang_rnc_model_input_node
@@ -152,7 +187,7 @@ module SiSU_Initialize
       end
       if @rxng.methods.join =~/[^_]dtd_xhtml\b/
         if @rxng.dtd_xhtml.length > 200
-          dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.output_xhtml}",'w')
+          dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_xhtml}",'w')
           dtd << @rxng.dtd_xhtml
           dtd.close
         else trang_rnc_model_output_xhtml
diff --git a/lib/sisu/v6/css.rb b/lib/sisu/v6/css.rb
index d4363306..b59458ee 100644
--- a/lib/sisu/v6/css.rb
+++ b/lib/sisu/v6/css.rb
@@ -1255,7 +1255,7 @@ WOK
   }
 
   li {
-    background: url(../image/bullet_09.png) no-repeat 0px 6px;
+    background: url(../image_sys/bullet_09.png) no-repeat 0px 6px;
   }
 
   ul {
@@ -1280,7 +1280,7 @@ WOK
     text-align: left;
   }
   li.doc {
-    background: url(../image/bullet_09.png) no-repeat 0px 6px;
+    background: url(../image_sys/bullet_09.png) no-repeat 0px 6px;
     padding-left: 16px;
     margin-left: 10px;
     margin-right: 0px;
@@ -1292,7 +1292,7 @@ WOK
     color: #777777;
   }
   li.refcenter {
-    background: url(../image/bullet_09.png) no-repeat 0px 6px;
+    background: url(../image_sys/bullet_09.png) no-repeat 0px 6px;
     padding-left: 20px;
     margin-left: 10%;
     font-size: 9px;
diff --git a/lib/sisu/v6/html.rb b/lib/sisu/v6/html.rb
index 8c9869e2..82d096f2 100644
--- a/lib/sisu/v6/html.rb
+++ b/lib/sisu/v6/html.rb
@@ -90,6 +90,7 @@ module SiSU_HTML
         songsheet
       ensure
         SiSU_Env::CreateSite.new(@opt.cmd).cp_css
+        SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images
       end
     end
     def songsheet
diff --git a/lib/sisu/v6/sysenv.rb b/lib/sisu/v6/sysenv.rb
index 0a1df86e..902cedfb 100644
--- a/lib/sisu/v6/sysenv.rb
+++ b/lib/sisu/v6/sysenv.rb
@@ -7128,8 +7128,13 @@ WOK
       end
     end
     def cp_css
-      FileUtils::mkdir_p("#{@env.path.output}/#{@env.path.style}") unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}")
-      css_path=['/etc/sisu/css',"#{@home}/.sisu/css","#{@pwd}/_sisu/css"] #BROKEN
+      FileUtils::mkdir_p("#{@env.path.output}/#{@env.path.style}") \
+        unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}")
+      css_path=[
+        '/etc/sisu/css',
+        "#{@home}/.sisu/css",
+        "#{@pwd}/_sisu/css",
+      ] #BROKEN
       if defined? @rc['permission_set']['css_modify'] \
       and @rc['permission_set']['css_modify']
         SiSU_Screen::Ansi.new(@cmd,"*WARN* modify is css set to: #{@rc['permission_set']['css_modify']}").warn if @cmd=~/[MV]/
@@ -7146,7 +7151,11 @@ WOK
             FileUtils::cd(@pwd)
           end
         end
-      else SiSU_Screen::Ansi.new(@cmd,"*WARN* modify css is not set or is set to: false").warn if @cmd=~/[MV]/
+      else
+        SiSU_Screen::Ansi.new(
+          @cmd,
+          "*WARN* modify css is not set or is set to: false"
+        ).warn if @cmd=~/[MV]/
       end
       fn_css=SiSU_Env::CSS_Default.new
       css=SiSU_Style::CSS.new
@@ -7178,28 +7187,28 @@ WOK
       end
       if @cmd =~/C/ \
       or (@cmd =~/[x]/ \
-        and not FileTest.file?("#{path_style}/#{fn_css.xml_sax}"))
+      and not FileTest.file?("#{path_style}/#{fn_css.xml_sax}"))
         style=File.new("#{path_style}/#{fn_css.xml_sax}",'w')
         style << css.xml_sax
         style.close
       end
       if @cmd =~/C/ \
       or (@cmd =~/[X]/ \
-        and not FileTest.file?("#{path_style}/#{fn_css.xml_dom}"))
+      and not FileTest.file?("#{path_style}/#{fn_css.xml_dom}"))
         style=File.new("#{path_style}/#{fn_css.xml_dom}",'w')
         style << css.xml_dom
         style.close
       end
       if @cmd =~/C/ \
       or (@cmd =~/[xX]/ \
-        and not FileTest.file?("#{path_style}/#{fn_css.xml_docbook}"))
+      and not FileTest.file?("#{path_style}/#{fn_css.xml_docbook}"))
         style=File.new("#{path_style}/#{fn_css.xml_docbook}",'w')
         style << css.xml_docbook
         style.close
       end
       if @cmd =~/C/ \
       or (@cmd =~/[b]/ \
-        and not FileTest.file?("#{path_style}/#{fn_css.xhtml}"))
+      and not FileTest.file?("#{path_style}/#{fn_css.xhtml}"))
         style=File.new("#{path_style}/#{fn_css.xhtml}",'w')
         style << css.xhtml
         style.close
-- 
cgit v1.2.3