From 4e4ce5d362db3e88d41d371645bf998cdead1fbf Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 4 Jul 2009 08:46:20 -0400 Subject: html various minor: use suffix provided in constants; module SiSU_HTML_Tune; html promo html promo, possibility of use of adsense, or other --- lib/sisu/v0/html.rb | 33 +++++++++------------------------ lib/sisu/v0/html_format.rb | 31 +++++++++++++++---------------- lib/sisu/v0/html_minitoc.rb | 12 ++++++------ lib/sisu/v0/html_promo.rb | 21 +++++++++++++++++++++ lib/sisu/v0/html_segments.rb | 20 ++++++++------------ lib/sisu/v0/html_tune.rb | 4 ++-- 6 files changed, 61 insertions(+), 60 deletions(-) diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index 5cf8e8d4..39775832 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -71,7 +71,7 @@ module SiSU_HTML require "#{SiSU_lib}/html_promo" include SiSU_HTML_promo require "#{SiSU_lib}/html_tune" - include SiSU_Tune + include SiSU_HTML_Tune require "#{SiSU_lib}/shared_xml" require "#{SiSU_lib}/shared_structure" class Source @@ -152,27 +152,12 @@ module SiSU_HTML end def tuned_file_instructions @tell=SiSU_Screen::Ansi.new(@md.cmd) - if @md - #@md.sfx='' - @md.sfx='' if @md.cmd =~/z/ - if @md.cmd =~/h/ \ - or @md.fns =~/\~[a-z]{2,3}\.s?/ #multilingual document protection is a bit arbitrary, (needed by existing server configuration), add configuration overide... - if @md.cmd =~/H/ \ - and @md.fns =~/\~[a-z]{2,3}\.s?/ - SiSU_Screen::Ansi.new(@md.cmd, - 'multilingual document, creating internal url links with filetype suffix', - "\n\t\t(overriding -H request, using -h mode instead)" - ).warn unless @md.cmd =~/q/ - end - @md.sfx='.html' - end - end @md.cmd=@md.cmd.gsub(/H/,'h') @md.file_type='html' if @md.cmd =~/[hon]/ directories newfilename=%{#{@env.path.output}/#{@md.fnb}/#{@md.fn[:index]}} if @md.file_type =~/html/ dal_array=@particulars.dal_array # dal file drawn here - @tuned_file_array=SiSU_Tune::Tune.new(dal_array,@md).songsheet + @tuned_file_array=SiSU_HTML_Tune::Tune.new(dal_array,@md).songsheet @tuned_file_array end end @@ -353,7 +338,7 @@ WOK title=unless para =~/Document Information/; linkname else link='metadata' - %{#{linkname}} + %{#{linkname}} end toc={} txt_obj={:txt =>title} @@ -456,7 +441,7 @@ WOK para.gsub!(/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'') if para =~/^#{Mx[:lv_o]}4:/ seg_link=para.gsub(/^\s*#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}\s*(.+?)$/, - %{ + %{ \\2 }) if seg_link =~/(#{Mx[:id_o]}\~\d+;(?:\w|[0-6]:\d+);\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/m @@ -466,7 +451,7 @@ WOK @@seg_url=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}.+?$/,1] elsif para =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/ seg_link=para.gsub(/^\s*(#{@md.lv4}\s+)\s*(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, - %{\\1 \\2 \\3 }) end p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn @@ -504,7 +489,7 @@ WOK para.gsub!(m,'') title=linkname else - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } txt_obj={:txt =>lnk_n_txt} @@ -535,7 +520,7 @@ WOK para.gsub!(m,'') title=linkname else - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } txt_obj={:txt =>lnk_n_txt} @@ -593,11 +578,11 @@ WOK toc_shared << format_head_toc.scroll_head_navigation_band if @md.rights rights=format_head_toc.rights - rights=SiSU_Tune::Clean_html.new(rights).clean + rights=SiSU_HTML_Tune::Clean_html.new(rights).clean end if @md.prefix_b prefix_b=format_head_toc.prefix_b - prefix_b=SiSU_Tune::Clean_html.new(prefix_b).clean + prefix_b=SiSU_HTML_Tune::Clean_html.new(prefix_b).clean end @seg_toc_band=format_head_toc.seg_head_navigation_band('pdf') #bug, vary depending on type of doc !! examine @seg_toc_band_bottom=format_head_toc.seg_head_navigation_band_bottom('pdf') #bug, vary depending on type of doc !! examine diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index 7f2fab67..eb29f9f9 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -97,10 +97,9 @@ module SiSU_HTML_Format end class Head_information include SiSU_Viz - attr_reader :md,:sfx,:pdf,:rdf,:vz + attr_reader :md,:pdf,:rdf,:vz def initialize(md) @md=md - @sfx,@pdf=@md.sfx,@md.pdf @rdf=SiSU_XML_tags::RDF.new(md) # DublinCore 1 - title @vz=SiSU_Env::Get_init.instance.skin @@ -276,7 +275,7 @@ WOK if type=~/pdf/ @tocband_segtoc=make_scroll_seg_pdf end - firstseg=%{ + firstseg=%{ #{@vz.png_nav_nxt} } if @md.firstseg =~/\S+/ %{ @@ -295,7 +294,7 @@ WOK if type=~/pdf/ @tocband_segtoc=make_scroll_seg_pdf end - firstseg=%{ + firstseg=%{ #{@vz.png_nav_nxt} } if @md.firstseg =~/\S+/ %{
@@ -638,17 +637,17 @@ WOK def dot_control_pre_next %{
- + #{@vz.png_nav_dot_pre} - + #{@vz.png_nav_dot_toc} - + #{@vz.png_nav_dot_nxt} #{@vz.table_close}} @@ -656,12 +655,12 @@ WOK def dot_control_pre %{ @@ -674,17 +673,17 @@ WOK def toc_nav(f_pre=false,f_nxt=false,use=1) pre=nxt='' toc=%{} pre=%{} if f_pre==true nxt=%{} if f_nxt==true @@ -793,7 +792,7 @@ WOK %{
- + #{@vz.png_nav_dot_pre} - + #{@vz.png_nav_dot_toc} - + #{@vz.png_nav_toc} - + #{@vz.png_nav_pre} - + #{@vz.png_nav_nxt}
- + #{@md.ad_alt}

@@ -805,7 +804,7 @@ WOK %{

- + #{@md.ad_alt}

@@ -817,7 +816,7 @@ WOK %{

- + #{@md.ad_alt}

@@ -1260,7 +1259,7 @@ WOK fn='doc' if fn.empty? #you may wish to reconsider, sends to 'doc' where no segment info %{

- #{@endnote_part_a}#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}#{@endnote_part_b} + #{@endnote_part_a}#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}#{@endnote_part_b}

} end diff --git a/lib/sisu/v0/html_minitoc.rb b/lib/sisu/v0/html_minitoc.rb index 2f95326a..62054db0 100644 --- a/lib/sisu/v0/html_minitoc.rb +++ b/lib/sisu/v0/html_minitoc.rb @@ -59,7 +59,7 @@ =end module SiSU_HTML_minitoc require "#{SiSU_lib}/html_tune" - include SiSU_Tune + include SiSU_HTML_Tune class Toc_mini @@seg_mini=nil @@seg_url='' @@ -119,7 +119,7 @@ title=unless txt =~/Document Information/; linkname else link='metadata' - %{#{linkname}} + %{#{linkname}} end toc={} txt_obj={:txt =>title} @@ -162,7 +162,7 @@ txt.gsub!(/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'') if txt =~/^#{Mx[:lv_o]}4:/ seg_link=txt.gsub(/^\s*#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}\s*(.+?)$/, - %{ + %{ \\2 }) if seg_link =~/(#{Mx[:id_o]}\~\d+;(?:\w|[0-6]:\d+);\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/m @@ -172,7 +172,7 @@ @@seg_url=txt[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}.+?$/,1] elsif txt =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/ seg_link=txt.gsub(/^\s*(#{@md.lv4}\s+)\s*(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, - %{\\1 \\2 \\3 }) end txt_obj={:txt =>seg_link} @@ -198,7 +198,7 @@ txt.gsub!(m,'') title=linkname else - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } txt_obj={:txt =>lnk_n_txt} @@ -224,7 +224,7 @@ txt.gsub!(m,'') title=linkname else - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } txt_obj={:txt =>lnk_n_txt} diff --git a/lib/sisu/v0/html_promo.rb b/lib/sisu/v0/html_promo.rb index eefc2e72..d4c1f4c0 100644 --- a/lib/sisu/v0/html_promo.rb +++ b/lib/sisu/v0/html_promo.rb @@ -244,6 +244,21 @@ module SiSU_HTML_promo end %{

Price:#{gbp}#{euro}#{usd}

} end + def adsense #draw content from a configuration file + def column_right + if defined? @ad[:promo]['ad']['adsense']['column_right'] + @ad[:promo]['ad']['adsense']['column_right'].join("\n") + else '' + end + end + def line_single + if defined? @ad[:promo]['ad']['adsense']['line_single'] + @ad[:promo]['ad']['adsense']['line_single'].join("\n") + else '' + end + end + self + end def site_link #Work area if url_link.url < 0 + adverts << @ad[:promo][category][type][id].join("\n") + end end end end diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index a2d4f849..d874063a 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -102,7 +102,7 @@ module SiSU_HTML_seg class Seg @@seg,@@seg_subtoc,@@seg_endnotes,@@seg_ad={},{},{},{} @@seg_name,@@seg_name_html=[],[] - @@seg_url=@@fn=@@to_lev4=@@get_hash_to=@@get_hash_fn='' + @@seg_url=@@fn=@@get_hash_to=@@get_hash_fn='' @@loop_count=@@seg_total=@@tracker=0 @@is4=@@is3=@@is2=@@is1=0 @@header1=@@header2=@@header3=@@header4=0 @@ -137,9 +137,6 @@ module SiSU_HTML_seg track,tracking,newfile=0,0,0 @@is4=@@is3=@@is2=@@is1=0 printed_endnote_seg='n' - @h_sfx='.php' if @md.file_type =~/php/ - @h_sfx=@md.sfx if @md.file_type =~/html/ - @h_sfx='.html' if @md.file_type =~/html/ #used in creating file, not to be omitted. idx_html=nil if @md.book_idx my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns) @@ -196,7 +193,7 @@ module SiSU_HTML_seg if tracking != 0 mkdir_p(@md.dir_out) unless FileTest.directory?(@md.dir_out) #bug - added specifically for nav! not needed by regular seg, check !!! Seg.new('',@md).tail - segfilename="#{@md.dir_out}/#{@md.fnl[:pre]}#{@@seg_name_html[tracking-1]}#{@md.fnl[:mid]}#@h_sfx#{@md.fnl[:post]}" + segfilename="#{@md.dir_out}/#{@md.fnl[:pre]}#{@@seg_name_html[tracking-1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" @output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1] if @@seg_name_html[tracking-1] !~/endnotes|idx/ Seg_output.new(@md,@output_seg_file,@@seg,@minitoc).output @@ -210,10 +207,10 @@ module SiSU_HTML_seg header_art(para) head(para) if @@seg_name_html[tracking] =~/metadata/ # this is for metadata - segfilename="#{@md.dir_out}/#{@md.fnl[:pre]}#{@@seg_name_html[tracking]}#{@md.fnl[:mid]}#@h_sfx#{@md.fnl[:post]}" + segfilename="#{@md.dir_out}/#{@md.fnl[:pre]}#{@@seg_name_html[tracking]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" @output_seg_file=File.new(segfilename,'w') Seg.new.reinitialise #BUG with items following endnote, and occurring before metadata, this becomes a bug ... work area for book index, FIX - flagend="x" + flagend='x' @output_seg_file.close #%(((( EOF )))) --> end end @@ -269,7 +266,7 @@ module SiSU_HTML_seg @author=%{#{@md.author}\n} if @md.author.to_s =~/\S/ @@seg[:tocband_banner] << format_head_seg.navigation_band(@@segtocband,@@seg[:dot_nav]) conditional_div_close=if @@get_hash_fn =~/metadata/ #watch - '' + '' else '' end @@seg[:tocband_bannerless] << conditional_div_close << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) @@ -398,7 +395,7 @@ module SiSU_HTML_seg else @sto=nil end if @md.flag_separate_endnotes - para.gsub!(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{@md.sfx}#_\\1">}) #endnote- twice #removed file type + para.gsub!(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">}) #endnote- twice #removed file type end if para !~/#{@vz.margin_txt_w1}|#{@vz.margin_txt_w2}/ if para[/(.*)#{Mx[:id_o]}~0;(?:u|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/] #% watch u & m? @@ -467,11 +464,11 @@ module SiSU_HTML_seg if para !~/^#{Mx[:lv_o]}4:metadata#{Mx[:lv_c]}/ m=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}.+?#{Mx[:id_o]}~(\d+);(?:[oh]|4:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/] end - if m; @@fn,@@to_lev4=$1,$2 if m # changed 2004w07 #endnotes and sub-tocs + if m; @@fn=$1 if m # changed 2004w07 #endnotes and sub-tocs else if para !~/^#{Mx[:lv_o]}4:metadata#{Mx[:lv_c]}/ m=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/] - @@fn,@@to_lev4=$1,'nonum' if m # changed 2005w13 + @@fn=$1 if m # changed 2005w13 else @@fn='' end end @@ -525,7 +522,6 @@ module SiSU_HTML_seg endnote_part_a=note_match_seg[m,1] endnote_part_b=note_match_seg[m,2] txt_obj={:endnote_part_a =>endnote_part_a,:endnote_part_b =>endnote_part_b} - format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) note_match_all_seg=format_seg.endnote_seg_body(@@fn) #BUG WATCH 200408 @@seg[:endnote_all] << note_match_all_seg diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb index 333824ce..682a734a 100644 --- a/lib/sisu/v0/html_tune.rb +++ b/lib/sisu/v0/html_tune.rb @@ -57,7 +57,7 @@ =end require "#{SiSU_lib}/param" -module SiSU_Tune +module SiSU_HTML_Tune require "#{SiSU_lib}/sysenv" require "#{SiSU_lib}/html_format" #watch include SiSU_Env @@ -245,7 +245,7 @@ module SiSU_Tune para.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') para.gsub!(/#{Mx[:nbsp]}/,' ') para.gsub!(/<(p|br)>/,'<\1 />') - para=SiSU_Tune::Clean_html.new(para).clean + para=SiSU_HTML_Tune::Clean_html.new(para).clean @tuned_file << para end end -- cgit v1.2.3