From f0776648316c5f54e27bcd5b4c8ee50b57e6489c Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Sun, 24 Oct 2010 16:34:22 -0400
Subject: html segments, title banner (including "copy @" mark) configurable,
 boolean

* true/false (config.yml commented out, default false)

(requested off option, Daniel Baumann)
---
 CHANGELOG_v2                 | 11 +++++++++--
 conf/sisu/v2/sisurc.yml      |  2 ++
 data/doc/sisu/v2/CHANGELOG   | 11 +++++++++--
 lib/sisu/v2/html_segments.rb | 22 +++++++++++++++++-----
 lib/sisu/v2/sysenv.rb        |  6 ++++++
 5 files changed, 43 insertions(+), 9 deletions(-)

diff --git a/CHANGELOG_v2 b/CHANGELOG_v2
index cf9e4a53..7183188e 100644
--- a/CHANGELOG_v2
+++ b/CHANGELOG_v2
@@ -29,8 +29,15 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.8.orig.tar.gz
     * epub, remove space between link & following punctuation, parentheses &/or
       square brackets
 
-  * html, remove "copy @" mark
-    (requested, Daniel Baumann)
+  * html
+    * remove "copy @" mark
+      (requested, Daniel Baumann)
+    * segments, title banner (including "copy @" mark) configurable, boolean,
+      true/false (default false)
+      (requested off option, Daniel Baumann)
+
+  * config.yml
+    * html, seg title banner boolean setting true/false (commented out)
 
 %% 2.7.7.orig.tar.gz (2010-10-17:41/7)
 http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.7.orig.tar.gz
diff --git a/conf/sisu/v2/sisurc.yml b/conf/sisu/v2/sisurc.yml
index cb57891d..77edf2d2 100644
--- a/conf/sisu/v2/sisurc.yml
+++ b/conf/sisu/v2/sisurc.yml
@@ -87,6 +87,8 @@ default:
 #  sqlite:
 #    path:       ~ # './sisu_sqlite.db'
 #    port:       "**"
+#html:
+#  seg_title_banner:  true #default false
 #% possible values ~, true, false, or command instruction e.g. editor: 'gvim -c :R -c :S'.
 #will only ignore if value set to false, absence or nil will not remove program as should operate without rc file
 #ie in case of ~ will ignore and use hard coded defaults within program), true, false, or command instruction e.g. editor: 'gvim -c :R -c :S'
diff --git a/data/doc/sisu/v2/CHANGELOG b/data/doc/sisu/v2/CHANGELOG
index 695da997..0da3a0ec 100644
--- a/data/doc/sisu/v2/CHANGELOG
+++ b/data/doc/sisu/v2/CHANGELOG
@@ -29,8 +29,15 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.8.orig.tar.gz
     * epub, remove space between link & following punctuation, parentheses &/or
       square brackets
 
-  * html, remove "copy @" mark
-    (requested, Daniel Baumann)
+  * html
+    * remove "copy @" mark
+      (requested, Daniel Baumann)
+    * segments, title banner (including "copy @" mark) configurable, boolean,
+      true/false (default false)
+      (requested off option, Daniel Baumann)
+
+  * config.yml
+    * html, seg title banner boolean setting true/false (commented out)
 
 %% 2.7.7.orig.tar.gz (2010-10-17:41/7)
 http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.7.orig.tar.gz
diff --git a/lib/sisu/v2/html_segments.rb b/lib/sisu/v2/html_segments.rb
index 33e56402..a516d809 100644
--- a/lib/sisu/v2/html_segments.rb
+++ b/lib/sisu/v2/html_segments.rb
@@ -64,6 +64,7 @@ module SiSU_HTML_seg
   class Seg_output
     def initialize(md,outputfile,seg,minitoc,type='')
       @md,@output_seg_file,@seg,@minitoc,@type=md,outputfile,seg,minitoc,type
+      @title_banner_=SiSU_Env::Create_site.new(@md.cmd).html_seg_title_banner?
     end
     def output
       if @seg[:title] =~/\S/
@@ -72,7 +73,9 @@ module SiSU_HTML_seg
         if @type=='endnotes'
           @seg[:headings]=[]
           format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
-          @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author)
+          if @title_banner_
+            @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author)
+          end
           txt_obj={:txt =>'Endnotes',:ocn_display =>''}
           format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
           @seg[:headings] << format_seg.title_heading1
@@ -80,7 +83,9 @@ module SiSU_HTML_seg
         elsif @type=='idx'
           @seg[:headings]=[]
           format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
-          @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author)
+          if @title_banner_
+            @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author)
+          end
           txt_obj={:txt =>'Index',:ocn_display =>''}
           format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
           @seg[:headings] << format_seg.title_heading1
@@ -89,7 +94,9 @@ module SiSU_HTML_seg
           metadata=Metadata::Summary.new(@md).xhtml_display.metadata
           @seg[:headings]=[]
           format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
-          @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author)
+          if @title_banner_
+            @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author)
+          end
           txt_obj={:txt =>'Metadata',:ocn_display =>''}
           format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
           @seg[:headings] << format_seg.title_heading1
@@ -122,11 +129,14 @@ module SiSU_HTML_seg
     @@dp,@@segtocband=nil,nil
     @@fns_previous=''
     attr_reader :seg_name_html,:seg_name_html_tracker
-    def initialize(md='',data='')
+    def initialize(md=nil,data='')
       @md,@data=md,data
       @vz=SiSU_Env::Get_init.instance.skin
       @seg_name_html=@@seg_name_html || nil
       @seg_name_html_tracker=@@tracker || nil
+      if @md
+        @title_banner_=SiSU_Env::Create_site.new(@md.cmd).html_seg_title_banner?
+      end
     end
     def songsheet
       begin
@@ -299,7 +309,9 @@ module SiSU_HTML_seg
         end
         @@seg[:tocband_bannerless] << '<br />' << conditional_div_close << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav])
         @@seg[:headings] << format_head_seg.seg_head_escript if SiSU_HTML_Format::Head_seg.method_defined? :seg_head_escript #debug PHP move up in text #bug
-        @@seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author).gsub(clean,'')
+        if @title_banner_
+          @@seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author).gsub(clean,'')
+        end
         ocn=if @@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
         else ''
         end
diff --git a/lib/sisu/v2/sysenv.rb b/lib/sisu/v2/sysenv.rb
index 395559a8..f61b1fcd 100644
--- a/lib/sisu/v2/sysenv.rb
+++ b/lib/sisu/v2/sysenv.rb
@@ -3260,6 +3260,12 @@ WOK
         filename_homepage_toc << @vz_home.homepage
       end
     end
+    def html_seg_title_banner?
+      ((defined? @rc['html']['seg_title_banner']) \
+      && @rc['html']['seg_title_banner']==true) \
+      ? @rc['html']['seg_title_banner'] \
+      : false
+    end
     def cp_images(src_path,dest_path)
       if FileTest.directory?(src_path)
         cd(src_path)
-- 
cgit v1.2.3