diff options
Diffstat (limited to 'lib/sisu/v4')
-rw-r--r-- | lib/sisu/v4/css.rb | 10 | ||||
-rw-r--r-- | lib/sisu/v4/epub_format.rb | 10 | ||||
-rw-r--r-- | lib/sisu/v4/html.rb | 114 | ||||
-rw-r--r-- | lib/sisu/v4/html_scroll.rb | 14 | ||||
-rw-r--r-- | lib/sisu/v4/hub.rb | 45 | ||||
-rw-r--r-- | lib/sisu/v4/options.rb | 24 | ||||
-rw-r--r-- | lib/sisu/v4/sysenv.rb | 3 | ||||
-rw-r--r-- | lib/sisu/v4/urls.rb | 12 |
8 files changed, 152 insertions, 80 deletions
diff --git a/lib/sisu/v4/css.rb b/lib/sisu/v4/css.rb index b1d47fce..ca526010 100644 --- a/lib/sisu/v4/css.rb +++ b/lib/sisu/v4/css.rb @@ -428,10 +428,10 @@ WOK } .norm, .bold, .verse, .group, .block, .alt { - line-height: 150%; + line-height: 133%; margin-left: 0em; margin-right: 2em; - margin-top: 10px; + margin-top: 12px; margin-bottom: 0px; padding-left: 0em; text-indent: 0em; @@ -441,13 +441,13 @@ WOK font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; font-size: 100%; font-weight: normal; - line-height: 150%; + line-height: 133%; text-align: justify; margin-left: 0em; margin-right: 2em; text-indent: 0mm; - margin-top: 3px; - margin-bottom: 3px; + margin-top: 4px; + margin-bottom: 4px; } /* indent */ diff --git a/lib/sisu/v4/epub_format.rb b/lib/sisu/v4/epub_format.rb index d8baae63..7be18331 100644 --- a/lib/sisu/v4/epub_format.rb +++ b/lib/sisu/v4/epub_format.rb @@ -151,10 +151,10 @@ module SiSU_EPUB_Format } .norm, .bold, .verse, .group, .block, .alt { - line-height: 150%; + line-height: 133%; margin-left: 0em; margin-right: 2em; - margin-top: 10px; + margin-top: 12px; margin-bottom: 0px; padding-left: 0em; text-indent: 0mm; @@ -164,13 +164,13 @@ module SiSU_EPUB_Format font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; font-size: 100%; font-weight: normal; - line-height: 150%; + line-height: 133%; text-align: justify; margin-left: 0em; margin-right: 2em; text-indent: 0mm; - margin-top: 3px; - margin-bottom: 3px; + margin-top: 4px; + margin-bottom: 4px; } p.norm { } p.i1 {padding-left: 1em;} diff --git a/lib/sisu/v4/html.rb b/lib/sisu/v4/html.rb index 57ac79c1..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__ @@ -541,14 +547,16 @@ WOK toc_shared << format_head_toc.scroll_head_title_banner_open @segtoc << format_head_toc.seg_head_title_banner_open tmp_head=nil - doc_title_endnote=@md.title.full.gsub(/(\*+)/,'<sup><a href="#endnotes">\1</a></sup>') + doc_title_endnote=@md.title.full.gsub(/(\*+)/, + '<sup><a href="#endnotes">\1</a></sup>') tmp_head=doc_title_endnote + "\n" txt_obj={ txt: tmp_head } format_txt_obj=SiSU_HTML_Format::FormatTextObject.new(@md,txt_obj) toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold if defined? @md.creator.author - creator_endnote=@md.creator.author.gsub(/(\*+)/,%{ <sup><a href="#notes">\\1</a></sup>}) + creator_endnote=@md.creator.author.gsub(/(\*+)/, + %{ <sup><a href="#notes">\\1</a></sup>}) tmp_head=creator_endnote + "\n" txt_obj={ txt: tmp_head } format_txt_obj=SiSU_HTML_Format::FormatTextObject.new(@md,txt_obj) @@ -587,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 @@ -616,56 +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=if @o_str.dump_or_redirect? - @file.base_filename.manifest - else - @file.base_filename.html_segtoc - end - 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/html_scroll.rb b/lib/sisu/v4/html_scroll.rb index f8d104bb..a8d84c9d 100644 --- a/lib/sisu/v4/html_scroll.rb +++ b/lib/sisu/v4/html_scroll.rb @@ -86,7 +86,8 @@ module SiSU_HTML_Scroll dob.obj=dob.obj.gsub(/#{@md.file.output_path.html_seg.rel_image}/m,@md.file.output_path.html_scroll.rel_image) if defined? dob.name and dob.name =~/^meta/ \ and dob.obj =~/Document Information/ - dob.obj=dob.obj.gsub(/(Document Information(?: \(metadata\))?)/,'\1<a name="docinfo"></a>') + dob.obj=dob.obj.gsub(/(Document Information(?: \(metadata\))?)/, + '\1<a name="docinfo"></a>') end if dob.obj =~/^Metadata$/ \ and dob.lv =='B' @@ -152,7 +153,8 @@ module SiSU_HTML_Scroll sto.heading_body4 book_idx=SiSU_Particulars::CombinedSingleton.instance.get_idx_html(@md.opt).html_idx book_idx.each do |x| #takes book index prepared for segments & strips segment identifying info - x=x.gsub(/<a href="\S+?\.html#(\d+)">(\1(?:-\d+)?)<\/a>/,'<a href="#\1">\2</a>') + x.gsub!(/<a href="\S+?\.html#(\d+)">(\1(?:-\d+)?)<\/a>/, + '<a href="#\1">\2</a>') end book_idx.join("\n") elsif dob.ln==5 @@ -170,11 +172,9 @@ module SiSU_HTML_Scroll and dob.indent =~/[0-9]/ \ and dob.hang =~/[0-9]/ if dob.bullet_ - if dob.indent =~/[1-9]/ - sto.format('li',"i#{dob.indent}") - else - sto.format('li','bullet') - end + (dob.indent =~/[1-9]/) \ + ? sto.format('li',"i#{dob.indent}") + : sto.format('li','bullet') elsif dob.indent == dob.hang sto.format('p',"i#{dob.indent}") elsif dob.indent != dob.hang 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/sysenv.rb b/lib/sisu/v4/sysenv.rb index 2b36a222..d8b6f4fd 100644 --- a/lib/sisu/v4/sysenv.rb +++ b/lib/sisu/v4/sysenv.rb @@ -4208,7 +4208,8 @@ WOK end def html_segtoc pth=((by_filename?) \ - || (output_dir_structure.dump?)) \ + || (output_dir_structure.dump?) \ + || (output_dir_structure.redirect?)) \ ? "#{output_path.html.dir}" : "#{output_path.html.dir}/#{@md.fnb}" fn=base_filename.html_segtoc 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/ \ |