From ed1a104164b53dba74a2220ae99fea52ae8ff77e Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Sun, 24 Oct 2010 16:48:44 -0400
Subject: html, quick ref links_guide configurable, boolean

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

(requested off option, Daniel Baumann)
---
 CHANGELOG_v2               |  7 ++++++-
 conf/sisu/v2/sisurc.yml    |  1 +
 data/doc/sisu/v2/CHANGELOG |  7 ++++++-
 lib/sisu/v2/html.rb        | 36 ++++++++++++++++++++----------------
 lib/sisu/v2/html_format.rb |  4 ++--
 lib/sisu/v2/sysenv.rb      |  6 ++++++
 6 files changed, 41 insertions(+), 20 deletions(-)

diff --git a/CHANGELOG_v2 b/CHANGELOG_v2
index 7183188e..6f3d41a3 100644
--- a/CHANGELOG_v2
+++ b/CHANGELOG_v2
@@ -35,9 +35,14 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.8.orig.tar.gz
     * segments, title banner (including "copy @" mark) configurable, boolean,
       true/false (default false)
       (requested off option, Daniel Baumann)
+    * quick ref links_guide configurable, boolean, true/false (default false)
+      (requested off option, Daniel Baumann)
 
   * config.yml
-    * html, seg title banner boolean setting true/false (commented out)
+    * html, seg title banner, boolean true/false setting (commented out,
+      default false)
+    * html, quick_ref, boolean true/false setting (commented out, default
+      false)
 
 %% 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 77edf2d2..982274d1 100644
--- a/conf/sisu/v2/sisurc.yml
+++ b/conf/sisu/v2/sisurc.yml
@@ -88,6 +88,7 @@ default:
 #    path:       ~ # './sisu_sqlite.db'
 #    port:       "**"
 #html:
+#  quick_ref:         true #default false
 #  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
diff --git a/data/doc/sisu/v2/CHANGELOG b/data/doc/sisu/v2/CHANGELOG
index 0da3a0ec..f16818e2 100644
--- a/data/doc/sisu/v2/CHANGELOG
+++ b/data/doc/sisu/v2/CHANGELOG
@@ -35,9 +35,14 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.8.orig.tar.gz
     * segments, title banner (including "copy @" mark) configurable, boolean,
       true/false (default false)
       (requested off option, Daniel Baumann)
+    * quick ref links_guide configurable, boolean, true/false (default false)
+      (requested off option, Daniel Baumann)
 
   * config.yml
-    * html, seg title banner boolean setting true/false (commented out)
+    * html, seg title banner, boolean true/false setting (commented out,
+      default false)
+    * html, quick_ref, boolean true/false setting (commented out, default
+      false)
 
 %% 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.rb b/lib/sisu/v2/html.rb
index 04406e48..c984a858 100644
--- a/lib/sisu/v2/html.rb
+++ b/lib/sisu/v2/html.rb
@@ -162,29 +162,33 @@ module SiSU_HTML
       @links_guide_toc=[]
       def initialize(data,md)
         @data,@md=data,md
+        @links_guide_=SiSU_Env::Create_site.new(@md.cmd).html_quick_ref?
       end
       def toc
         @links_guide_toc=[]
-        format_head_toc=SiSU_HTML_Format::Head_toc.new(@md)
-        guide_type='horzontal' #values: horizontal or vertical
-        @links_guide_toc << format_head_toc.links_guide_open(guide_type)
-        if defined? @md.lnk \
-        and @md.lnk
-          @md.lnk.each do |l|
-            if defined? l[:say]
-              target=if l[:url] !~/^\.(\.)?\//; 'external'
-              else                              '_top'
+        if @links_guide_
+          format_head_toc=SiSU_HTML_Format::Head_toc.new(@md)
+          guide_type='horzontal' #values: horizontal or vertical
+          @links_guide_toc << format_head_toc.links_guide_open(guide_type)
+          if defined? @md.lnk \
+          and @md.lnk
+            @md.lnk.each do |l|
+              if defined? l[:say]
+                target=if l[:url] !~/^\.(\.)?\//; 'external'
+                else                              '_top'
+                end
+                s_lnk_url,s_lnk_lnk=l[:url],l[:say]
+                txt_obj={:lnk_url =>s_lnk_url,:lnk_txt =>s_lnk_lnk,:target =>target}
+                lev_dob_ocn=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
+                @links_guide_toc << lev_dob_ocn.links_guide if s_lnk_lnk
               end
-              s_lnk_url,s_lnk_lnk=l[:url],l[:say]
-              txt_obj={:lnk_url =>s_lnk_url,:lnk_txt =>s_lnk_lnk,:target =>target}
-              lev_dob_ocn=SiSU_HTML_Format::Format_toc.new(@md,txt_obj)
-              @links_guide_toc << lev_dob_ocn.links_guide if s_lnk_lnk
             end
           end
+          format_head_toc=SiSU_HTML_Format::Head_toc.new(@md)
+          @links_guide_toc << format_head_toc.links_guide_close #(guide_type)
+          @links_guide_toc
+        else ''
         end
-        format_head_toc=SiSU_HTML_Format::Head_toc.new(@md)
-        @links_guide_toc << format_head_toc.links_guide_close #(guide_type)
-        @links_guide_toc
       end
     end
     class Endnotes
diff --git a/lib/sisu/v2/html_format.rb b/lib/sisu/v2/html_format.rb
index 358fa293..c4758c5f 100644
--- a/lib/sisu/v2/html_format.rb
+++ b/lib/sisu/v2/html_format.rb
@@ -418,7 +418,7 @@ WOK
 #{@vz.table_close}}
       end
     end
-    def links_guide_vertical_open #???
+    def links_guide_vertical_open
       url=((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/ ? @vz.url_hp : @vz.url_home)
       %{
 <div id="vertical_links">
@@ -438,7 +438,7 @@ WOK
   </li>
 <!- quick ref -!>}
     end
-    def links_guide_horizontal_open #???
+    def links_guide_horizontal_open
       url=((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/ ? @vz.url_hp : @vz.url_home)
       %{
 <div id="horizontal_links">
diff --git a/lib/sisu/v2/sysenv.rb b/lib/sisu/v2/sysenv.rb
index f61b1fcd..ed955006 100644
--- a/lib/sisu/v2/sysenv.rb
+++ b/lib/sisu/v2/sysenv.rb
@@ -3266,6 +3266,12 @@ WOK
       ? @rc['html']['seg_title_banner'] \
       : false
     end
+    def html_quick_ref?
+      ((defined? @rc['html']['quick_ref']) \
+      && @rc['html']['quick_ref']==true) \
+      ? @rc['html']['quick_ref'] \
+      : false
+    end
     def cp_images(src_path,dest_path)
       if FileTest.directory?(src_path)
         cd(src_path)
-- 
cgit v1.2.3