From e1ec4bd2dad2bd22ad97cea398ae1cfcfae183a2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 15 Oct 2007 19:27:16 +0100 Subject: mostly the arrangement of conditionals --- lib/sisu/v0/html.rb | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) (limited to 'lib/sisu/v0/html.rb') diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index c875614d..930fdb36 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -152,8 +152,10 @@ module SiSU_HTML 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?/ + 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)" @@ -232,7 +234,8 @@ module SiSU_HTML format_head_toc=SiSU_HTML_Format_type::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 + if defined? @md.lnk \ + and @md.lnk @md.lnk.each do |l| if defined? l[:say] target=if l[:url] !~/^\.(\.)?\//; 'external' @@ -262,7 +265,8 @@ module SiSU_HTML @data.each do |para| pg=para.dup unless pg =~/^<:code>/ - if pg =~/~[{\[][\d*+]+ / + if pg =~/~[{\[][\d*+]+ / endnote_array=[] if pg=~/~\{[\d*+].+?\}\~/m endnote_array << pg.scan(/~\{[\d*+]+(.+?)\}\~/m) @@ -313,7 +317,8 @@ module SiSU_HTML when /^\s*4~!/; Toc.new(para_toc).level_crosslink else end - if @@firstseg.nil? and para=~/^4~\S+?/ + if @@firstseg.nil? \ + and para=~/^4~\S+?/ @@firstseg=/^4~(\S+)?/.match(para)[1] end if toc @@ -372,7 +377,10 @@ WOK end para[@pat_heading] linkname,link=$1,$2 if $& - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) if link and link !~/#/ #% keep eye on link + if link \ + and link !~/#/ #% keep eye on link + p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) + end title=unless para =~/Document Information/; linkname else link='metadata' @@ -412,7 +420,10 @@ WOK end para[@pat_heading] linkname,link=$1,$2 if $& - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) if link and link !~/#/ + if link \ + and link !~/#/ + p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) + end format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,linkname) toc={} toc[:seg]=format_toc.lev2 @@ -432,7 +443,10 @@ WOK para.gsub(/(.*?)<\/a>(.*)/,'\1') #2002w42 altered gsub! - problematic? - suspect para[@pat_heading] linkname,link=$1,$2 if $& - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) if link and link !~/#/ + if link \ + and link !~/#/ + p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) + end format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,linkname) toc={} toc[:seg]=format_toc.lev3 @@ -489,7 +503,10 @@ WOK end para[@pat_heading] linkname,link=$1,$2 if $& - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) if link and link !~/#/ + if link \ + and link !~/#/ + p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) + end toc={} if para =~/<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ m=/#{$1}/ @@ -514,7 +531,10 @@ WOK end para[@pat_heading] linkname,link=$1,$2 if $& - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) if link and link !~/#/ + if link \ + and link !~/#/ + p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) + end toc={} if para =~/<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ m=/#{$1}/ @@ -593,7 +613,8 @@ WOK format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,tmp_head) toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold - if not @md.subtitle.nil? and not @md.subtitle.empty? + if not @md.subtitle.nil? \ + and not @md.subtitle.empty? tmp_head=@md.subtitle + "\n" format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,tmp_head) toc_shared << format_txt_obj.center_bold -- cgit v1.2.3