diff options
| author | Ralph Amissah <ralph@amissah.com> | 2013-02-03 22:16:52 -0500 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2013-02-04 00:09:39 -0500 | 
| commit | 9f278652ce86604c11d8c2b51c7ed255e7e1d1f6 (patch) | |
| tree | f6b5fb00291f1ecca0262192af65308ec9b93f14 | |
| parent | v4 (v3): css (html & epub) line spacing reduced, paragraph spacing increased (diff) | |
v4: html (urls), scroll & seg optionally discrete, individually callable
* --html (both), --html-scroll, --html-seg
* [possibly of interest where only one form of html of interest for use &/or to
  cut generation time (roughly to 63% for --html-scroll only)]
| -rw-r--r-- | data/doc/sisu/CHANGELOG_v4 | 5 | ||||
| -rw-r--r-- | lib/sisu/v4/html.rb | 106 | ||||
| -rw-r--r-- | lib/sisu/v4/hub.rb | 45 | ||||
| -rw-r--r-- | lib/sisu/v4/options.rb | 24 | ||||
| -rw-r--r-- | lib/sisu/v4/urls.rb | 12 | 
5 files changed, 134 insertions, 58 deletions
| diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4 index a7a17f78..fd19e2d6 100644 --- a/data/doc/sisu/CHANGELOG_v4 +++ b/data/doc/sisu/CHANGELOG_v4 @@ -24,6 +24,11 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.0.5.orig.tar.xz    sisu_4.0.5.orig.tar.xz    sisu_4.0.5-1.dsc +* v4: html (urls), scroll & seg optionally discrete, individually callable +  * --html (both), --html-scroll, --html-seg +  * [possibly of interest where only one form of html of interest for use &/or +     to cut generation time (roughly to 63% for --html-scroll only)] +  * v4: sysenv, on --redirect, stop creation of redundant dir  * v4: html, includes book index fix, rest cosmetic diff --git a/lib/sisu/v4/html.rb b/lib/sisu/v4/html.rb index 9233a5f2..9e6ec0fa 100644 --- a/lib/sisu/v4/html.rb +++ b/lib/sisu/v4/html.rb @@ -101,16 +101,22 @@ module SiSU_HTML          data=nil          tuned_file_array=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions          data=tuned_file_array -        scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll +        if @opt.act[:html_scroll][:set]==:on  +          scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll +        end          toc=SiSU_HTML::Source::Toc.new(@md,data).songsheet          links_guide=SiSU_HTML::Source::LinksGuide.new(data,@md).toc          data=tuned_file_array          scr_toc=SiSU_HTML::Source::ScrollHeadAndSegToc.new(@md,toc,links_guide).in_common #watch -        SiSU_HTML::Source::Seg.new(@md,data).songsheet +        if @opt.act[:html_seg][:set]==:on  +          SiSU_HTML::Source::Seg.new(@md,data).songsheet +        end          data=tuned_file_array -        scr=SiSU_HTML::Source::Scroll.new(@md,data,scr_endnotes).songsheet -        scroll=SiSU_HTML::Source::ScrollOutput.new(scr_toc,scr[:body],scr[:metadata],scr[:owner_details],scr[:tails],@md).publish -        SiSU_HTML::Source::Output.new(scroll,@md).scroll +        if @opt.act[:html_scroll][:set]==:on  +          scr=SiSU_HTML::Source::Scroll.new(@md,data,scr_endnotes).songsheet +          scroll=SiSU_HTML::Source::ScrollOutput.new(scr_toc,scr[:body],scr[:metadata],scr[:owner_details],scr[:tails],@md).publish +          SiSU_HTML::Source::Output.new(scroll,@md).scroll +        end        rescue          SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do            __LINE__.to_s + ':' + __FILE__ @@ -589,7 +595,9 @@ WOK          ads=SiSU_HTML_Promo::Ad.new(@md)          @segtoc << format_head_toc.seg_navigation_tail << ads.div.close << ads.display << format_head_toc.html_close          @segtoc=@segtoc.flatten.compact #watch -        SiSU_HTML::Source::Output.new(@segtoc,@md).segtoc +        if @md.opt.act[:html_seg][:set]==:on  +          SiSU_HTML::Source::Output.new(@segtoc,@md).segtoc +        end          @segtoc=[]          @toc[:scr],@toc[:seg]=[],[]          toc_shared @@ -618,54 +626,58 @@ WOK          @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure        end        def scroll -        begin -          @filename_html_scroll=@file.write_file.html_scroll -          @data.each do |para| -            para=para.strip. -              gsub(/<:.+?>/,''). -              gsub(Xx[:html_relative2],@file.path_rel_links.html_scroll_2). -              gsub(Xx[:html_relative1],@file.path_rel_links.html_scroll_1). -             #gsub(/#{Xx[:html_relative]}/,@file.path_rel_links.html_scroll). -              gsub(/#{Rx[:mx_fa_clean]}/,'') -            unless para =~/\A\s*\Z/ -              @filename_html_scroll.puts para,"\n" +        if @md.opt.act[:html_scroll][:set]==:on  +          begin +            @filename_html_scroll=@file.write_file.html_scroll +            @data.each do |para| +              para=para.strip. +                gsub(/<:.+?>/,''). +                gsub(Xx[:html_relative2],@file.path_rel_links.html_scroll_2). +                gsub(Xx[:html_relative1],@file.path_rel_links.html_scroll_1). +               #gsub(/#{Xx[:html_relative]}/,@file.path_rel_links.html_scroll). +                gsub(/#{Rx[:mx_fa_clean]}/,'') +              unless para =~/\A\s*\Z/ +                @filename_html_scroll.puts para,"\n" +              end              end +          rescue +            SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do +              __LINE__.to_s + ':' + __FILE__ +            end +          ensure +            @filename_html_scroll.close            end -        rescue -          SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do -            __LINE__.to_s + ':' + __FILE__ -          end -        ensure -          @filename_html_scroll.close          end        end        def segtoc -        begin -          @filename_html_segtoc=@file.write_file.html_segtoc -          @data.each do |para| -            para=para.strip. -              gsub(/<!.+?!>/,''). -              gsub(Xx[:html_relative2],@file.path_rel_links.html_seg_2). -              gsub(Xx[:html_relative1],@file.path_rel_links.html_seg_1) -            unless para =~/\A\s*\Z/ -              @filename_html_segtoc.puts para,"\n" +        if @md.opt.act[:html_seg][:set]==:on  +          begin +            @filename_html_segtoc=@file.write_file.html_segtoc +            @data.each do |para| +              para=para.strip. +                gsub(/<!.+?!>/,''). +                gsub(Xx[:html_relative2],@file.path_rel_links.html_seg_2). +                gsub(Xx[:html_relative1],@file.path_rel_links.html_seg_1) +              unless para =~/\A\s*\Z/ +                @filename_html_segtoc.puts para,"\n" +              end              end +          rescue +            SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do +              __LINE__.to_s + ':' + __FILE__ +            end +          ensure +            @filename_html_segtoc.close +            pwd_set=Dir.pwd +            idx_lnk=(@o_str.dump_or_redirect?) \ +            ? @file.base_filename.manifest +            : @file.base_filename.html_segtoc +            mlnk=@file.base_filename.html_seg_index +            Dir.chdir(@file.output_path.html_seg.dir) +            FileUtils::rm_f(mlnk) +            FileUtils::ln_s(idx_lnk,mlnk) +            Dir.chdir(pwd_set)            end -        rescue -          SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do -            __LINE__.to_s + ':' + __FILE__ -          end -        ensure -          @filename_html_segtoc.close -          pwd_set=Dir.pwd -          idx_lnk=(@o_str.dump_or_redirect?) \ -          ? @file.base_filename.manifest -          : @file.base_filename.html_segtoc -          mlnk=@file.base_filename.html_seg_index -          Dir.chdir(@file.output_path.html_seg.dir) -          FileUtils::rm_f(mlnk) -          FileUtils::ln_s(idx_lnk,mlnk) -          Dir.chdir(pwd_set)          end        end      end diff --git a/lib/sisu/v4/hub.rb b/lib/sisu/v4/hub.rb index a7b1a05a..2cfcee57 100644 --- a/lib/sisu/v4/hub.rb +++ b/lib/sisu/v4/hub.rb @@ -303,6 +303,15 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on          if @opt.act[:html][:set]==:on                  #% --html, -h            require_relative 'html'                      # -h -H  html.rb            SiSU_HTML::Source.new(@opt).read +        else +          if @opt.act[:html_seg][:set]==:on            #% --html-seg +            require_relative 'html'                    # -h -H  html.rb +            SiSU_HTML::Source.new(@opt).read +          end +          if @opt.act[:html_scroll][:set]==:on         #% --html-scroll +            require_relative 'html'                    # -h -H  html.rb +            SiSU_HTML::Source.new(@opt).read +          end          end          if @opt.act[:concordance][:set]==:on           #% --concordance, -w            require_relative 'concordance'               # -w     concordance.rb @@ -628,10 +637,38 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on          SiSU_Harvest::Source.new(@opt).read            # -h -H  html.rb        elsif @opt.mod.inspect =~/--convert|--to|--from/          require_relative 'sst_convert_markup'          # sst_convert_markup.rb -      elsif @opt.cmd =~/([abCcDdeFGgHhIjikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \ -      and @opt.cmd =~/^-/ \ -      and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \ -      or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ +      elsif @opt.act[:dal][:set]==:on \ +      or @opt.act[:manpage][:set]==:on \ +      or @opt.act[:texinfo][:set]==:on \ +      or @opt.act[:txt][:set]==:on \ +      or @opt.act[:html][:set]==:on \ +      or @opt.act[:html_scroll][:set]==:on \ +      or @opt.act[:html_seg][:set]==:on \ +      or @opt.act[:concordance][:set]==:on \ +      or @opt.act[:xhtml][:set]==:on \ +      or @opt.act[:epub][:set]==:on \ +      or @opt.act[:odt][:set]==:on \ +      or @opt.act[:xml_sax][:set]==:on \ +      or @opt.act[:xml_dom][:set]==:on \ +      or @opt.act[:pdf][:set]==:on \ +      or @opt.act[:psql][:set]==:on \ +      or @opt.act[:sqlite][:set]==:on \ +      or @opt.act[:sqlite_discreet][:set]==:on \ +      or @opt.act[:share_source][:set]==:on \ +      or @opt.act[:sisupod][:set]==:on \ +      or @opt.act[:qrcode][:set]==:on \ +      or @opt.act[:hash_digests][:set]==:on \ +      or @opt.act[:manifest][:set]==:on \ +      or @opt.act[:rsync][:set]==:on \ +      or @opt.act[:scp][:set]==:on \ +      or @opt.act[:webrick][:set]==:on \ +      or @opt.act[:zap][:set]==:on \ +      or (  +        @opt.cmd =~/^-/ \ +        and @opt.cmd =~/([abCcDdeFGgHhIjikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \ +        and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \ +        or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ \ +      )          do_initialization          do_loops          @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil unless @opt.act[:quiet][:set] ==:on diff --git a/lib/sisu/v4/options.rb b/lib/sisu/v4/options.rb index e26fcfc2..fbdfc8f3 100644 --- a/lib/sisu/v4/options.rb +++ b/lib/sisu/v4/options.rb @@ -471,6 +471,8 @@ module SiSU_Commandline            when /^--(?:dal?|machine|abstraction|abs)$/;       c=c+'m'            when /^--(?:txt|text|plaintext)$/;                 c=c+'t'            when /^--(?:html)$/;                               c=c+'h' +          when /^--(?:html-scroll|html-seg)$/;               c=c+'H' +            mod << m            when /^--(?:epub)$/;                               c=c+'e'            when /^--(?:od[ft])$/;                             c=c+'o'            when /^--(?:pdf)$/;                                c=c+'p' @@ -757,10 +759,24 @@ module SiSU_Commandline          || mod.inspect =~/"--dal"/) \          ? { bool: true, set: :on }          : { bool: false, set: :na } -        act[:html]=(cmd =~/h/ \ -        || mod.inspect =~/"--html"/) \ -        ? { bool: true, set: :on } -        : { bool: false, set: :na } +        act[:html]=if (cmd =~/h/ \ +        || mod.inspect =~/"--html"/) +          act[:html_scroll]={ bool: true, set: :on } +          act[:html_seg]={ bool: true, set: :on } +          { bool: true, set: :on } +        else +          act[:html_scroll]=if mod.inspect =~/"--html-scroll"/ +            { bool: true, set: :on } +          else +            { bool: false, set: :na } +          end +          act[:html_seg]=if mod.inspect =~/"--html-seg"/ +            { bool: true, set: :on } +          else +            { bool: false, set: :na } +          end +          { bool: false, set: :na } +        end          act[:concordance]=(cmd =~/w/ \          || mod.inspect =~/"--concordance"/) \          ? { bool: true, set: :on } diff --git a/lib/sisu/v4/urls.rb b/lib/sisu/v4/urls.rb index a9a27bff..5e6bcc8a 100644 --- a/lib/sisu/v4/urls.rb +++ b/lib/sisu/v4/urls.rb @@ -316,11 +316,17 @@ module SiSU_Urls                  show.epub(x)                end                if x=~/--html\b/ \ -              and @opt.act[:html][:set]==:on +              and (@opt.act[:html][:set]==:on \ +              or @opt.act[:html_scroll][:set]==:on \ +              or @opt.act[:html_seg][:set]==:on)                  if x =~/scroll/ -                  show.html.scroll(x) +                  if @opt.act[:html_scroll][:set]==:on  +                    show.html.scroll(x) +                  end                  else -                  show.html.toc(x) +                  if @opt.act[:html_seg][:set]==:on  +                    show.html.toc(x) +                  end                  end                end                if x=~/--texinfo\b/ \ | 
