diff options
91 files changed, 668 insertions, 890 deletions
diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4 index bf4fd392..a024d2b9 100644 --- a/data/doc/sisu/CHANGELOG_v4 +++ b/data/doc/sisu/CHANGELOG_v4 @@ -23,6 +23,17 @@ v2 branch is removed; it is available in sisu =< 3.3.2 %% Reverse Chronological: +%% 4.1.5.orig.tar.xz (2013-06-22:24/6) +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.1.5 +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.1.5-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_4.1.5.orig.tar.xz + sisu_4.1.5.orig.tar.xz + sisu_4.1.5-1.dsc + +* vim + * colorscheme def, mark current line + * ftplugin sisu.vim, c-\ hard wrap lines to line width (moved from c-j) + %% 4.1.4.orig.tar.xz (2013-06-06:22/4) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.1.4 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.1.4-1 diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 463de70e..0c32c06e 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -23,6 +23,19 @@ v2 branch is removed; it is available in sisu =< 3.3.2 %% Reverse Chronological: +%% 5.0.5.orig.tar.xz (2013-06-22:24/6) +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.5 +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.5-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.5.orig.tar.xz + sisu_5.0.5.orig.tar.xz + sisu_5.0.5-1.dsc + +* vim + * colorscheme def, mark current line + * ftplugin sisu.vim, c-\ hard wrap lines to line width (moved from c-j) + +* general code cleaning, propagate back to v4 after testing + %% 5.0.4.orig.tar.xz (2013-06-06:22/4) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.4 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.4-1 diff --git a/data/sisu/conf/editor-syntax-etc/vim/colors/def-ruby.vim b/data/sisu/conf/editor-syntax-etc/vim/colors/def-ruby.vim index f59a2b8e..5f6fef27 100644 --- a/data/sisu/conf/editor-syntax-etc/vim/colors/def-ruby.vim +++ b/data/sisu/conf/editor-syntax-etc/vim/colors/def-ruby.vim @@ -34,7 +34,7 @@ endif :hi Title ctermfg=1 :hi NonText cterm=bold ctermfg=4 :hi LineNr cterm=bold ctermbg=0 ctermfg=0* -:hi CursorLineNr cterm=bold ctermbg=17 ctermfg=0 +:hi CursorLineNr cterm=bold ctermbg=166 ctermfg=0 :hi Directory ctermfg=4 :hi WildMenu ctermbg=3 ctermfg=0 :hi VertSplit cterm=reverse @@ -93,7 +93,7 @@ endif :hi Title guifg=#CC0000 :hi NonText gui=bold guifg=#5971AD :hi LineNr gui=bold guibg=#000000 guifg=#808080 -:hi CursorLineNr gui=bold guibg=#00005F guifg=#000000 +:hi CursorLineNr gui=bold guibg=#D75F00 guifg=#000000 :hi Directory guifg=#5971AD :hi WildMenu guibg=#C4A000 guifg=#000000 :hi VertSplit gui=reverse diff --git a/data/sisu/conf/editor-syntax-etc/vim/colors/def-sisu.vim b/data/sisu/conf/editor-syntax-etc/vim/colors/def-sisu.vim index 14178dc4..9157faca 100644 --- a/data/sisu/conf/editor-syntax-etc/vim/colors/def-sisu.vim +++ b/data/sisu/conf/editor-syntax-etc/vim/colors/def-sisu.vim @@ -34,7 +34,7 @@ endif :hi Title cterm=bold ctermfg=3 :hi NonText cterm=bold ctermfg=4 :hi LineNr cterm=bold ctermbg=0 ctermfg=0* -:hi CursorLineNr cterm=bold ctermbg=17 ctermfg=0 +:hi CursorLineNr cterm=bold ctermbg=166 ctermfg=0 :hi Directory ctermfg=4 :hi WildMenu ctermbg=3 ctermfg=0 :hi VertSplit cterm=reverse @@ -93,7 +93,7 @@ endif :hi Title gui=bold guifg=#C4A000 :hi NonText gui=bold guifg=#5971AD :hi LineNr gui=bold guibg=#000000 guifg=#808080 -:hi CursorLineNr gui=bold guibg=#00005F guifg=#000000 +:hi CursorLineNr gui=bold guibg=#D75F00 guifg=#000000 :hi Directory guifg=#5971AD :hi WildMenu guibg=#C4A000 guifg=#000000 :hi VertSplit gui=reverse diff --git a/data/sisu/conf/editor-syntax-etc/vim/colors/def.vim b/data/sisu/conf/editor-syntax-etc/vim/colors/def.vim index f7d6282c..66c45ba4 100644 --- a/data/sisu/conf/editor-syntax-etc/vim/colors/def.vim +++ b/data/sisu/conf/editor-syntax-etc/vim/colors/def.vim @@ -34,7 +34,7 @@ endif :hi Title cterm=bold ctermfg=3 :hi NonText cterm=bold ctermfg=4 :hi LineNr cterm=bold ctermbg=0 ctermfg=0* -:hi CursorLineNr cterm=bold ctermbg=17 ctermfg=0 +:hi CursorLineNr cterm=bold ctermbg=166 ctermfg=0 :hi Directory ctermfg=4 :hi WildMenu ctermbg=3 ctermfg=0 :hi VertSplit cterm=reverse @@ -93,7 +93,7 @@ endif :hi Title gui=bold guifg=#C4A000 :hi NonText gui=bold guifg=#5971AD :hi LineNr gui=bold guibg=#000000 guifg=#808080 -:hi CursorLineNr gui=bold guibg=#00005F guifg=#000000 +:hi CursorLineNr gui=bold guibg=#D75F00 guifg=#000000 :hi Directory guifg=#5971AD :hi WildMenu guibg=#C4A000 guifg=#000000 :hi VertSplit gui=reverse diff --git a/data/sisu/conf/editor-syntax-etc/vim/colors/def256-ruby.vim b/data/sisu/conf/editor-syntax-etc/vim/colors/def256-ruby.vim index 09b8a3ce..5b991954 100644 --- a/data/sisu/conf/editor-syntax-etc/vim/colors/def256-ruby.vim +++ b/data/sisu/conf/editor-syntax-etc/vim/colors/def256-ruby.vim @@ -34,7 +34,7 @@ endif :hi Title ctermfg=160 :hi NonText cterm=bold ctermfg=24 :hi LineNr cterm=bold ctermbg=0 ctermfg=8 -:hi CursorLineNr cterm=bold ctermbg=17 ctermfg=0 +:hi CursorLineNr cterm=bold ctermbg=166 ctermfg=0 :hi Directory ctermfg=24 :hi WildMenu ctermbg=178 ctermfg=0 :hi VertSplit cterm=reverse @@ -93,7 +93,7 @@ endif :hi Title guifg=#CC0000 :hi NonText gui=bold guifg=#005F87 :hi LineNr gui=bold guibg=#000000 guifg=#808080 -:hi CursorLineNr gui=bold guibg=#00005F guifg=#000000 +:hi CursorLineNr gui=bold guibg=#D75F00 guifg=#000000 :hi Directory guifg=#005F87 :hi WildMenu guibg=#DFAF00 guifg=#000000 :hi VertSplit gui=reverse diff --git a/data/sisu/conf/editor-syntax-etc/vim/colors/def256-sisu.vim b/data/sisu/conf/editor-syntax-etc/vim/colors/def256-sisu.vim index d2cd7295..d2a09836 100644 --- a/data/sisu/conf/editor-syntax-etc/vim/colors/def256-sisu.vim +++ b/data/sisu/conf/editor-syntax-etc/vim/colors/def256-sisu.vim @@ -34,7 +34,7 @@ endif :hi Title cterm=bold ctermfg=178 :hi NonText cterm=bold ctermfg=24 :hi LineNr cterm=bold ctermbg=0 ctermfg=8 -:hi CursorLineNr cterm=bold ctermbg=17 ctermfg=0 +:hi CursorLineNr cterm=bold ctermbg=166 ctermfg=0 :hi Directory ctermfg=24 :hi WildMenu ctermbg=178 ctermfg=0 :hi VertSplit cterm=reverse @@ -93,7 +93,7 @@ endif :hi Title gui=bold guifg=#DFAF00 :hi NonText gui=bold guifg=#005F87 :hi LineNr gui=bold guibg=#000000 guifg=#808080 -:hi CursorLineNr gui=bold guibg=#00005F guifg=#000000 +:hi CursorLineNr gui=bold guibg=#D75F00 guifg=#000000 :hi Directory guifg=#005F87 :hi WildMenu guibg=#DFAF00 guifg=#000000 :hi VertSplit gui=reverse diff --git a/data/sisu/conf/editor-syntax-etc/vim/colors/def256.vim b/data/sisu/conf/editor-syntax-etc/vim/colors/def256.vim index 334c2b01..ca166e20 100644 --- a/data/sisu/conf/editor-syntax-etc/vim/colors/def256.vim +++ b/data/sisu/conf/editor-syntax-etc/vim/colors/def256.vim @@ -34,7 +34,7 @@ endif :hi Title cterm=bold ctermfg=178 :hi NonText cterm=bold ctermfg=24 :hi LineNr cterm=bold ctermbg=0 ctermfg=8 -:hi CursorLineNr cterm=bold ctermbg=17 ctermfg=0 +:hi CursorLineNr cterm=bold ctermbg=166 ctermfg=0 :hi Directory ctermfg=24 :hi WildMenu ctermbg=178 ctermfg=0 :hi VertSplit cterm=reverse @@ -93,7 +93,7 @@ endif :hi Title gui=bold guifg=#DFAF00 :hi NonText gui=bold guifg=#005F87 :hi LineNr gui=bold guibg=#000000 guifg=#808080 -:hi CursorLineNr gui=bold guibg=#00005F guifg=#000000 +:hi CursorLineNr gui=bold guibg=#D75F00 guifg=#000000 :hi Directory guifg=#005F87 :hi WildMenu guibg=#DFAF00 guifg=#000000 :hi VertSplit gui=reverse diff --git a/data/sisu/conf/editor-syntax-etc/vim/ftplugin/sisu.vim b/data/sisu/conf/editor-syntax-etc/vim/ftplugin/sisu.vim index 1da73012..8f704718 100644 --- a/data/sisu/conf/editor-syntax-etc/vim/ftplugin/sisu.vim +++ b/data/sisu/conf/editor-syntax-etc/vim/ftplugin/sisu.vim @@ -72,10 +72,10 @@ "% map ":let mapleader = "," " consider :map <leader>paste :set invpaste<cr> -"% wrap/formatting paragraph according to the current 'textwidth' with ^J (control-j): -:imap <C-J> <C-O>gqap -:nmap <C-J> gqap -:vmap <C-J> gq +"% wrap/formatting paragraph according to the current 'textwidth' with ^\ (control-\): +:imap <C-\> <C-O>gqap +:nmap <C-\> gqap +:vmap <C-\> gq "% save file, go to next file in buffer :map <leader>nf :w <enter> :n <enter> "% vimdiff q exits diff --git a/data/sisu/v4/v/version.yml b/data/sisu/v4/v/version.yml index a8779fb8..6941e66f 100644 --- a/data/sisu/v4/v/version.yml +++ b/data/sisu/v4/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 4.1.4 -:date_stamp: 2013w22/4 -:date: "2013-06-06" +:version: 4.1.5 +:date_stamp: 2013w24/6 +:date: "2013-06-22" :project: SiSU diff --git a/data/sisu/v5/v/version.yml b/data/sisu/v5/v/version.yml index c1f74d80..a16f5cfb 100644 --- a/data/sisu/v5/v/version.yml +++ b/data/sisu/v5/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 5.0.4 -:date_stamp: 2013w22/4 -:date: "2013-06-06" +:version: 5.0.5 +:date_stamp: 2013w24/6 +:date: "2013-06-22" :project: SiSU diff --git a/lib/sisu/v5/cgi_pgsql.rb b/lib/sisu/v5/cgi_pgsql.rb index 9ae9d191..bdb457f3 100644 --- a/lib/sisu/v5/cgi_pgsql.rb +++ b/lib/sisu/v5/cgi_pgsql.rb @@ -111,7 +111,7 @@ module SiSU_CGI_PgSQL else STDERR.puts "WARNING: no postgresql database available, (have you created one?)" end serve=serve.sort - f1,f2,f3='','','' + f1,f2='','' serve.each do |x| f1 << %{ <option value="#{Db[:name_prefix]}#{x}">#{x}</option>\n} unless x =~/apache|sisu\/image/ #check end diff --git a/lib/sisu/v5/composite.rb b/lib/sisu/v5/composite.rb index c1cfb127..452d6576 100644 --- a/lib/sisu/v5/composite.rb +++ b/lib/sisu/v5/composite.rb @@ -164,7 +164,7 @@ module SiSU_Assemble data=@fns_array tuned_file,imagedir=[],[] SiSU_Screen::Ansi.new(@opt.cmd,'Composite Document',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").grey_title_hi unless @opt.cmd =~/q/ - para=data.each do |para| + data.each do |para| if para =~/^<<\s+(\S+?\.ss[it])$/ \ or para =~/^<<\{(\S+?\.ss[it])\}$/ \ or para =~/^(?:<<\s*)\|(\S+?)\|@\|.+?\|(?:req(?:quire)?\b|\s*\})?/ \ @@ -218,7 +218,7 @@ module SiSU_Assemble begin @opt.fns=@opt.fns.gsub(/\.ssm\.sst$/,'.ssm') #FIX earlier, hub @fns_array=IO.readlines(@opt.fns,'') - files=insertions? + insertions? rescue SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do __LINE__.to_s + ':' + __FILE__ @@ -228,10 +228,10 @@ module SiSU_Assemble end def insertions? data=@fns_array - tuned_file,imagedir=[],[] + tuned_file=[] SiSU_Screen::Ansi.new(@opt.cmd,'Composite Document',@opt.fno).grey_title_hi unless @opt.cmd =~/q/ @ssm=[@opt.fns] - para=data.each do |para| + data.each do |para| if para =~/^<<\s+(\S+?\.ss[it])$/ loadfile=$1.strip SiSU_Screen::Ansi.new(@opt.cmd,'loading:',loadfile).txt_grey if @opt.cmd =~/[MVv]/ diff --git a/lib/sisu/v5/concordance.rb b/lib/sisu/v5/concordance.rb index ac148f49..f2143bb8 100644 --- a/lib/sisu/v5/concordance.rb +++ b/lib/sisu/v5/concordance.rb @@ -78,7 +78,7 @@ module SiSU_Concordance def read begin @env,@md=@particulars.env,@particulars.md - loc=@env.url.output_tell + @env.url.output_tell unless @md.opt.cmd =~/q/ tool=(@md.opt.cmd =~/[MVv]/) \ ? "#{@env.program.web_browser} #{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}" @@ -116,7 +116,6 @@ module SiSU_Concordance @particulars,@md=particulars,particulars.md @data=SiSU_HTML::Source::HTML_Environment.new(particulars).tuned_file_instructions @file=SiSU_Env::FileOp.new(@md) - txt_path=%{#{@md.dir_out}} @fnb=@md.fnb @lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="#{@file.path_rel_links.html_seg_2}_sisu/image/sisu.png" alt="SiSU home -->"></a>} @doc_details =<<WOK @@ -334,7 +333,6 @@ WOK end end end - scr='<font size="1" color="#777777" face=times new roman><img border="0" height="15" width="15" src="../_sisu/image/b_doc.png" alt="Full Text"> scroll: </font><font size="1" color="#222222" face=times new roman>doc# </font> ' seg='' head=SiSU_Concordance::Source::DocTitle.new(@particulars).create head=head.gsub(/#{Xx[:html_relative2]}/m,@file.path_rel_links.html_seg_2). @@ -360,7 +358,6 @@ WOK keyword=SiSU_Concordance::Source::Word.new(word,@freq[word]).html if keyword !~ @rxp_excluded0 if @word_map[word][0] =~ /\d+/ - wm=[] @file_concordance << %{#{keyword}#{seg}#{@word_map[word].uniq.compact.join}} end @file_concordance << '</p>' diff --git a/lib/sisu/v5/conf.rb b/lib/sisu/v5/conf.rb index 4d5b58d2..8fe2af32 100644 --- a/lib/sisu/v5/conf.rb +++ b/lib/sisu/v5/conf.rb @@ -245,7 +245,6 @@ module SiSU_Initialize end def trang_rnc_model_input_node rnc_file=@env.processing_path.dal + '/node.rnc' - rng_file=@env.processing_path.dal + '/node.rng' dtd_file=@path[:xsd] + '/' + @rxng.rng_name.input_node rnc=File.new(rnc_file,'w') rnc << @rxng.rnc_model_input_node diff --git a/lib/sisu/v5/css.rb b/lib/sisu/v5/css.rb index 4b682e5d..b6aacaa8 100644 --- a/lib/sisu/v5/css.rb +++ b/lib/sisu/v5/css.rb @@ -93,7 +93,6 @@ module SiSU_Style WOK end def css_action - style_css=SiSU_Style::CSS.new css=case @ft when 'html' css=css_embed_content.html diff --git a/lib/sisu/v5/dal.rb b/lib/sisu/v5/dal.rb index e6003b4f..ed03969f 100644 --- a/lib/sisu/v5/dal.rb +++ b/lib/sisu/v5/dal.rb @@ -117,7 +117,6 @@ module SiSU_DAL end def read #creates dal begin - dal=[] @@dal_array=[] @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \ ? @fnx diff --git a/lib/sisu/v5/dal_doc_objects.rb b/lib/sisu/v5/dal_doc_objects.rb index de9d568f..64ddbfb1 100644 --- a/lib/sisu/v5/dal_doc_objects.rb +++ b/lib/sisu/v5/dal_doc_objects.rb @@ -62,7 +62,7 @@ module SiSU_DAL_DocumentStructure class Extract def extract(h,o) - obj=h ? h : o + h ? h : o end end class ObjectMetadata @@ -106,7 +106,7 @@ module SiSU_DAL_DocumentStructure @tags=[] end def heading_ln(lv) - ln=case lv + case lv when /A/; 1 when /B/; 2 when /C/; 3 @@ -119,7 +119,7 @@ module SiSU_DAL_DocumentStructure end end def heading_lv(ln) - lv=case ln.to_s + case ln.to_s when /1/; 'A' when /2/; 'B' when /3/; 'C' diff --git a/lib/sisu/v5/dal_doc_str.rb b/lib/sisu/v5/dal_doc_str.rb index 2979412b..971f9f67 100644 --- a/lib/sisu/v5/dal_doc_str.rb +++ b/lib/sisu/v5/dal_doc_str.rb @@ -78,7 +78,7 @@ module SiSU_DAL_DocumentStructureExtract @pbl=SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line]) end def ln_get(lv) - ln=case lv + case lv when /A/; 1 when /B/; 2 when /C/; 3 @@ -91,10 +91,14 @@ module SiSU_DAL_DocumentStructureExtract end end def image_test(str) - boolean=(str=~/\{\s*\S+?\.png.+?\}https?:\/\/\S+/ ? true : false) + str=~/\{\s*\S+?\.png.+?\}https?:\/\/\S+/ \ + ? true + : false end def bullet_test(str) - bool=((str=~/\*/) ? true : false) + (str=~/\*/) \ + ? true + : false end def hang_and_indent_test(str) hang_indent=if str=~/^_([1-9])[^_]/ @@ -128,7 +132,9 @@ module SiSU_DAL_DocumentStructureExtract [hang,indent,obj] end def endnote_test?(str) - bool=((str=~/~\{.+?\}~|~\[.+?\]~/) ? true : false) + (str=~/~\{.+?\}~|~\[.+?\]~/) \ + ? true + : false end def extract_tags(str,nametag=nil) tags=[] @@ -146,7 +152,6 @@ module SiSU_DAL_DocumentStructureExtract [str,tags] end def identify_parts - data=@data tuned_file=[] @tuned_block,@tuned_code=[],[] @@counter,@verse_count=0,0 @@ -365,7 +370,6 @@ module SiSU_DAL_DocumentStructureExtract t_o=SiSU_DAL_DocumentStructure::ObjectTable.new.table(@h) tuned_file << t_o @h,@rows=nil,'' - t_o h={ obj: 'table end' } #introduce a counter t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h) t_o @@ -448,7 +452,7 @@ module SiSU_DAL_DocumentStructureExtract and t_o !~/^(?:\}(?:verse|code|alt|group|block)|(?:verse|code|alt|group|block)\{)/ # fix logic sub_array=t_o.dup @line_mode=sub_array.scan(/.+/) - type=if @@flag['poem']; 'poem' + type='poem' if @@flag['poem'] t_o=SiSU_DAL_DocumentStructureExtract::Build.new(@md,@line_mode).build_lines(type).join poem=t_o.split(/\n\n/) poem.each do |v| @@ -458,10 +462,9 @@ module SiSU_DAL_DocumentStructureExtract t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.verse(h) tuned_file << t_o end - else 'group' - end - @verse_count+=1 if @@flag['poem'] + else 'group' end + @verse_count+=1 if @@flag['poem'] end if not @@flag['code'] if @@flag['poem'] \ @@ -507,7 +510,6 @@ module SiSU_DAL_DocumentStructureExtract tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ ln: 4, obj: 'SiSU Metadata, document information', name: 'metadata', autonum_: false, ocn_: false } tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h) - tuned_file h={ obj: 'eof' } meta=SiSU_DAL_DocumentStructure::ObjectMetadata.new.metadata(@metadata) [tuned_file,meta] @@ -597,8 +599,7 @@ module SiSU_DAL_DocumentStructureExtract def ocn #and auto segment numbering increment data=@data @o_array=[] - node=ocn=ocn_dv=ocn_sp=ocnh=ocnh1=ocnh2=ocnh3=ocnh4=ocnh5=ocnh6=ocno=ocnp=ocnt=ocnc=ocng=ocni=ocnm=ocnu=ocnk=nm=0 # h heading, o other, t table, g group, i image - node_count_flag=false + node=ocn=ocn_dv=ocn_sp=ocnh=ocnh1=ocnh2=ocnh3=ocnh4=ocnh5=ocnh6=ocno=ocnp=ocnt=ocnc=ocng=ocni=ocnu=0 # h heading, o other, t table, g group, i image regex_exclude_ocn_and_node = /#{Rx[:meta]}|^@\S+?:\s|^4~endnotes|^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^\^~ |<:e[:_]\d+?>|^<:\#|<:- |<[:!]!4|<hr width|#{Mx[:br_endnotes]}|\A\s*\Z/mi #ocn here # added with Tune.code #¡ parent=node1=node2=node3=node4=node5=node6=nil data.each do |dob| diff --git a/lib/sisu/v5/dal_endnotes.rb b/lib/sisu/v5/dal_endnotes.rb index 8412b45e..407dc1ff 100644 --- a/lib/sisu/v5/dal_endnotes.rb +++ b/lib/sisu/v5/dal_endnotes.rb @@ -68,7 +68,7 @@ module SiSU_DAL_Endnotes def endnotes data=@data @tuned_file=[] - endnote_no,endnote_ref=1,1 + endnote_ref=1 data.each do |dob| # manually numbered endnotes <!e(\d)!> <!e_(\d)!> --> if @md.opt.mod.inspect =~/--no-asterisk|--no-annotate/ diff --git a/lib/sisu/v5/dal_expand_insertions.rb b/lib/sisu/v5/dal_expand_insertions.rb index 46efaa63..b29bca6b 100644 --- a/lib/sisu/v5/dal_expand_insertions.rb +++ b/lib/sisu/v5/dal_expand_insertions.rb @@ -272,82 +272,81 @@ module SiSU_DAL_Insertions if para !~/^%+\s/ \ and not codeblock_ \ and para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/ - txt,cmd,source,linked_doc,note,manifest=nil,nil,nil,nil,nil,nil + manifest=nil @u=SiSU_Env::InfoEnv.new.url - pre=txt=cmd=source=linked_doc=note='' if defined? @u.remote - if /(?<pre>.+?)\{(?<txt>.+?)\s\[(?<cmd>\d[sS]*)\]\}(?<source>(?<linked_doc>\S+?)\.ss[tm]\b)(?<note>.*)/m =~ para - pre=pre.strip - elsif /\{(?<txt>.+?)\s\[(?<cmd>\d[sS]*)\]\}(?<source>(?<linked_doc>\S+?)\.ss[tm]\b)(?<note>.*)/m =~ para + if /(?<m_pre>.+?)\{(?<m_txt>.+?)\s\[(?<m_cmd>\d[sS]*)\]\}(?<m_source>(?<m_linked_doc>\S+?)\.ss[tm]\b)(?<m_note>.*)/m =~ para + m_pre=m_pre.strip + elsif /\{(?<m_txt>.+?)\s\[(?<m_cmd>\d[sS]*)\]\}(?<m_source>(?<m_linked_doc>\S+?)\.ss[tm]\b)(?<m_note>.*)/m =~ para end - if linked_doc =~ /(\S+?)\/(\S+)/ - linked_doc,linked_doc_lang=$1,$2 + if m_linked_doc =~ /(\S+?)\/(\S+)/ + m_linked_doc,m_linked_doc_lang=$1,$2 else - linked_doc,linked_doc_lang=linked_doc,@md.opt.lng_base + m_linked_doc,m_linked_doc_lang=m_linked_doc,@md.opt.lng_base end else puts "error, does currently support relative paths (reltive paths were removed, as had problems for citation, and was not suited to all output types should possibly reconsider) #{__FILE__} #{__LINE__}" - if /\{(?:~\^\s+)?(?<txt>.+?)\s\[(?<cmd>\d[sS]*)\]\}\.\.\/(?<linked_doc>\S+?)\/(?<note>\s+#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]})?/ =~ para + if /\{(?:~\^\s+)?(?<m_txt>.+?)\s\[(?<m_cmd>\d[sS]*)\]\}\.\.\/(?<m_linked_doc>\S+?)\/(?<m_note>\s+#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]})?/ =~ para end end lnk={} case @md.opt.dir_structure_by when :language lnk={ - manifest: by_language(linked_doc,linked_doc_lang).manifest, - html_toc: by_language(linked_doc,linked_doc_lang).html_toc, - html_doc: by_language(linked_doc,linked_doc_lang).html_doc, - epub: by_language(linked_doc,linked_doc_lang).epub, - pdf_landscape: by_language(linked_doc,linked_doc_lang).pdf_landscape, - pdf_portrait: by_language(linked_doc,linked_doc_lang).pdf_landscape, - odt: by_language(linked_doc,linked_doc_lang).odt, - xhtml: by_language(linked_doc,linked_doc_lang).xhtml, - xml_sax: by_language(linked_doc,linked_doc_lang).xml_sax, - xml_dom: by_language(linked_doc,linked_doc_lang).xml_dom, - txt: by_language(linked_doc,linked_doc_lang).txt, - html_concordance: by_language(linked_doc,linked_doc_lang).html_concordance, - digest: by_language(linked_doc,linked_doc_lang).digest, - sisupod: by_language(linked_doc,linked_doc_lang,source).sisupod, - source: by_language(linked_doc,linked_doc_lang,source).source, + manifest: by_language(m_linked_doc,m_linked_doc_lang).manifest, + html_toc: by_language(m_linked_doc,m_linked_doc_lang).html_toc, + html_doc: by_language(m_linked_doc,m_linked_doc_lang).html_doc, + epub: by_language(m_linked_doc,m_linked_doc_lang).epub, + pdf_landscape: by_language(m_linked_doc,m_linked_doc_lang).pdf_landscape, + pdf_portrait: by_language(m_linked_doc,m_linked_doc_lang).pdf_landscape, + odt: by_language(m_linked_doc,m_linked_doc_lang).odt, + xhtml: by_language(m_linked_doc,m_linked_doc_lang).xhtml, + xml_sax: by_language(m_linked_doc,m_linked_doc_lang).xml_sax, + xml_dom: by_language(m_linked_doc,m_linked_doc_lang).xml_dom, + txt: by_language(m_linked_doc,m_linked_doc_lang).txt, + html_concordance: by_language(m_linked_doc,m_linked_doc_lang).html_concordance, + digest: by_language(m_linked_doc,m_linked_doc_lang).digest, + sisupod: by_language(m_linked_doc,m_linked_doc_lang,source).sisupod, + source: by_language(m_linked_doc,m_linked_doc_lang,source).source, } when :filetype lnk={ - manifest: by_filetype(linked_doc,linked_doc_lang).manifest, - html_toc: by_filetype(linked_doc,linked_doc_lang).html_toc, - html_doc: by_filetype(linked_doc,linked_doc_lang).html_doc, - epub: by_filetype(linked_doc,linked_doc_lang).epub, - pdf_landscape: by_filetype(linked_doc,linked_doc_lang).pdf_landscape, - pdf_portrait: by_filetype(linked_doc,linked_doc_lang).pdf_landscape, - odt: by_filetype(linked_doc,linked_doc_lang).odt, - xhtml: by_filetype(linked_doc,linked_doc_lang).xhtml, - xml_sax: by_filetype(linked_doc,linked_doc_lang).xml_sax, - xml_dom: by_filetype(linked_doc,linked_doc_lang).xml_dom, - txt: by_filetype(linked_doc,linked_doc_lang).txt, - html_concordance: by_filetype(linked_doc,linked_doc_lang).html_concordance, - digest: by_filetype(linked_doc,linked_doc_lang).digest, - sisupod: by_filetype(linked_doc,linked_doc_lang,source).sisupod, - source: by_filetype(linked_doc,linked_doc_lang,source).source, + manifest: by_filetype(m_linked_doc,m_linked_doc_lang).manifest, + html_toc: by_filetype(m_linked_doc,m_linked_doc_lang).html_toc, + html_doc: by_filetype(m_linked_doc,m_linked_doc_lang).html_doc, + epub: by_filetype(m_linked_doc,m_linked_doc_lang).epub, + pdf_landscape: by_filetype(m_linked_doc,m_linked_doc_lang).pdf_landscape, + pdf_portrait: by_filetype(m_linked_doc,m_linked_doc_lang).pdf_landscape, + odt: by_filetype(m_linked_doc,m_linked_doc_lang).odt, + xhtml: by_filetype(m_linked_doc,m_linked_doc_lang).xhtml, + xml_sax: by_filetype(m_linked_doc,m_linked_doc_lang).xml_sax, + xml_dom: by_filetype(m_linked_doc,m_linked_doc_lang).xml_dom, + txt: by_filetype(m_linked_doc,m_linked_doc_lang).txt, + html_concordance: by_filetype(m_linked_doc,m_linked_doc_lang).html_concordance, + digest: by_filetype(m_linked_doc,m_linked_doc_lang).digest, + sisupod: by_filetype(m_linked_doc,m_linked_doc_lang,source).sisupod, + source: by_filetype(m_linked_doc,m_linked_doc_lang,source).source, } else lnk={ - manifest: by_filename(linked_doc,linked_doc_lang).manifest, - html_toc: by_filename(linked_doc,linked_doc_lang).html_toc, - html_doc: by_filename(linked_doc,linked_doc_lang).html_doc, - epub: by_filename(linked_doc,linked_doc_lang).epub, - pdf_landscape: by_filename(linked_doc,linked_doc_lang).pdf_landscape, - pdf_portrait: by_filename(linked_doc,linked_doc_lang).pdf_landscape, - odt: by_filename(linked_doc,linked_doc_lang).odt, - xhtml: by_filename(linked_doc,linked_doc_lang).xhtml, - xml_sax: by_filename(linked_doc,linked_doc_lang).xml_sax, - xml_dom: by_filename(linked_doc,linked_doc_lang).xml_dom, - txt: by_filename(linked_doc,linked_doc_lang).txt, - html_concordance: by_filename(linked_doc,linked_doc_lang).html_concordance, - digest: by_filename(linked_doc,linked_doc_lang).digest, - sisupod: by_filename(linked_doc,linked_doc_lang,source).sisupod, - source: by_filename(linked_doc,linked_doc_lang,source).source, + manifest: by_filename(m_linked_doc,m_linked_doc_lang).manifest, + html_toc: by_filename(m_linked_doc,m_linked_doc_lang).html_toc, + html_doc: by_filename(m_linked_doc,m_linked_doc_lang).html_doc, + epub: by_filename(m_linked_doc,m_linked_doc_lang).epub, + pdf_landscape: by_filename(m_linked_doc,m_linked_doc_lang).pdf_landscape, + pdf_portrait: by_filename(m_linked_doc,m_linked_doc_lang).pdf_landscape, + odt: by_filename(m_linked_doc,m_linked_doc_lang).odt, + xhtml: by_filename(m_linked_doc,m_linked_doc_lang).xhtml, + xml_sax: by_filename(m_linked_doc,m_linked_doc_lang).xml_sax, + xml_dom: by_filename(m_linked_doc,m_linked_doc_lang).xml_dom, + txt: by_filename(m_linked_doc,m_linked_doc_lang).txt, + html_concordance: by_filename(m_linked_doc,m_linked_doc_lang).html_concordance, + digest: by_filename(m_linked_doc,m_linked_doc_lang).digest, + sisupod: by_filename(m_linked_doc,m_linked_doc_lang,source).sisupod, + source: by_filename(m_linked_doc,m_linked_doc_lang,source).source, } end - linked_title="#{pre}{#{txt} }#{lnk[:manifest]}#{note}\n\n" + linked_title="#{m_pre}{#{m_txt} }#{lnk[:manifest]}#{m_note}\n\n" tuned_file_tmp << linked_title output_filetypes=output_filetypes_in_cmd(cmd,lnk) output_filetypes[:gen].each do |o_f| diff --git a/lib/sisu/v5/dal_hash_digest.rb b/lib/sisu/v5/dal_hash_digest.rb index 29d8a1ed..9f620aa2 100644 --- a/lib/sisu/v5/dal_hash_digest.rb +++ b/lib/sisu/v5/dal_hash_digest.rb @@ -121,14 +121,13 @@ module SiSU_DAL_Hash end def stamped(t_o,hash_class) #decide what hash information is most useful, is compromise necessary? t_o.obj=SiSU_TextRepresentation::Alter.new(t_o).strip_clean_of_extra_spaces - t_obj=t_o.inspect.sub(/:0x[0-9a-f]{8}\s/,': ') - stripped=SiSU_TextRepresentation::Alter.new(t_o).strip_clean_of_markup - markup=SiSU_TextRepresentation::Alter.new(t_o).semi_revert_markup - digests=SiSU_TextRepresentation::ModifiedTextPlusHashDigest.new(@md,t_o).composite.dgst + #SiSU_TextRepresentation::Alter.new(t_o).strip_clean_of_markup #check + #SiSU_TextRepresentation::Alter.new(t_o).semi_revert_markup #check + #SiSU_TextRepresentation::ModifiedTextPlusHashDigest.new(@md,t_o).composite.dgst #check unless t_o.is==:code case t_o.obj when /#{Mx[:en_a_o]}[\d*+]+\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\d+\s+.+?#{Mx[:en_b_c]}/m - en_and_t_o,en_and_t_o_digest=[],[] + en_and_t_o_digest=[] t_o.obj=t_o.obj.gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch t_o_plus_en=t_o.obj.scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m) t_o_tail=if t_o.obj =~/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+([\s\S]+)/m @@ -137,8 +136,7 @@ module SiSU_DAL_Hash end t_o_plus_en << t_o_tail en_and_t_o_digest << endnote_digest(t_o_plus_en) - t_o_new=en_and_t_o_digest.join(' ') - #@tuned << t_o_new + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless t_o.nil? + en_and_t_o_digest.join(' ') else #@tuned << t_o + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless t_o.nil? end else #@tuned << t_o + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless t_o.nil? diff --git a/lib/sisu/v5/dal_idx.rb b/lib/sisu/v5/dal_idx.rb index 67f2805d..b87797bc 100644 --- a/lib/sisu/v5/dal_idx.rb +++ b/lib/sisu/v5/dal_idx.rb @@ -130,7 +130,7 @@ module SiSU_DAL_BookIndex idx_lst=idx[:rough_idx].scan(/[^|:]+/) idx_lst[0]=idx_lst[0].strip if idx_lst[0] =~/.+?\+\d+/ - use,plus=/(.+?)\+(\d+)/.match(idx_lst[0])[1,2] + use=/(.+?)\+(?:\d+)/.match(idx_lst[0])[1] else use=idx_lst[0] end use=use[0].chr.capitalize + use[1,use.length] @@ -282,7 +282,6 @@ module SiSU_DAL_BookIndex end end end - idx @x +=1 end end diff --git a/lib/sisu/v5/dal_numbering.rb b/lib/sisu/v5/dal_numbering.rb index 39524cc9..1b835d37 100644 --- a/lib/sisu/v5/dal_numbering.rb +++ b/lib/sisu/v5/dal_numbering.rb @@ -134,11 +134,10 @@ module SiSU_DAL_Numbering input||=@md.make.num_top end num_top=(input ? input.to_i : nil) - t_no1=t_no2=t_no3=t_no4=0 + t_no1=t_no2=t_no3=0 if num_top - no1=num_top; no2=(num_top + 1); no3=(num_top + 2); no4=(num_top + 3) + no1=num_top; no2=(num_top + 1); no3=(num_top + 2) end - t_not=0 chapter_number_counter=0 data=data.compact data.each do |dob| #@md.seg_names << [additions to segment names] @@ -357,8 +356,8 @@ module SiSU_DAL_Numbering elsif @md.pageline.inspect =~/#{m}/ dob_tmp << SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line]) << dob end - para_result=unless dob_tmp.length > 0; dob - else dob_tmp + unless dob_tmp.length > 0; dob + else dob_tmp end else dob end @@ -369,7 +368,7 @@ module SiSU_DAL_Numbering : @segname tags["#{dob.ocn}"]={ segname: @segname } ocn_html_seg[dob.ocn]=if (dob.is==:heading || dob.is==:heading_insert) - x=if dob.ln =~/[1-3]/ + if dob.ln =~/[1-3]/ { seg: nil, level: dob.ln } else #elsif dob.ln =~/[4-6]/ { seg: @seg, level: dob.ln } @@ -384,8 +383,8 @@ module SiSU_DAL_Numbering #@segname=((dob.is=='heading'|| dob.is=='heading_insert') && dob.ln==4 && (defined? dob.name)) \ #? (dob.name) \ #: @segname - dob.tags.each do |x| - tags[x]={ ocn: dob.ocn.to_s, segname: @segname } + dob.tags.each do |y| + tags[y]={ ocn: dob.ocn.to_s, segname: @segname } end end dob @@ -393,7 +392,6 @@ module SiSU_DAL_Numbering ocn_html_seg.each_with_index do |ocn,i| if ocn \ and ocn[:level].to_s=~/[1-3]/ - ocn_seg=nil (1..4).each do |x| if ocn_html_seg[i+x] and ocn_html_seg[i+x][:level]==4 ocn[:seg]=ocn_html_seg[i+x][:seg] diff --git a/lib/sisu/v5/dal_syntax.rb b/lib/sisu/v5/dal_syntax.rb index 03d397b3..08b7f6a9 100644 --- a/lib/sisu/v5/dal_syntax.rb +++ b/lib/sisu/v5/dal_syntax.rb @@ -97,7 +97,7 @@ module SiSU_DAL_Syntax tail_m_ital=%q{(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$)} tail_m_bold=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?} bold_line=%{^!_\s.+?(?:#{Mx[:br_line]}|\n|$)} - ital_line=%{^/_\s.+?(?:#{Mx[:br_line]}|\n|$)} + #ital_line=%{^/_\s.+?(?:#{Mx[:br_line]}|\n|$)} #not implemented @line_scan_ital=if defined? @md.italics_match_list[:str] /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@md.italics_match_list[:str]}#{tail_m_ital}|\S+|\n/i elsif defined? @vz.markup_make_italic[:str] diff --git a/lib/sisu/v5/db_columns.rb b/lib/sisu/v5/db_columns.rb index 14d3bb46..5223aed8 100644 --- a/lib/sisu/v5/db_columns.rb +++ b/lib/sisu/v5/db_columns.rb @@ -109,7 +109,7 @@ module SiSU_DbColumns IS 'metadata full document title [DC1]';} end def tuple - t=if defined? @md.title.full \ + if defined? @md.title.full \ and @md.title.full=~/\S+/ txt=@md.title.full txt=special_character_escape(txt) @@ -131,7 +131,7 @@ module SiSU_DbColumns IS 'metadata main document title';} end def tuple - t=if defined? @md.title.main \ + if defined? @md.title.main \ and @md.title.main=~/\S+/ txt=@md.title.main txt=special_character_escape(txt) @@ -153,7 +153,7 @@ module SiSU_DbColumns IS 'metadata document subtitle';} end def tuple - t=if defined? @md.title.sub \ + if defined? @md.title.sub \ and @md.title.sub=~/\S+/ txt=@md.title.sub txt=special_character_escape(txt) @@ -175,7 +175,7 @@ module SiSU_DbColumns IS 'metadata document short title if any';} end def tuple - t=if defined? @md.title.short \ + if defined? @md.title.short \ and @md.title.short=~/\S+/ txt=@md.title.short txt=special_character_escape(txt) @@ -197,7 +197,7 @@ module SiSU_DbColumns IS 'metadata document edition (version)';} end def tuple - t=if defined? @md.title.edition \ + if defined? @md.title.edition \ and @md.title.edition=~/\S+/ txt=@md.title.edition txt=special_character_escape(txt) @@ -219,7 +219,7 @@ module SiSU_DbColumns IS 'metadata document notes associated with title';} end def tuple - t=if defined? @md.title.note \ + if defined? @md.title.note \ and @md.title.note=~/\S+/ txt=@md.title.note txt=special_character_escape(txt) @@ -241,7 +241,7 @@ module SiSU_DbColumns IS 'metadata document language [DC12]';} end def tuple - t=if @lang.list[@md.opt.lng][:n] + if @lang.list[@md.opt.lng][:n] txt=@lang.list[@md.opt.lng][:n] txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] @@ -262,7 +262,7 @@ module SiSU_DbColumns IS 'metadata document language iso code';} end def tuple - t=if defined? @md.opt.lng \ + if defined? @md.opt.lng \ and @md.opt.lng=~/\S+/ txt=@md.opt.lng txt=special_character_escape(txt) @@ -298,7 +298,7 @@ module SiSU_DbColumns IS 'metadata document author (creator) [DC2]';} end def tuple - t=if defined? @md.creator.author_detail \ + if defined? @md.creator.author_detail \ and @md.creator.author_detail.is_a?(Array) \ and @md.creator.author_detail.length > 0 txt='' @@ -325,7 +325,7 @@ module SiSU_DbColumns IS 'metadata document author honorific (title e.g, Ms. Dr. Prof.)';} end def tuple - t=if defined? @md.creator.author_hon \ + if defined? @md.creator.author_hon \ and @md.creator.author_hon=~/\S+/ txt=@md.creator.author_hon txt=special_character_escape(txt) @@ -347,7 +347,7 @@ module SiSU_DbColumns IS 'metadata nationality of document author (creator)';} end def tuple - t=if defined? @md.creator.author_nationality_detail \ + if defined? @md.creator.author_nationality_detail \ and @md.creator.author_nationality=~/\S+/ txt=@md.creator.author_nationality_detail txt=special_character_escape(txt) @@ -369,7 +369,7 @@ module SiSU_DbColumns IS 'metadata document editor name(s)';} end def tuple - t=if defined? @md.creator.editor_detail \ + if defined? @md.creator.editor_detail \ and @md.creator.editor_detail.is_a?(Array) \ and @md.creator.editor_detail.length > 0 txt=@md.creator.editor_detail #dc @@ -397,7 +397,7 @@ module SiSU_DbColumns IS 'metadata document contributor name(s) [DC6]';} end def tuple - t=if defined? @md.creator.contributor_detail \ + if defined? @md.creator.contributor_detail \ and @md.creator.contributor_detail.is_a?(Array) \ and @md.creator.contributor_detail.length > 0 txt=@md.creator.contributor_detail #dc @@ -425,7 +425,7 @@ module SiSU_DbColumns IS 'metadata document illustrator name(s)';} end def tuple - t=if defined? @md.creator.illustrator_detail \ + if defined? @md.creator.illustrator_detail \ and @md.creator.illustrator_detail.is_a?(Array) \ and @md.creator.illustrator_detail.length > 0 txt=@md.creator.illustrator_detail @@ -453,7 +453,7 @@ module SiSU_DbColumns IS 'metadata document photographer name(s)';} end def tuple - t=if defined? @md.creator.photographer_detail \ + if defined? @md.creator.photographer_detail \ and @md.creator.photographer_detail.is_a?(Array) \ and @md.creator.photographer_detail.length > 0 txt=@md.creator.photographer_detail @@ -481,7 +481,7 @@ module SiSU_DbColumns IS 'metadata document translator name(s)';} end def tuple - t=if defined? @md.creator.translator_detail \ + if defined? @md.creator.translator_detail \ and @md.creator.translator_detail.is_a?(Array) \ and @md.creator.translator_detail.length > 0 txt='' @@ -508,7 +508,7 @@ module SiSU_DbColumns IS 'metadata document prepared by name(s)';} end def tuple - t=if defined? @md.creator.prepared_by_detail \ + if defined? @md.creator.prepared_by_detail \ and @md.creator.prepared_by_detail.is_a?(Array) \ and @md.creator.prepared_by_detail.length > 0 txt=@md.creator.prepared_by_detail @@ -536,7 +536,7 @@ module SiSU_DbColumns IS 'metadata document digitized by name(s)';} end def tuple - t=if defined? @md.creator.digitized_by_detail \ + if defined? @md.creator.digitized_by_detail \ and @md.creator.digitized_by_detail.is_a?(Array) \ and @md.creator.digitized_by_detail.length > 0 txt=@md.creator.digitized_by_detail @@ -564,7 +564,7 @@ module SiSU_DbColumns IS 'metadata document audio by name(s)';} end def tuple - t=if defined? @md.creator.audio_detail \ + if defined? @md.creator.audio_detail \ and @md.creator.audio_detail.is_a?(Array) \ and @md.creator.audio_detail.length > 0 txt=@md.creator.audio_detail @@ -592,7 +592,7 @@ module SiSU_DbColumns IS 'metadata document video by name(s)';} end def tuple - t=if defined? @md.creator.video_detail \ + if defined? @md.creator.video_detail \ and @md.creator.video_detail.is_a?(Array) \ and @md.creator.video_detail.length > 0 txt='' @@ -631,7 +631,7 @@ module SiSU_DbColumns IS 'metadata document language';} end def tuple - t=if @lang.list[@md.opt.lng][:n] + if @lang.list[@md.opt.lng][:n] txt=@lang.list[@md.opt.lng][:n] txt=special_character_escape(txt) ["#{name}, ","'#{txt}', "] @@ -653,7 +653,7 @@ module SiSU_DbColumns end def tuple #modify check, is now required, SiSUv3d_ - t=if defined? @md.opt.lng \ + if defined? @md.opt.lng \ and @md.opt.lng=~/\S+/ txt=@md.opt.lng txt=special_character_escape(txt) @@ -675,7 +675,7 @@ module SiSU_DbColumns IS 'metadata original document/text language';} end def tuple - t=if defined? @md.language.original \ + if defined? @md.language.original \ and @md.language.original=~/\S+/ txt=@md.language.original txt=special_character_escape(txt) @@ -697,7 +697,7 @@ module SiSU_DbColumns IS 'metadata document language';} end def tuple - t=if defined? @md.language.original_char \ + if defined? @md.language.original_char \ and @md.language.original_char=~/\S+/ txt=@md.language.original_char txt=special_character_escape(txt) @@ -733,7 +733,7 @@ module SiSU_DbColumns IS 'metadata date added to site';} end def tuple - t=if defined? @md.date.added_to_site \ + if defined? @md.date.added_to_site \ and @md.date.added_to_site=~/\S+/ txt=@md.date.added_to_site txt=special_character_escape(txt) @@ -755,7 +755,7 @@ module SiSU_DbColumns IS 'metadata date added to site [DC]';} end def tuple - t=if defined? @md.date.available \ + if defined? @md.date.available \ and @md.date.available=~/\S+/ txt=@md.date.available txt=special_character_escape(txt) @@ -777,7 +777,7 @@ module SiSU_DbColumns IS 'metadata date created [DC]';} end def tuple - t=if defined? @md.date.created \ + if defined? @md.date.created \ and @md.date.created=~/\S+/ txt=@md.date.created txt=special_character_escape(txt) @@ -799,7 +799,7 @@ module SiSU_DbColumns IS 'metadata date issued [DC]';} end def tuple - t=if defined? @md.date.issued \ + if defined? @md.date.issued \ and @md.date.issued=~/\S+/ txt=@md.date.issued txt=special_character_escape(txt) @@ -821,7 +821,7 @@ module SiSU_DbColumns IS 'metadata date modified [DC]';} end def tuple - t=if defined? @md.date.modified \ + if defined? @md.date.modified \ and @md.date.modified=~/\S+/ txt=@md.date.modified txt=special_character_escape(txt) @@ -843,7 +843,7 @@ module SiSU_DbColumns IS 'metadata date published [DC7]';} end def tuple - t=if defined? @md.date.published \ + if defined? @md.date.published \ and @md.date.published=~/\S+/ txt=@md.date.published txt=special_character_escape(txt) @@ -865,7 +865,7 @@ module SiSU_DbColumns IS 'metadata date valid [DC]';} end def tuple - t=if defined? @md.date.valid \ + if defined? @md.date.valid \ and @md.date.valid=~/\S+/ txt=@md.date.valid txt=special_character_escape(txt) @@ -887,7 +887,7 @@ module SiSU_DbColumns IS 'metadata date translated';} end def tuple - t=if defined? @md.date.translated \ + if defined? @md.date.translated \ and @md.date.translated=~/\S+/ txt=@md.date.translated txt=special_character_escape(txt) @@ -909,7 +909,7 @@ module SiSU_DbColumns IS 'metadata date of original publication';} end def tuple - t=if defined? @md.date.original_publication \ + if defined? @md.date.original_publication \ and @md.date.original_publication=~/\S+/ txt=@md.date.original_publication txt=special_character_escape(txt) @@ -932,7 +932,7 @@ module SiSU_DbColumns IS 'metadata date of sisu generation of document, automatically populated';} end def tuple #choose other representation of time - t=if defined? @md.generated \ + if defined? @md.generated \ and @md.generated.to_s=~/\S+/ txt=@md.generated.to_s txt=special_character_escape(txt) @@ -958,7 +958,7 @@ module SiSU_DbColumns IS 'metadata document publisher [DC5]';} end def tuple - t=if defined? @md.publisher \ + if defined? @md.publisher \ and @md.publisher=~/\S+/ txt=@md.publisher txt=special_character_escape(txt) @@ -1011,7 +1011,7 @@ module SiSU_DbColumns IS 'metadata document original publisher [DC5]';} end def tuple - t=if defined? @md.original.publisher \ + if defined? @md.original.publisher \ and @md.original.publisher=~/\S+/ txt=@md.original.publisher txt=special_character_escape(txt) @@ -1033,7 +1033,7 @@ module SiSU_DbColumns IS 'metadata document original language';} end def tuple - t=if defined? @md.original.language \ + if defined? @md.original.language \ and @md.original.language=~/\S+/ txt=@md.original.language txt=special_character_escape(txt) @@ -1055,7 +1055,7 @@ module SiSU_DbColumns IS 'metadata document original language iso character';} end def tuple - t=if defined? @md.original.language_char \ + if defined? @md.original.language_char \ and @md.original.language_char=~/\S+/ txt=@md.original.language_char txt=special_character_escape(txt) @@ -1077,7 +1077,7 @@ module SiSU_DbColumns IS 'metadata document original source [DC11]';} end def tuple - t=if defined? @md.original.source \ + if defined? @md.original.source \ and @md.original.source=~/\S+/ txt=@md.original.source txt=special_character_escape(txt) @@ -1099,7 +1099,7 @@ module SiSU_DbColumns IS 'metadata document original institution';} end def tuple - t=if defined? @md.original.institution \ + if defined? @md.original.institution \ and @md.original.institution=~/\S+/ txt=@md.original.institution txt=special_character_escape(txt) @@ -1121,7 +1121,7 @@ module SiSU_DbColumns IS 'metadata document original nationality';} end def tuple - t=if defined? @md.original.nationality \ + if defined? @md.original.nationality \ and @md.original.nationality=~/\S+/ txt=@md.original.nationality txt=special_character_escape(txt) @@ -1158,7 +1158,7 @@ module SiSU_DbColumns IS 'metadata rights associated with document (composite) [DC15]';} end def tuple - t=if defined? @md.rights.all \ + if defined? @md.rights.all \ and @md.rights.all=~/\S+/ txt=@md.rights.all txt=special_character_escape(txt) @@ -1180,7 +1180,7 @@ module SiSU_DbColumns IS 'metadata copyright associated for document text';} end def tuple - t=if defined? @md.rights.copyright_text \ + if defined? @md.rights.copyright_text \ and @md.rights.copyright_text=~/\S+/ txt=@md.rights.copyright_text txt=special_character_escape(txt) @@ -1202,7 +1202,7 @@ module SiSU_DbColumns IS 'metadata copyright associated for document text translation (if any)';} end def tuple - t=if defined? @md.rights.copyright_translation \ + if defined? @md.rights.copyright_translation \ and @md.rights.copyright_translation=~/\S+/ txt=@md.rights.copyright_translation txt=special_character_escape(txt) @@ -1224,7 +1224,7 @@ module SiSU_DbColumns IS 'metadata copyright associated for document text illustrations (if any)';} end def tuple - t=if defined? @md.rights.copyright_illustrations \ + if defined? @md.rights.copyright_illustrations \ and @md.rights.copyright_illustrations=~/\S+/ txt=@md.rights.copyright_illustrations txt=special_character_escape(txt) @@ -1246,7 +1246,7 @@ module SiSU_DbColumns IS 'metadata copyright associated for document text photographs (if any)';} end def tuple - t=if defined? @md.rights.copyright_photographs \ + if defined? @md.rights.copyright_photographs \ and @md.rights.copyright_photographs=~/\S+/ txt=@md.rights.copyright_photographs txt=special_character_escape(txt) @@ -1268,7 +1268,7 @@ module SiSU_DbColumns IS 'metadata copyright associated for document text preparation (if any)';} end def tuple - t=if defined? @md.rights.copyright_preparation \ + if defined? @md.rights.copyright_preparation \ and @md.rights.copyright_preparation=~/\S+/ txt=@md.rights.copyright_preparation txt=special_character_escape(txt) @@ -1290,7 +1290,7 @@ module SiSU_DbColumns IS 'metadata copyright associated for document text digitization (if any)';} end def tuple - t=if defined? @md.rights.copyright_digitization \ + if defined? @md.rights.copyright_digitization \ and @md.rights.copyright_digitization=~/\S+/ txt=@md.rights.copyright_digitization txt=special_character_escape(txt) @@ -1312,7 +1312,7 @@ module SiSU_DbColumns IS 'metadata copyright associated for document text audio (if any)';} end def tuple - t=if defined? @md.rights.copyright_audio \ + if defined? @md.rights.copyright_audio \ and @md.rights.copyright_audio=~/\S+/ txt=@md.rights.copyright_audio txt=special_character_escape(txt) @@ -1334,7 +1334,7 @@ module SiSU_DbColumns IS 'metadata copyright associated for document text video (if any)';} end def tuple - t=if defined? @md.rights.copyright_video \ + if defined? @md.rights.copyright_video \ and @md.rights.copyright_video=~/\S+/ txt=@md.rights.copyright_video txt=special_character_escape(txt) @@ -1356,7 +1356,7 @@ module SiSU_DbColumns IS 'metadata license granted for use of document if any)';} end def tuple - t=if defined? @md.rights.license \ + if defined? @md.rights.license \ and @md.rights.license=~/\S+/ txt=@md.rights.license txt=special_character_escape(txt) @@ -1384,7 +1384,7 @@ module SiSU_DbColumns IS 'metadata identifier document Online Computer Library Center number';} end def tuple - t=if defined? @md.identifier.oclc \ + if defined? @md.identifier.oclc \ and @md.identifier.oclc=~/\S+/ txt=@md.identifier.oclc txt=special_character_escape(txt) @@ -1406,7 +1406,7 @@ module SiSU_DbColumns IS 'metadata identifier document isbn (if any)';} end def tuple - t=if defined? @md.identifier.isbn \ + if defined? @md.identifier.isbn \ and @md.identifier.isbn=~/\S+/ txt=@md.identifier.isbn txt=special_character_escape(txt) @@ -1438,7 +1438,7 @@ module SiSU_DbColumns IS 'metadata classify document topic register (semi-structured document subject information)';} end def tuple - t=if defined? @md.classify.topic_register \ + if defined? @md.classify.topic_register \ and @md.classify.topic_register=~/\S+/ txt=@md.classify.topic_register txt=special_character_escape(txt) @@ -1460,7 +1460,7 @@ module SiSU_DbColumns IS 'metadata classify document subject matter [DC3]';} end def tuple - t=if defined? @md.classify.subject \ + if defined? @md.classify.subject \ and @md.classify.subject=~/\S+/ txt=@md.classify.subject txt=special_character_escape(txt) @@ -1482,7 +1482,7 @@ module SiSU_DbColumns IS 'metadata classify document Library of Congress';} end def tuple - t=if defined? @md.classify.loc \ + if defined? @md.classify.loc \ and @md.classify.loc=~/\S+/ txt=@md.classify.loc txt=special_character_escape(txt) @@ -1504,7 +1504,7 @@ module SiSU_DbColumns IS 'metadata classify document Dewey';} end def tuple - t=if defined? @md.classify.dewey \ + if defined? @md.classify.dewey \ and @md.classify.dewey=~/\S+/ txt=@md.classify.dewey txt=special_character_escape(txt) @@ -1526,7 +1526,7 @@ module SiSU_DbColumns IS 'metadata classify document keywords';} end def tuple - t=if defined? @md.classify.keywords \ + if defined? @md.classify.keywords \ and @md.classify.keywords=~/\S+/ txt=@md.classify.keywords txt=special_character_escape(txt) @@ -1563,7 +1563,7 @@ module SiSU_DbColumns IS 'metadata document notes abstract';} end def tuple - t=if defined? @md.notes.abstract \ + if defined? @md.notes.abstract \ and @md.notes.abstract=~/\S+/ txt=@md.notes.abstract txt=special_character_escape(txt) @@ -1585,7 +1585,7 @@ module SiSU_DbColumns IS 'metadata document notes description [DC4]';} end def tuple - t=if defined? @md.notes.description \ + if defined? @md.notes.description \ and @md.notes.description=~/\S+/ txt=@md.notes.description txt=special_character_escape(txt) @@ -1607,7 +1607,7 @@ module SiSU_DbColumns IS 'metadata document notes comment';} end def tuple - t=if defined? @md.notes.comment \ + if defined? @md.notes.comment \ and @md.notes.comment=~/\S+/ txt=@md.notes.comment txt=special_character_escape(txt) @@ -1629,7 +1629,7 @@ module SiSU_DbColumns IS 'metadata classify document coverage [DC14]';} end def tuple - t=if defined? @md.classify.coverage \ + if defined? @md.classify.coverage \ and @md.classify.coverage=~/\S+/ txt=@md.classify.coverage txt=special_character_escape(txt) @@ -1651,7 +1651,7 @@ module SiSU_DbColumns IS 'metadata classify document relation [DC13]';} end def tuple - t=if defined? @md.classify.relation \ + if defined? @md.classify.relation \ and @md.classify.relation=~/\S+/ txt=@md.classify.relation txt=special_character_escape(txt) @@ -1673,7 +1673,7 @@ module SiSU_DbColumns IS 'metadata document notes history';} end def tuple - t=if defined? @md.notes.history \ + if defined? @md.notes.history \ and @md.notes.history=~/\S+/ txt=@md.notes.history txt=special_character_escape(txt) @@ -1695,7 +1695,7 @@ module SiSU_DbColumns IS 'metadata notes document type [DC8]';} end def tuple - t=if defined? @md.notes.type \ + if defined? @md.notes.type \ and @md.notes.type=~/\S+/ txt=@md.notes.type txt=special_character_escape(txt) @@ -1717,7 +1717,7 @@ module SiSU_DbColumns IS 'metadata classify document format [DC9]';} end def tuple - t=if defined? @md.classify.format \ + if defined? @md.classify.format \ and @md.classify.format=~/\S+/ txt=@md.classify.format txt=special_character_escape(txt) @@ -1739,7 +1739,7 @@ module SiSU_DbColumns IS 'metadata document notes prefix';} end def tuple - t=if defined? @md.notes.prefix \ + if defined? @md.notes.prefix \ and @md.notes.prefix=~/\S+/ txt=@md.notes.prefix txt=special_character_escape(txt) @@ -1761,7 +1761,7 @@ module SiSU_DbColumns IS 'metadata document notes prefix_a';} end def tuple - t=if defined? @md.notes.prefix_a \ + if defined? @md.notes.prefix_a \ and @md.notes.prefix_a=~/\S+/ txt=@md.notes.prefix_a txt=special_character_escape(txt) @@ -1783,7 +1783,7 @@ module SiSU_DbColumns IS 'metadata document notes prefix_b';} end def tuple - t=if defined? @md.notes.prefix_b \ + if defined? @md.notes.prefix_b \ and @md.notes.prefix_b=~/\S+/ txt=@md.notes.prefix_b txt=special_character_escape(txt) @@ -1805,7 +1805,7 @@ module SiSU_DbColumns IS 'metadata document notes suffix';} end def tuple - t=if defined? @md.notes.suffix \ + if defined? @md.notes.suffix \ and @md.notes.suffix=~/\S+/ txt=@md.notes.suffix txt=special_character_escape(txt) @@ -1830,7 +1830,7 @@ module SiSU_DbColumns IS 'sisu markup source text filename';} end def tuple - t=if defined? @md.fns \ + if defined? @md.fns \ and @md.fns=~/\S+/ txt=@md.fns txt=special_character_escape(txt) @@ -1853,7 +1853,7 @@ module SiSU_DbColumns IS 'sisu markup source text fingerprint, hash digest sha256 (or md5)';} end def tuple - t=if defined? @md.dgst \ + if defined? @md.dgst \ and @md.dgst.is_a?(Array) \ and @md.dgst[1]=~/\S+/ txt=@md.dgst[1] @@ -1875,7 +1875,7 @@ module SiSU_DbColumns IS 'sisu markup source text file size';} end def tuple - t=if defined? @md.filesize \ + if defined? @md.filesize \ and @md.filesize=~/\S+/ txt=@md.filesize txt=special_character_escape(txt) @@ -1897,7 +1897,7 @@ module SiSU_DbColumns IS 'sisu markup source text word count';} end def tuple - t=if defined? @md.wc_words \ + if defined? @md.wc_words \ and @md.wc_words=~/\S+/ txt=@md.wc_words txt=special_character_escape(txt) @@ -1919,7 +1919,7 @@ module SiSU_DbColumns IS 'sisu markup source text (if shared)';} end def tuple - t=if @md.opt.mod.inspect=~/import|update/ \ + if @md.opt.mod.inspect=~/import|update/ \ and FileTest.exist?(@md.fns) ["#{name}, ","'#{@sisutxt}', "] else ['',''] @@ -1943,7 +1943,7 @@ module SiSU_DbColumns IS 'document full text clean, searchable';} end def tuple - t=if @md.opt.mod.inspect=~/import|update/ \ + if @md.opt.mod.inspect=~/import|update/ \ and FileTest.exist?(@md.fns) ["#{name}, ","'#{@fulltext}', "] else ['',''] @@ -1964,7 +1964,7 @@ module SiSU_DbColumns IS 'metadata document links';} end def tuple - t=if defined? @md.links \ + if defined? @md.links \ and @md.links=~/\S+/ txt=@md.links txt=special_character_escape(txt) diff --git a/lib/sisu/v5/db_import.rb b/lib/sisu/v5/db_import.rb index 293071ff..a4edfab7 100644 --- a/lib/sisu/v5/db_import.rb +++ b/lib/sisu/v5/db_import.rb @@ -147,7 +147,6 @@ module SiSU_DbImport puts @conn.driver if defined? @conn.driver end begin - sql='' if @sql_type=~/sqlite/ @conn.transaction do |conn| t_d.each do |sql| @@ -270,10 +269,10 @@ module SiSU_DbImport data.obj.gsub!(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check @col[:seg]=@@seg if data.of ==:para \ - || :heading \ - || :heading_insert \ - || :block \ - || :group # regular text what of code-blocks grouped text etc. + || data.of ==:heading \ + || data.of ==:heading_insert \ + || data.of ==:block \ + || data.of ==:group # regular text what of code-blocks grouped text etc. notedata=data.obj.dup #% :headings if data.is==:heading \ @@ -590,17 +589,17 @@ module SiSU_DbImport @txt end def standard - x=(@txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/) \ + (@txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/) \ ? @txt.scan(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/) : nil end def asterisk - x=(@txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/) \ + (@txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/) \ ? @txt.scan(/#{Mx[:en_b_o]}[*](\d+).+?#{Mx[:en_b_c]}/) : nil end def plus - x=(@txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/) \ + (@txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/) \ ? @txt.scan(/#{Mx[:en_b_o]}[+](\d+).+?#{Mx[:en_b_c]}/) : nil end @@ -636,8 +635,6 @@ module SiSU_DbImport begin @fnc=content @env=SiSU_Env::InfoEnv.new(@opt.fns) - base=@env.url.root - out=@env.path.output f,u={},{} if @fnb.empty? \ or @fnb.nil? diff --git a/lib/sisu/v5/db_select.rb b/lib/sisu/v5/db_select.rb index 67009f0c..845cafde 100644 --- a/lib/sisu/v5/db_select.rb +++ b/lib/sisu/v5/db_select.rb @@ -92,7 +92,7 @@ module SiSU_DbSelect end def sql_maintenance_file file=if @opt.inspect =~/M/ - x=if @opt.fns and not @opt.fns.empty? + if @opt.fns and not @opt.fns.empty? @env=SiSU_Env::InfoEnv.new(@opt.fns) if @opt.fns puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type =~/sqlite/ and @opt.cmd =~/M/ @db=SiSU_Env::InfoDb.new diff --git a/lib/sisu/v5/dbi.rb b/lib/sisu/v5/dbi.rb index eae39ae8..2d8ac64e 100644 --- a/lib/sisu/v5/dbi.rb +++ b/lib/sisu/v5/dbi.rb @@ -119,7 +119,6 @@ manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet end def read_sqlite begin - sql_type='sqlite' @conn=@db.sqlite.conn_sqlite3 rescue ensure diff --git a/lib/sisu/v5/dbi_discrete.rb b/lib/sisu/v5/dbi_discrete.rb index cddc03f3..572ac154 100644 --- a/lib/sisu/v5/dbi_discrete.rb +++ b/lib/sisu/v5/dbi_discrete.rb @@ -151,7 +151,6 @@ module SiSU_DBI_Discrete #% database building end def connect begin - sql_type='sqlite' SiSU_Screen::Ansi.new(@opt.cmd,"DBI (#{@sql_type}) #{@opt.mod}",@opt.fns).dbi_title unless @opt.cmd =~/q/ @db.sqlite_discrete.conn_sqlite3 rescue @@ -165,7 +164,7 @@ module SiSU_DBI_Discrete #% database building end def sql_maintenance_file file=if @opt.inspect =~/M/ - x=if @opt.fns and not @opt.fns.empty? + if @opt.fns and not @opt.fns.empty? @env=SiSU_Env::InfoEnv.new(@opt.fns) if @opt.fns puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type =~/sqlite/ and @opt.cmd =~/M/ @db=SiSU_Env::InfoDb.new diff --git a/lib/sisu/v5/defaults.rb b/lib/sisu/v5/defaults.rb index 6b3004ef..91ded537 100644 --- a/lib/sisu/v5/defaults.rb +++ b/lib/sisu/v5/defaults.rb @@ -937,18 +937,17 @@ WOK widget_sisu_text end def credits_sisu - x=%{<div class="substance"> + %{<div class="substance"> <table summary="SiSU summary" bgcolor="#ffffff" cellpadding="4" border="0"> <tr><td> #{widget_sisu} - #{widget_way_better} </table></div>} '' end def credits_splash end def credits_sisu_epub - x=%{<div class="substance"> + %{<div class="substance"> <p class="center"><a href="http://www.openebook.org"><b>EPUB</b></a> generated by <a href="http://www.sisudoc.org"><b>#{@v[:project]}</b></a> v#{@v[:version]}, GPL3</p> </div>} '' @@ -1198,7 +1197,7 @@ WOK self end def dimensions - d=case @papersize + case @papersize when /a4/; a4 when /letter/; letter when /legal/; legal diff --git a/lib/sisu/v5/digests.rb b/lib/sisu/v5/digests.rb index 902a0e94..9eba6544 100644 --- a/lib/sisu/v5/digests.rb +++ b/lib/sisu/v5/digests.rb @@ -63,7 +63,6 @@ module SiSU_DigestView require_relative 'particulars' # particulars.rb require_relative 'prog_text_translation' # prog_text_translation.rb require_relative 'shared_markup_alt.rb' # shared_markup_alt.rb - pwd=Dir.pwd class Source @@dg=nil def initialize(opt) @@ -149,14 +148,13 @@ module SiSU_DigestView def message_digest data=@data sys=SiSU_Env::SystemCall.new - l=Hash.new(0) @p=[] @g,@v,@r='','','' data.each do |para| x=nil y,para_endnotes=[],[] - if para =~/#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}#{Mx[:id_o]}([0-9a-f]{#{@dl}}):([0-9a-f]{#{@dl}})#{Mx[:id_c]}/ - ocn,h1,h2,d_clean,d_all=$1,$2,$3,$4,$5 + if para =~/#{Mx[:id_o]}~(\d+);(?:(?:\w|[0-6]:)\d+);(?:\w\d+)#{Mx[:id_c]}#{Mx[:id_o]}([0-9a-f]{#{@dl}}):([0-9a-f]{#{@dl}})#{Mx[:id_c]}/ + ocn,d_clean,d_all=$1,$2,$3 @ocn=ocn unless ocn.to_i==0 para=para.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>'). gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>'). @@ -164,29 +162,29 @@ module SiSU_DigestView if para=~/#{Mx[:en_a_o]}[\d*+]+.+?#{Mx[:id_o]}[0-9a-f]{#{@dl}}#{Mx[:id_c]}#{Mx[:en_a_c]}/ para_endnotes << para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+).+?#{Mx[:id_o]}([0-9a-f]{#{@dl}})#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/) end - ima=[] + images=[] if para !~/^%+\s/ \ and para =~/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+\.(png|jpg|gif))\s.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/ images=para.scan(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+\.(?:png|jpg|gif))\s.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/).flatten - else image=nil + else nil end x=case para when /^#{Mx[:meta_o]}title#{Mx[:meta_c]}/ - "\n" + ' '*0 +'@' + ' '*9 + "\n" << ' '*0 << '@' << ' '*9 when /^#{Mx[:meta_o]}subtitle#{Mx[:meta_c]}/ - "\n" + ' '*1 +'@' + ' '*8 + "\n" << ' '*1 << '@' << ' '*8 when /^#{Mx[:lv_o]}1:/ #fix Mx[:lv_o] - "\n" + ' '*2 +':A ' + ' '*6 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + "\n" << ' '*2 << ':A ' << ' '*6 << '- ' << ocn << ' '*(10-ocn.length) << d_clean << ' ' << d_all when /^#{Mx[:lv_o]}2:/ #fix Mx[:lv_o] - "\n" + ' '*3 +':B ' + ' '*5 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + "\n" << ' '*3 << ':B ' << ' '*5 << '- ' << ocn << ' '*(10-ocn.length) << d_clean << ' ' << d_all when /^#{Mx[:lv_o]}3:/ #fix Mx[:lv_o] - "\n" + ' '*4 +':C ' + ' '*4 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + "\n" << ' '*4 << ':C ' << ' '*4 << '- ' << ocn << ' '*(10-ocn.length) << d_clean << ' ' << d_all when /^#{Mx[:lv_o]}4:/ #fix Mx[:lv_o] - "\n" + ' '*5 +'1' + ' '*4 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + "\n" << ' '*5 << '1' << ' '*4 << '- ' << ocn << ' '*(10-ocn.length) << d_clean << ' ' << d_all when /^#{Mx[:lv_o]}5:/ #fix Mx[:lv_o] - "\n" + ' '*6 +'2' + ' '*3 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + "\n" << ' '*6 << '2' << ' '*3 << '- ' << ocn << ' '*(10-ocn.length) << d_clean << ' ' << d_all when /^#{Mx[:lv_o]}6:/ #fix Mx[:lv_o] - "\n" + ' '*7 +'3' + ' '*2 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + "\n" << ' '*7 << '3' << ' '*2 << '- ' << ocn << ' '*(10-ocn.length) << d_clean << ' ' << d_all else if para =~/MD5\(\S+?\.sst\)=\s*<u>([0-9a-f]{#{@dl}})<\/u>/ #watch @n,@s=/MD5\((\S+?\.sst)\)=\s*<u>([0-9a-f]{#{@dl}})<\/u>/.match(para)[1,2] @@ -259,7 +257,7 @@ module SiSU_DigestView when /#{m_author}: / @c=/#{m_author}: (.+?)#{Mx[:id_o]}~\d;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@dl}}:[0-9a-f]{#{@dl}}#{Mx[:id_c]}/.match(para)[1].gsub(/<\/?u>/,'').strip when /#{m_sourcefile_digest}.+?<u>/ #watch - dgst_extra="\n" + ' '*21 +'source' +' '*4 + @md.dgst[1] + ' '*34 + @md.fns + dgst_extra="\n" << ' '*21 << 'source' << ' '*4 << @md.dgst[1] << ' '*34 << @md.fns when /#{m_sisu_version}: / @v=/#{m_sisu_version}: (.+?)#{Mx[:id_o]}~\d;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@dl}}:[0-9a-f]{#{@dl}}#{Mx[:id_c]}/.match(para)[1].gsub(/<\/?u>/,'').strip when /#{m_last_generated}: / @@ -268,7 +266,7 @@ module SiSU_DigestView @r=/#{m_ruby_version}: (.+?)#{Mx[:id_o]}~\d;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@dl}}:[0-9a-f]{#{@dl}}#{Mx[:id_c]}/.match(para)[1].gsub(/<\/?u>/,'').strip end dgst_extra ||='' - "\n" + prefix +' - ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + dgst_extra + "\n" + "\n" << prefix << ' - ' << ocn << ' '*(10-ocn.length) << d_clean << ' ' << d_all << dgst_extra << "\n" end end para_endnotes[0].each { |e| y << "\n" + ' '*(28-e[0].length) + "[#{e[0].to_s}] #{e[1].to_s}" } if para_endnotes[0] @@ -331,17 +329,17 @@ module SiSU_DigestView if t_o.is==:heading x=case t_o.ln when 1; l[1] +=1 #fix Mx[:lv_o] - ' '*0 +':A' + ' '*0 << ':A' when 2; l[2] +=1 #fix Mx[:lv_o] - ' '*1 +':B' + ' '*1 << ':B' when 3; l[3] +=1 #fix Mx[:lv_o] - ' '*2 +':C' + ' '*2 << ':C' when 4; l[4] +=1 #fix Mx[:lv_o] - ' '*3 +'1' + ' '*3 << '1' when 5; l[5] +=1 #fix Mx[:lv_o] - ' '*4 +'2' + ' '*4 << '2' when 6; l[6] +=1 #fix Mx[:lv_o] - ' '*5 +'3' + ' '*5 << '3' else nil end end diff --git a/lib/sisu/v5/embedded.rb b/lib/sisu/v5/embedded.rb index a75b1690..c7fec7ed 100644 --- a/lib/sisu/v5/embedded.rb +++ b/lib/sisu/v5/embedded.rb @@ -90,12 +90,9 @@ module SiSU_Embedded end def images src="#{@base_src_dir}/_sisu/image" - src_img='_sisu/image' ldest=@env.path.output img_dir="#{@env.path.output}/_sisu/image" @rhost.each do |remote_conn| - rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image" - remote_rel=remote_conn[:name] + '/' + @f.output_path.stub.rcp if @md.opt.cmd.inspect =~/[vVMR]/ \ and FileTest.directory?(src) FileUtils::mkdir_p(img_dir) unless FileTest.directory?(img_dir) diff --git a/lib/sisu/v5/epub.rb b/lib/sisu/v5/epub.rb index 480474e1..960ddd68 100644 --- a/lib/sisu/v5/epub.rb +++ b/lib/sisu/v5/epub.rb @@ -86,7 +86,6 @@ module SiSU_EPUB @md=@particulars.md @fnb=@md.fnb @env=@particulars.env - loc=@env.path.url.output_tell unless @opt.cmd =~/q/ tool=(@opt.cmd =~/[MVvz]/) \ ? "#{@env.program.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}" @@ -98,15 +97,13 @@ module SiSU_EPUB end @env.processing_path.epub_bld #(@md) @env.processing_path.epub_cp_images(@md) - dir_epub=@env.processing_path.epub data=nil SiSU_Env::FileOp.new(@md).mkdir.output.epub @tuned_file_array=SiSU_EPUB::Source::XHTML_Environment.new(@particulars).tuned_file_instructions data=@tuned_file_array - scr_endnotes=SiSU_EPUB::Source::Endnotes.new(@md,data).scroll toc=SiSU_EPUB::Source::Toc.new(@md,data).songsheet data=@tuned_file_array - scr_toc=SiSU_EPUB::Source::ScrollHeadAndSegToc.new(@md,toc).in_common #watch + SiSU_EPUB::Source::ScrollHeadAndSegToc.new(@md,toc).in_common #watch SiSU_EPUB::Source::Seg.new(@md,data).songsheet SiSU_EPUB::Source::Output.new(@md).songsheet rescue @@ -139,7 +136,6 @@ module SiSU_EPUB @env,@css=particulars.env,SiSU_Style::CSS.new end def directories - title=File.basename(@md.fns,'.rb') SiSU_Env::FileOp.new(@md).mkdir.output.epub end def tuned_file_instructions @@ -157,7 +153,6 @@ module SiSU_EPUB end def scroll @scr_endnotes=[] - format_head_scroll=SiSU_EPUB_Format::HeadScroll.new(@md) @data.each do |dob| pg=dob.dup unless pg.is ==:code @@ -376,10 +371,6 @@ module SiSU_EPUB def level_1 dob=@data linkname,link=dob.obj.strip,dob.ocn - if link \ - and link !~/#/ #% keep eye on link - p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,link) - end title=if dob.obj !~/Document Information/ linkname else diff --git a/lib/sisu/v5/epub_concordance.rb b/lib/sisu/v5/epub_concordance.rb index e528a788..8940c3a3 100644 --- a/lib/sisu/v5/epub_concordance.rb +++ b/lib/sisu/v5/epub_concordance.rb @@ -104,7 +104,6 @@ module SiSU_EPUB_Concordance @particulars,@md=particulars,particulars.md @data=SiSU_EPUB::Source::XHTML_Environment.new(particulars).tuned_file_instructions @vz=SiSU_Viz::Defaults.new - txt_path=%{#{@md.dir_out}} @fnb=@md.fnb @lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="../_sisu/image/sisu.png" alt="SiSU home"></a>} @doc_details =<<WOK @@ -288,7 +287,6 @@ WOK end end end - scr=%{<font size="1" color="#777777" face=times new roman><img border="0" height="15" width="15" src="../_sisu/image/b_doc.png" alt="Full Text">#{$ep[:hsp]}scroll:#{$ep[:hsp]}</font><font size="1" color="#222222" face=times new roman>doc##{$ep[:hsp]}</font> } seg='' @file_concordance << SiSU_EPUB_Concordance::Source::DocTitle.new(@particulars).create alph=%W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] @@ -311,7 +309,6 @@ WOK keyword=SiSU_EPUB_Concordance::Source::Word.new(word,@freq[word]).html if keyword !~ @rxp_excluded0 if @word_map[word][0] =~ /\d+/ - wm=[] @file_concordance << %{#{keyword}#{seg}#{@word_map[word].uniq.compact.join}} end @file_concordance << '</p>' diff --git a/lib/sisu/v5/epub_format.rb b/lib/sisu/v5/epub_format.rb index 75967653..2ac7a91a 100644 --- a/lib/sisu/v5/epub_format.rb +++ b/lib/sisu/v5/epub_format.rb @@ -1471,12 +1471,12 @@ output_epub_cont_seg.close author=if defined? @md.creator.author \ and @md.creator.author =~/\S+/ m='' - @md.creator.author_detail.each do |x| - surname=x[:the] \ - ? x[:the] + @md.creator.author_detail.each do |i| + surname=i[:the] \ + ? i[:the] : '' - other_names=x[:others] \ - ? ', ' + x[:others] + other_names=i[:others] \ + ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) @@ -1491,12 +1491,12 @@ output_epub_cont_seg.close editor=if defined? @md.creator.editor \ and @md.creator.editor =~/\S+/ m='' - @md.creator.editor_detail.each do |x| - surname=x[:the] \ - ? x[:the] + @md.creator.editor_detail.each do |i| + surname=i[:the] \ + ? i[:the] : '' - other_names=x[:others] \ - ? ', ' + x[:others] + other_names=i[:others] \ + ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) @@ -1511,12 +1511,12 @@ output_epub_cont_seg.close translator=if defined? @md.creator.translator \ and @md.creator.translator =~/\S+/ m='' - @md.creator.translator_detail.each do |x| - surname=x[:the] \ - ? x[:the] + @md.creator.translator_detail.each do |i| + surname=i[:the] \ + ? i[:the] : '' - other_names=x[:others] \ - ? ', ' + x[:others] + other_names=i[:others] \ + ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) @@ -1531,12 +1531,12 @@ output_epub_cont_seg.close illustrator=if defined? @md.creator.illustrator \ and @md.creator.illustrator =~/\S+/ m='' - @md.creator.illustrator_detail.each do |x| - surname=x[:the] \ - ? x[:the] + @md.creator.illustrator_detail.each do |i| + surname=i[:the] \ + ? i[:the] : '' - other_names=x[:others] \ - ? ', ' + x[:others] + other_names=i[:others] \ + ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) @@ -1607,7 +1607,7 @@ output_epub_cont_seg.close WOK end def manifest_cover_image_information(md) - cover_image=if defined? md.make.cover_image \ + if defined? md.make.cover_image \ and @md.make.cover_image.is_a?(Hash) \ and md.make.cover_image[:cover] =~/\S+/ <<-WOK @@ -1635,9 +1635,9 @@ output_epub_cont_seg.close end images=images.join('') images - end - def manifest_close - <<-WOK + end + def manifest_close + <<-WOK </manifest> WOK end @@ -1879,7 +1879,7 @@ output_epub_cont_seg.close @headname=((t_o.is==:heading and defined? t_o.name) ? t_o.name : nil) else if @md.opt.cmd =~/M/ - p __FILE__ +':'+ __LINE__.to_s + p __FILE__ << ':' << __LINE__.to_s p t_o.class p caller end @@ -1895,7 +1895,7 @@ output_epub_cont_seg.close if defined? dob.tags \ and dob.tags.length > 0 # insert tags "hypertargets" dob.tags.each do |t| - tags=tags +%{<a name="#{t}" />} + tags=tags << %{<a name="#{t}" />} end end tags @@ -1989,17 +1989,17 @@ output_epub_cont_seg.close } end def title_heading1 - id_u=DISABLE[:epub][:per_section_title] \ + DISABLE[:epub][:per_section_title] \ ? '' : title_heading('h1','tiny') end def title_heading2 - id_u=DISABLE[:epub][:per_section_title] \ + DISABLE[:epub][:per_section_title] \ ? '' : title_heading('h2','tiny') end def title_heading3 - id_u=DISABLE[:epub][:per_section_title] \ + DISABLE[:epub][:per_section_title] \ ? '' : title_heading('h3','tiny') end diff --git a/lib/sisu/v5/epub_segments.rb b/lib/sisu/v5/epub_segments.rb index 64bea759..ee85619d 100644 --- a/lib/sisu/v5/epub_segments.rb +++ b/lib/sisu/v5/epub_segments.rb @@ -153,7 +153,7 @@ WOK end protected def articles(data) - track,tracking,newfile=0,0,0 + tracking,newfile=0,0 @@is4=@@is3=@@is2=@@is1=0 printed_endnote_seg='n' idx_xhtml=nil @@ -167,14 +167,14 @@ WOK || dob.is==:heading_insert) \ and dob.ln==4 @@seg_name << dob.name - seg_name=dob.name + dob.name end end @@seg_name_xhtml=@@seg_name @@seg_total=@@seg_name.length testforartnum=@@seg_name_xhtml SiSU_Screen::Ansi.new(@md.opt.cmd,@@seg_name.length) if @md.opt.cmd =~/[MVv]/ - map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags + SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags data.each do |dob| #if defined? dob.obj \ #and dob.obj =~/href="#{Xx[:segment]}#+\S+?"/ @@ -220,7 +220,7 @@ WOK if not (dob.is==:heading \ || dob.is==:heading_insert) \ and dob.ln==1 - head1=$_ #; check + $_ #; check end end if @@is4==1 diff --git a/lib/sisu/v5/epub_tune.rb b/lib/sisu/v5/epub_tune.rb index c0005365..256ed323 100644 --- a/lib/sisu/v5/epub_tune.rb +++ b/lib/sisu/v5/epub_tune.rb @@ -131,7 +131,7 @@ module SiSU_EPUB_Tune data=SiSU_EPUB_Tune::Output.new(data,@md).hard_output SiSU_EPUB_Tune::Output.new(data,@md).marshal end - tuned=SiSU_EPUB_Tune::Tune.new(@data,@md).output + SiSU_EPUB_Tune::Tune.new(@data,@md).output rescue SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do __LINE__.to_s + ':' + __FILE__ diff --git a/lib/sisu/v5/git.rb b/lib/sisu/v5/git.rb index eb5a9b99..73cce507 100644 --- a/lib/sisu/v5/git.rb +++ b/lib/sisu/v5/git.rb @@ -75,7 +75,7 @@ module SiSU_Git end if @env.output_dir_structure.multilingual? m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst|ssm)$/ #watch added match for sss - fnn,fnb,fnt=@opt.fns[m,1],@opt.fns[m,2],@opt.fns[m,3] + fnb,fnt=@opt.fns[m,2],@opt.fns[m,3] else m=/(.+?)\.((?:-|ssm\.)?sst|ssm)$/ fnb=@fnn=@opt.fns[m,1] fnt=@opt.fns[m,2] @@ -189,7 +189,7 @@ module SiSU_Git end def locate_parse_file composite_src=@opt.fns=~/\.ssm$/ ? true : false - parse_file=if composite_src \ + if composite_src \ and @opt.cmd.inspect !~/m/ ##SiSU_Assemble::Composite.new(@opt).read #SiSU_DAL::Source.new(@opt).read # -m diff --git a/lib/sisu/v5/harvest_authors.rb b/lib/sisu/v5/harvest_authors.rb index 89a64fee..c20558df 100644 --- a/lib/sisu/v5/harvest_authors.rb +++ b/lib/sisu/v5/harvest_authors.rb @@ -155,9 +155,9 @@ module SiSU_HarvestAuthors end def construct_book_author_index idx_array=@idx_array - idx_array.each_pair do |lang,idx_array| + idx_array.each_pair do |lang,idx_arr| @@the_idx_authors[lang] ||= {} - idx_array.each do |idx| + idx_arr.each do |idx| idx[:author][:last_first_format_a].each do |author| author=author.strip if @@the_idx_authors[lang][author].is_a?(NilClass) @@ -237,18 +237,18 @@ module SiSU_HarvestAuthors end ln=SiSU_i18n::Languages.new.language.list harvest_languages='' - @the_idx.keys.each do |lng| + @the_idx.keys.each do |lg| if @env.output_dir_structure.by? == :language - harvest_pth="../../#{lng}/manifest" + harvest_pth="../../#{lg}/manifest" file="#{harvest_pth}/authors.html" elsif @env.output_dir_structure.by? == :filetype harvest_pth='.' - file="#{harvest_pth}/authors.#{lng}.html" + file="#{harvest_pth}/authors.#{lg}.html" elsif @env.output_dir_structure.by? == :filename harvest_pth='.' - file="#{harvest_pth}/authors.#{lng}.html" + file="#{harvest_pth}/authors.#{lg}.html" end - l=ln[lng][:t] + l=ln[lg][:t] harvest_languages += %{<a href="#{file}">#{l}</a> } end sv=SiSU_Env::InfoVersion.instance.get_version @@ -365,25 +365,23 @@ WOK end @output[lng][:html] << x works=[] - a[1][:md].each do |x| + a[1][:md].each do |i| manifest_at=if @env.output_dir_structure.by? == :language - manifest_pth="#{@env.path.output}/#{x[:file]}" - x[:file] + '.html' + i[:file] + '.html' elsif @env.output_dir_structure.by? == :filetype - manifest_name=x[:file] - x[:file] + '.' + lng + '.html' + i[:file] + '.' + lng + '.html' elsif @env.output_dir_structure.by? == :filename - "./#{x[:file]}/#{x[:page]}" + "./#{i[:file]}/#{i[:page]}" else '' #error end - work=[ "#{x[:date]} #{x[:title]}", %{<p class="publication">#{x[:date]} <a href="#{manifest_at}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>} ] + work=[ "#{i[:date]} #{i[:title]}", %{<p class="publication">#{i[:date]} <a href="#{manifest_at}">#{i[:title]}</a>, #{i[:author][:authors_s]}</p>} ] works<<=(@output[lng][:html_mnt].is_a?(File)) \ - ? (work.concat([%{<p class="publication">[<a href="#{x[:file]}.sst">src</a>] #{x[:date]} <a href="file://#{manifest_at}">#{x[:title]}</a>, #{x[:author][:authors_s]} -- [<a href="#{x[:file]}.sst">#{x[:file]}.sst</a>]</p>}])) + ? (work.concat([%{<p class="publication">[<a href="#{i[:file]}.sst">src</a>] #{i[:date]} <a href="file://#{manifest_at}">#{i[:title]}</a>, #{i[:author][:authors_s]} -- [<a href="#{i[:file]}.sst">#{i[:file]}.sst</a>]</p>}])) : work end - works.sort_by {|x| x[0]}.each do |x| - @output[lng][:html] << x[1] - @output[lng][:html_mnt] << x[2] if @output[lng][:html_mnt].is_a?(File) + works.sort_by {|y| y[0]}.each do |z| + @output[lng][:html] << z[1] + @output[lng][:html_mnt] << z[2] if @output[lng][:html_mnt].is_a?(File) end end end diff --git a/lib/sisu/v5/harvest_topics.rb b/lib/sisu/v5/harvest_topics.rb index 7375e191..d3189639 100644 --- a/lib/sisu/v5/harvest_topics.rb +++ b/lib/sisu/v5/harvest_topics.rb @@ -163,13 +163,13 @@ module SiSU_HarvestTopics end def song the_idx=construct_book_topic_keys - the_hash=construct_book_topic_hash(the_idx) + construct_book_topic_hash(the_idx) end def capital(txt) txt_a=txt.scan(/\S+/) tx='' - txt_a.each do |txt| - tx += txt[0].chr.capitalize + txt[1,txt.length] + ' ' + txt_a.each do |t| + tx += t[0].chr.capitalize + t[1,txt.length] + ' ' end tx.strip end @@ -186,7 +186,7 @@ module SiSU_HarvestTopics names += %{<a href="authors.#{lang}.html##{s}">#{n}</a>, } end end - md={ filename: idx[:filename], file: idx[:file], author: names, title: idx[:title], page: idx[:page] } + { filename: idx[:filename], file: idx[:file], author: names, title: idx[:title], page: idx[:page] } end def capital_(txt) txt[0].chr.capitalize + txt[1,txt.length] @@ -217,9 +217,9 @@ module SiSU_HarvestTopics idx_array=@idx_array @idx_a=[] @the_a=[] - idx_array.each_pair do |lang,idx_array| + idx_array.each_pair do |lang,idx_arr| @@the_idx_topics[lang] ||= {} - idx_array.each do |idx| + idx_arr.each do |idx| if idx[:rough_idx] idx_lst=idx[:rough_idx].scan(/[^:]+/) else @@ -281,11 +281,11 @@ module SiSU_HarvestTopics end end end - y=@the_a.sort_by { |x| x[0] } #; y.each {|z| puts z} + @the_a.sort_by { |x| x[0] } #; y.each {|z| puts z} end - def construct_book_topic_hash(y) + def construct_book_topic_hash(t) @the_h={} - y.each do |z| + t.each do |z| x=z[0].scan(/[^|]+/) depth=x.length extract=(depth-1) @@ -302,55 +302,55 @@ module SiSU_HarvestTopics { x[0] => z[1] } end if extract >= 0 - k.each_pair do |x0,y| + k.each_pair do |x0,y0| if extract == 0 @the_h[x0] ||={ md: [] } - @the_h[x0][:md] << y + @the_h[x0][:md] << y0 else @the_h[x0] ||={} end #puts ' '*0 + x0 if extract >= 1 - y.each_pair do |x1,y| + y0.each_pair do |x1,y1| if extract == 1 @the_h[x0][x1] ||={ md: [] } - @the_h[x0][x1][:md] << y + @the_h[x0][x1][:md] << y1 else @the_h[x0][x1] ||={} end #puts ' '*1 + x1 if extract >= 2 - y.each_pair do |x2,y| + y1.each_pair do |x2,y2| if extract == 2 @the_h[x0][x1][x2] ||={ md: [] } - @the_h[x0][x1][x2][:md] << y + @the_h[x0][x1][x2][:md] << y2 else @the_h[x0][x1][x2] ||={} end #puts ' '*2 + x2 if extract >= 3 - y.each_pair do |x3,y| + y2.each_pair do |x3,y3| if extract == 3 @the_h[x0][x1][x2][x3] ||={ md: [] } - @the_h[x0][x1][x2][x3][:md] << y + @the_h[x0][x1][x2][x3][:md] << y3 else @the_h[x0][x1][x2][x3] ||={} end #puts ' '*3 + x3 if extract == 4 - y.each_pair do |x4,y| + y3.each_pair do |x4,y4| if extract == 4 @the_h[x0][x1][x2][x3][x4] ||={ md: [] } - @the_h[x0][x1][x2][x3][x4][:md] << y + @the_h[x0][x1][x2][x3][x4][:md] << y4 else @the_h[x0][x1][x2][x3][x4] ||={} end #puts ' '*4 + x4 if extract == 5 - y.each_pair do |x5,y| + y4.each_pair do |x5,y5| if extract == 5 @the_h[x0][x1][x2][x3][x4][x5] ||={ md: [] } - @the_h[x0][x1][x2][x3][x4][x5][:md] << y + @the_h[x0][x1][x2][x3][x4][x5][:md] << y5 end #puts ' '*5 + x5 end @@ -370,22 +370,22 @@ module SiSU_HarvestTopics @the_h end def traverse_base - @the_h.each_pair do |x0,y| + @the_h.each_pair do |x0,y0| puts ' '*0 + x0 if x0.is_a?(String) - if y.is_a?(Hash) - y.each_pair do |x1,y| + if y0.is_a?(Hash) + y0.each_pair do |x1,y1| puts ' '*1 + x1 if x1.is_a?(String) - if y.is_a?(Hash) - y.each_pair do |x2,y| + if y1.is_a?(Hash) + y1.each_pair do |x2,y2| puts ' '*2 + x2 if x2.is_a?(String) - if y.is_a?(Hash) - y.each_pair do |x3,y| + if y2.is_a?(Hash) + y2.each_pair do |x3,y3| puts ' '*3 + x3 if x3.is_a?(String) - if y.is_a?(Hash) - y.each_pair do |x4,y| + if y3.is_a?(Hash) + y3.each_pair do |x4,y4| puts ' '*4 + x4 if x4.is_a?(String) - if y.is_a?(Hash) - y.each_pair do |x5,y| + if y4.is_a?(Hash) + y4.each_pair do |x5,y5| puts ' '*5 + x5 if x5.is_a?(String) end end @@ -400,37 +400,37 @@ module SiSU_HarvestTopics end end def traverse - @the_h.each_pair do |x0,y| + @the_h.each_pair do |x0,y0| puts ' '*0 + x0 if x0.is_a?(String) - if y.is_a?(Hash) - if y.has_key?(:md) - y[:md].each { |x| puts ' '*5 + x[:title] } + if y0.is_a?(Hash) + if y0.has_key?(:md) + y0[:md].each { |x| puts ' '*5 + x[:title] } end - y.each_pair do |x1,y| + y0.each_pair do |x1,y1| puts ' '*1 + x1 if x1.is_a?(String) - if y.is_a?(Hash) - if y.has_key?(:md) - y[:md].each { |x| puts ' '*5 + x[:title] } + if y1.is_a?(Hash) + if y1.has_key?(:md) + y1[:md].each { |x| puts ' '*5 + x[:title] } end - y.each_pair do |x2,y| + y1.each_pair do |x2,y2| puts ' '*2 + x2 if x2.is_a?(String) - if y.is_a?(Hash) - if y.has_key?(:md) - y[:md].each { |x| puts ' '*5 + x[:title] } + if y2.is_a?(Hash) + if y2.has_key?(:md) + y2[:md].each { |x| puts ' '*5 + x[:title] } end - y.each_pair do |x3,y| + y2.each_pair do |x3,y3| puts ' '*3 + x3 if x3.is_a?(String) - if y.is_a?(Hash) - if y.has_key?(:md) - y[:md].each { |x| puts ' '*5 + x[:title] } + if y3.is_a?(Hash) + if y3.has_key?(:md) + y3[:md].each { |x| puts ' '*5 + x[:title] } end - y.each_pair do |x4,y| + y3.each_pair do |x4,y4| puts ' '*4 + x4 if x4.is_a?(String) - if y.is_a?(Hash) - if y.has_key?(:md) - y[:md].each { |x| puts ' '*5 + x[:title] } + if y4.is_a?(Hash) + if y4.has_key?(:md) + y4[:md].each { |x| puts ' '*5 + x[:title] } end - y.each_pair do |x5,y| + y4.each_pair do |x5,y5| puts ' '*5 + x4 if x4.is_a?(String) end end @@ -497,68 +497,68 @@ module SiSU_HarvestTopics html_file_close end def html_body_traverse - @the_idx.each_pair do |x0,y| + @the_idx.each_pair do |x0,y0| lng=x0 if x0.is_a?(String) #do_string_name(lng,'lev0',x0) #puts ' '*0 + x0 end - if y.is_a?(Hash) - if y.has_key?(:md) - y[:md].each do |x| + if y0.is_a?(Hash) + if y0.has_key?(:md) + y0[:md].each do |x| #do_hash(lng,attrib,x) #lv==0 ? #puts ' '*5 + x[:title] end end - y.each_pair do |x1,y| + y0.each_pair do |x1,y1| if x1.is_a?(String) do_string_name(lng,'lev0',x1) #puts ' '*1 + x1 end - if y.is_a?(Hash) - if y.has_key?(:md) - y[:md].each do |x| + if y1.is_a?(Hash) + if y1.has_key?(:md) + y1[:md].each do |x| do_hash(lng,0,x) #puts ' '*5 + x[:title] end end - y.each_pair do |x2,y| + y1.each_pair do |x2,y2| if x2.is_a?(String) do_string(lng,'lev1',x2) #puts ' '*2 + x2 end - if y.is_a?(Hash) - if y.has_key?(:md) - y[:md].each do |x| + if y2.is_a?(Hash) + if y2.has_key?(:md) + y2[:md].each do |x| do_hash(lng,1,x) #puts ' '*5 + x[:title] end end - y.each_pair do |x3,y| + y2.each_pair do |x3,y3| if x3.is_a?(String) do_string(lng,'lev2',x3) #puts ' '*3 + x3 end - if y.is_a?(Hash) - if y.has_key?(:md) - y[:md].each do |x| + if y3.is_a?(Hash) + if y3.has_key?(:md) + y3[:md].each do |x| do_hash(lng,2,x) #puts ' '*5 + x[:title] end end - y.each_pair do |x4,y| + y3.each_pair do |x4,y4| if x4.is_a?(String) do_string(lng,'lev3',x4) #puts ' '*4 + x4 end - if y.is_a?(Hash) - if y.has_key?(:md) - y[:md].each do |x| + if y4.is_a?(Hash) + if y4.has_key?(:md) + y4[:md].each do |x| do_hash(lng,3,x) #puts ' '*5 + x[:title] end end - y.each_pair do |x5,y| + y4.each_pair do |x5,y5| if x5.is_a?(String) do_string(lng,'lev4',x5) #puts ' '*5 + x5 @@ -595,18 +595,18 @@ module SiSU_HarvestTopics end ln=SiSU_i18n::Languages.new.language.list harvest_languages='' - @the_idx.keys.each do |lng| + @the_idx.keys.each do |lg| if @env.output_dir_structure.by? == :language - harvest_pth="../../#{lng}/manifest" + harvest_pth="../../#{lg}/manifest" file="#{harvest_pth}/topics.html" elsif @env.output_dir_structure.by? == :filetype harvest_pth='.' - file="#{harvest_pth}/topics.#{lng}.html" + file="#{harvest_pth}/topics.#{lg}.html" elsif @env.output_dir_structure.by? == :filename harvest_pth='.' - file="#{harvest_pth}/topics.#{lng}.html" + file="#{harvest_pth}/topics.#{lg}.html" end - l=ln[lng][:t] + l=ln[lg][:t] harvest_languages += %{<a href="#{file}">#{l}</a> } end sv=SiSU_Env::InfoVersion.instance.get_version diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb index d3122670..ff4d149d 100644 --- a/lib/sisu/v5/html.rb +++ b/lib/sisu/v5/html.rb @@ -92,7 +92,6 @@ module SiSU_HTML @md=@particulars.md @fnb=@md.fnb @env=@particulars.env - loc=@env.url.output_tell primary_output_file=(@opt.act[:html_seg][:set]==:on) \ ? (@md.file.output_path.html_seg.dir + '/' + @md.file.base_filename.html_segtoc) : (@md.file.output_path.html_scroll.dir + '/' + @md.file.base_filename.html_scroll) @@ -200,7 +199,7 @@ module SiSU_HTML end def scroll @scr_endnotes=[] - format_head_scroll=SiSU_HTML_Format::HeadScroll.new(@md) + SiSU_HTML_Format::HeadScroll.new(@md) @data.each do |dob| pg=dob.dup unless pg.is ==:code @@ -328,7 +327,7 @@ WOK linkname,link=dob.obj.strip,dob.ocn if link \ and link !~/#/ #% keep eye on link - p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,link) + SiSU_HTML_Format::ParagraphNumber.new(@md,link) end title=if dob.obj !~/Metadata/ then linkname else @@ -345,10 +344,9 @@ WOK end toc[:seg_mini]=if dob.name =~/^meta/ \ and dob.obj =~/Document Information/ - x=if @md.concord_make - format_toc.mini_concord_tail - else format_toc.mini_tail - end + @md.concord_make \ + ? format_toc.mini_concord_tail + : format_toc.mini_tail else format_toc.mini_lev1 end title=if dob.ocn ==0 @@ -586,7 +584,7 @@ WOK if defined? @md.prefix_b toc_shared << prefix_b end - scr_toc=if @make.build.toc? #Table of Contents added/appended here + if @make.build.toc? #Table of Contents added/appended here toc_shared << @toc[:scr] end @segtoc << @links_guide_toc diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb index 3c8bc465..aee090cd 100644 --- a/lib/sisu/v5/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -187,7 +187,7 @@ module SiSU_HTML_Format else @md.file.output_path.html_seg.rel_image end - dir=SiSU_Env::FileOp.new(@md) + SiSU_Env::FileOp.new(@md) button +=%{ <p class="tiny_left"><a href="#{@md.make.home_button_image[:link]}" target="_top"><img border="0" src="#{image_path}/#{@md.make.home_button_image[:home_button]}" width="#{@md.make.home_button_image[:w]}" height="#{@md.make.home_button_image[:h]}" alt="home icon -->" /></a></p>\n} elsif @md.home_button_links.is_a?(Array) @md.home_button_links.each do |links| @@ -221,7 +221,7 @@ module SiSU_HTML_Format end def scroll(text) if @md.fns =~ /\.(?:-|ssm\.)?sst$/ - scroll=%{<td align="center" bgcolor=#{@vz.color_band2}> + %{<td align="center" bgcolor=#{@vz.color_band2}> <a href="#{Xx[:html_relative1]}html/#{@file.base_filename.html_scroll}" target="_top"> #{text} </a> @@ -301,7 +301,7 @@ module SiSU_HTML_Format end def scroll_head_navigation_band if @make.build.html_top_band? - search_and_manifest=<<WOK + <<WOK <td align="center" width="60%"> #{make_scroll_search_form_and_manifest_link} </td> @@ -380,7 +380,7 @@ WOK end def make_scroll_search_form_and_manifest_link wgt=SiSU_HTML_Format::Widget.new(@md) - scroll=%{<td align="center" bgcolor=#{@vz.color_band2}> + %{<td align="center" bgcolor=#{@vz.color_band2}> #{@vz.nav_txt_doc_link} </td> } @@ -391,7 +391,7 @@ WOK </tr></table>} end def make_scroll_seg_pdf - manifest=scroll=seg='' + seg='' wgt=SiSU_HTML_Format::Widget.new(@md) seg=%{<td align="center" bgcolor=#{@vz.color_band2}> #{@vz.nav_txt_toc_link} @@ -405,7 +405,6 @@ WOK </tr></table>} end def make_concordance - manifest=scroll=seg='' wgt=SiSU_HTML_Format::Widget.new(@md) %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0"> <tr> @@ -732,7 +731,6 @@ WOK #{@vz.table_close}} end def toc_next2 - pre,nxt=false,true toc_nav(false,true).dup end def toc_pre_next2 @@ -931,7 +929,7 @@ WOK if defined? dob.tags \ and dob.tags.length > 0 # insert tags "hypertargets" dob.tags.each do |t| - tags=tags +%{<named id="#{t}" />} + tags=tags << %{<named id="#{t}" />} end end tags @@ -941,7 +939,7 @@ WOK if defined? dob.tags \ and dob.tags.length > 0 # insert tags "hypertargets" dob.tags.each do |t| - tags=tags +%{<a name="#{t}" ></a>} + tags=tags << %{<a name="#{t}" ></a>} end end tags diff --git a/lib/sisu/v5/html_minitoc.rb b/lib/sisu/v5/html_minitoc.rb index bd9835dd..99f11d87 100644 --- a/lib/sisu/v5/html_minitoc.rb +++ b/lib/sisu/v5/html_minitoc.rb @@ -122,7 +122,6 @@ link='metadata' %{<b><a href="#{link}#{@md.lang_code_insert}#{Sfx[:html]}">#{txt.obj}</a></b>} end - toc={} txt_obj={ txt: title } format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) toc_mini=if txt.name =~/^meta/ and txt.obj=~/Document Information/ @@ -176,8 +175,7 @@ && txt.ocn !=0 txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1') end - toc={} - lnk_n_txt=%{ <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:html]}##{txt.ocn}"> + lnk_n_txt=%{ <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:html]}##{txt.ocn}"> #{txt.obj} </a>} txt_obj={ txt: lnk_n_txt } @@ -192,8 +190,7 @@ && txt.ocn !=0 txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1') end - toc={} - lnk_n_txt=%{ <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:html]}##{txt.ocn}"> + lnk_n_txt=%{ <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:html]}##{txt.ocn}"> #{txt.obj} </a>} txt_obj={ txt: lnk_n_txt } diff --git a/lib/sisu/v5/html_promo.rb b/lib/sisu/v5/html_promo.rb index a76a15fa..cd57e5fd 100644 --- a/lib/sisu/v5/html_promo.rb +++ b/lib/sisu/v5/html_promo.rb @@ -175,7 +175,7 @@ module SiSU_HTML_Promo @rc['search']['sisu']['action'] else nil end - form=if action \ + if action \ and db @env.widget.search_form('sisusearch',action,db,table) else '' @@ -275,36 +275,34 @@ module SiSU_HTML_Promo end def site_link #Work area if url_link.url - <<WOK + <<-WOK <p class="pane"> #{url_link.url} #{image} #{title} #{subtitle} </a>#{nick}</p> -WOK + WOK else - <<WOK + <<-WOK <p class="pane"> #{image} #{title} #{subtitle} </p> -WOK + WOK end end self end def output_form_sponsor(type,id) cell=cell(@ad[:promo][type][id],prod_id) - prod_type=((id=~/id_(?:[0-9x]){10,13}/i) ? 'isbn' : 'id') - id_detail=%{<p class="pane">#{prod_type}: #{prod_id}</p>} - <<WOK + <<-WOK <br /> #{cell.site_link} #{cell.blurb} #{cell.links} -WOK + WOK end def output_form_link(type,id) prod_id=id.gsub(/id_/,'') @@ -404,7 +402,6 @@ WOK @ad[:promo_list][category][type].each do |i| if i id=((i.inspect =~/^\d/) ? "id_#{i.to_s.strip}" : i.to_s.strip) #watch remove .to_s ? - gbp=usd=euro=nil if defined? @ad[:promo][type][id] \ and not @ad[:promo][type][id].nil? adverts << output_form_select(type,id) diff --git a/lib/sisu/v5/html_scroll.rb b/lib/sisu/v5/html_scroll.rb index fa183f46..a79de81b 100644 --- a/lib/sisu/v5/html_scroll.rb +++ b/lib/sisu/v5/html_scroll.rb @@ -156,8 +156,8 @@ module SiSU_HTML_Scroll and dob.obj=='Index' 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.gsub!(/<a href="\S+?\.html#(\d+)">(\1(?:-\d+)?)<\/a>/, + book_idx.each do |y| #takes book index prepared for segments & strips segment identifying info + y.gsub!(/<a href="\S+?\.html#(\d+)">(\1(?:-\d+)?)<\/a>/, '<a href="#\1">\2</a>') end book_idx.join("\n") diff --git a/lib/sisu/v5/html_segments.rb b/lib/sisu/v5/html_segments.rb index 9efa2067..54292175 100644 --- a/lib/sisu/v5/html_segments.rb +++ b/lib/sisu/v5/html_segments.rb @@ -185,7 +185,7 @@ module SiSU_HTML_Seg end protected def articles(data) - track,tracking,newfile=0,0,0 + tracking,newfile=0,0 @@is4=@@is3=@@is2=@@is1=0 printed_endnote_seg='n' idx_html=nil @@ -200,7 +200,7 @@ module SiSU_HTML_Seg || dob.is == :heading_insert) \ && dob.ln == 4 @@seg_name << dob.name - seg_name=dob.name + dob.name end end @@seg_name_html=@@seg_name @@ -257,7 +257,7 @@ module SiSU_HTML_Seg if not (dob.is==:heading \ || dob.is==:heading_insert) \ && dob.ln==1 - head1=$_ #; check + $_ #; check end end if @@is4==1 @@ -268,8 +268,6 @@ module SiSU_HTML_Seg || dob.is==:heading_insert) \ && dob.ln==4 if tracking != 0 - dirout=SiSU_Env::InfoEnv.new(@md.fns) - dir_sisu=dirout.path.output @file=SiSU_Env::FileOp.new(@md) unless FileTest.directory?(@file.output_path.html_seg.dir) FileUtils::mkdir_p(@file.output_path.html_seg.dir) if File.writable?("#{@file.output_path.base.dir}/.") @@ -426,7 +424,7 @@ module SiSU_HTML_Seg end def markup(dob) @debug=[] - format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md) + SiSU_HTML_Format::HeadSeg.new(@md) if dob.is !=:meta if dob.is==:heading \ || dob.is==:heading_insert \ @@ -439,7 +437,7 @@ module SiSU_HTML_Seg || dob.is==:para dob_html=if dob.is==:heading \ || dob.is==:heading_insert - x=if dob.ln==4 + if dob.ln==4 sto.seg_heading4 elsif dob.ln==5 sto.seg_heading5 diff --git a/lib/sisu/v5/html_tune.rb b/lib/sisu/v5/html_tune.rb index 9f81e8cd..5d7e9beb 100644 --- a/lib/sisu/v5/html_tune.rb +++ b/lib/sisu/v5/html_tune.rb @@ -129,10 +129,10 @@ module SiSU_HTML_Tune songsheet_array(@data) #data=songsheet_array(@data) if @md.opt.cmd =~/M/ #Hard Output Tune Optional on/off here - data=SiSU_HTML_Tune::Output.new(@data,@md).hard_output + SiSU_HTML_Tune::Output.new(@data,@md).hard_output SiSU_HTML_Tune::Output.new(@data,@md).marshal end - tuned=SiSU_HTML_Tune::Tune.new(@data,@md).output + SiSU_HTML_Tune::Tune.new(@data,@md).output rescue SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do __LINE__.to_s + ':' + __FILE__ diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index 50ad39c3..8b146d4b 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -76,7 +76,6 @@ module SiSU def initialize(argv) pwd_the=Dir.pwd begin #% select what to do - home=ENV['HOME'] opt=SiSU_Commandline::Options.new(argv) SiSU::Processing.new(opt).actions rescue @@ -140,7 +139,6 @@ module SiSU end end def manifest_on_files_translated - r=Px[:lng_lst_rgx] number_of_files={} @opt.files.each_with_index do |fns,i| fn=fns.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') @@ -514,7 +512,7 @@ module SiSU end def do_initialization @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX - flag=SiSU_Env::InfoProcessingFlag.new + SiSU_Env::InfoProcessingFlag.new if @opt.act[:version_info][:set]==:on #% version information SiSU_Env::InfoAbout.new(@opt).sisu_version end @@ -573,7 +571,6 @@ module SiSU if @opt.act[:dal][:set]==:on @retry_count= -1 begin - path_image='./_sisu/processing/external_document/image' @get_s,@get_p,@get_pl=[],[],[] re_s=/(\S+?\.-sst)$/ re_p3=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.txz|sisupod(?:\.txz)?|\.ssp))/ @@ -700,7 +697,7 @@ module SiSU puts SiSU_Markup::MarkupHistory.new(@opt).query elsif @opt.mod.inspect =~/--identify/ require_relative 'sst_identify_markup' # sst_identify_markup.rb - markup_version=SiSU_Markup::MarkupIdentify.new(@opt).markup_version? + SiSU_Markup::MarkupIdentify.new(@opt).markup_version? elsif @opt.mod.inspect =~/--sitemaps/ #% sitemaps require_relative 'sitemaps' # sitemaps.rb SiSU_Sitemaps::Source.new(@opt).read diff --git a/lib/sisu/v5/manifest.rb b/lib/sisu/v5/manifest.rb index 75d8233d..10cca358 100644 --- a/lib/sisu/v5/manifest.rb +++ b/lib/sisu/v5/manifest.rb @@ -139,7 +139,7 @@ module SiSU_Manifest def url_make(url,file,src=nil) if @o_str.dump_or_redirect? '' - elsif :src + elsif src==:src #check %{<br />#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}} else %{<p class="tiny">#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}</p>} @@ -208,14 +208,13 @@ module SiSU_Manifest @m << { mu: mu, l: lng, rel: mr } end end - manifests @m=@m.uniq end def languages(id,file) flv=published_manifests? @manifest[:html] << %{<tr><th class="left"><div id="horizontal_links"><ul id="horizontal">\n} flv.each do |l| - lang=SiSU_Translate::Source.new(@md,@language,l[:n]).language_list + SiSU_Translate::Source.new(@md,@language,l[:n]).language_list @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n" @manifest[:html] << %{<li class="norm"><a href="#{l[:rel]}">#{l[:l]}</a> </li>} end @@ -651,7 +650,7 @@ WOK if st.is_a?(Array) st.each do |v| if v.is_a?(Array) - v.each do |w,i| + v.each do |w| @manifest[:html] << %{<p class="it#{i}">#{w}</p>\n} end else @@ -787,11 +786,7 @@ WOK begin make=SiSU_Env::ProcessingSettings.new(@md) minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,data).songsheet.join("\n") - id,file='','' vz=SiSU_Viz::Defaults.new - search_form=(make.build.search_form?) \ - ? "<td>#{@env.widget_static.search_form}</td>" - : '' format_head_toc=SiSU_HTML_Format::HeadToc.new(@md) @manifest[:html] <<<<WOK <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" diff --git a/lib/sisu/v5/manpage.rb b/lib/sisu/v5/manpage.rb index 0873e3f3..62aa9456 100644 --- a/lib/sisu/v5/manpage.rb +++ b/lib/sisu/v5/manpage.rb @@ -70,7 +70,6 @@ module SiSU_Manpage include SiSU_ManpageFormat require_relative 'shared_metadata' # shared_metadata.rb require_relative 'shared_txt' # shared_txt.rb - pwd=Dir.pwd @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' class Source @@ -86,7 +85,6 @@ module SiSU_Manpage begin @md=SiSU_Param::Parameters.new(@opt).get @env=SiSU_Env::InfoEnv.new(@opt.fns) - path=@env.path.output_tell tool=(@opt.cmd =~/[MVv]/) \ ? "#{@env.program.text_editor} #{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" @@ -170,14 +168,6 @@ GSUB @manpage[:metadata]=SiSU_Metadata::Summary.new(@md).manpage.metadata end def manpage_tail - vz=SiSU_Viz::Defaults.new - generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] - lastdone="Last Generated on: #{Time.now}" - rubyv="Ruby version: #{@md.ruby_version}" - sc=if @md.sc_info - "Source file: #{@md.sc_filename}#{@br}Version number: #{@md.sc_number}#{@br}Version date: #{@md.sc_date}#{@br}" - else '' - end @manpage[:tail] <<<<WOK #{@br} .TP @@ -206,8 +196,7 @@ WOK def manpage_structure(dob='',hname='') #% Used to extract the structure of a document if dob.is==:heading lv=dob.ln - n=dob.ln - 1 - n3=dob.ln + 2 + dob.ln + 2 else lv=nil end wrapped=if dob.is==:para \ @@ -260,13 +249,12 @@ WOK @@endnotes[:para]=[] end def markup(data) # Used for major markup instructions - dir=SiSU_Env::InfoEnv.new(@md.fns) + SiSU_Env::InfoEnv.new(@md.fns) @data_mod,@endnotes,@level,@cont,@copen,@manpage_contents_close=Array.new(6){[]} (0..6).each { |x| @cont[x]=@level[x]=false } (4..6).each { |x| @manpage_contents_close[x]='' } #manpage_tail # stop call table_message='[table omitted, see other document formats]' - fix=[] #manpage_metadata data.each do |dob| if dob.is==:comment \ @@ -325,8 +313,6 @@ WOK gsub(/\A(.+?)\s*\Z/m,".nf\n\\1\n.fi") end dob.obj=dob.obj.gsub(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/m,"\n\n") # watch - blit=dob.obj.scan(/\[[^\]]+\]|[^\[]+/) - blit_array=[] dob.obj=dob.obj.gsub(/#{Mx[:gl_o]}:name#\S+?#{Mx[:gl_c]}/mi,''). #added gsub(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}|#{Mx[:br_page_line]}/,''). # remove page breaks, you may wish to have a line across the page break instead gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1\2'). @@ -336,7 +322,6 @@ WOK gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]") gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]") gsub(/^(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]') - wordlist=dob.obj.scan(/\S+/) if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ if dob.obj =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change paranum=dob.obj[@regx,3] @@ -380,7 +365,6 @@ WOK @manpage end def publish(manpage) - divider='=' content=[] date=if defined? @md.date.modified \ and @md.date.modified @@ -390,8 +374,6 @@ WOK @md.date.published else SiSU_Env::InfoDate.new.year #date missing decide on action end - manpage_name,manpage_synopsis='','' - manpg={} proj=SiSU_Env::InfoVersion.instance.get_version manpage[:open] = %{.TH "#{@md.fnb}" "#{@md.make.manpage['section']}" "#{date}" "#{proj[:version]}" "#{@md.title.main}"#{@md.make.manpage['name']}#{@md.make.manpage['synopsis']}} content << manpage[:open] diff --git a/lib/sisu/v5/odf.rb b/lib/sisu/v5/odf.rb index 671cc350..281bd7a4 100644 --- a/lib/sisu/v5/odf.rb +++ b/lib/sisu/v5/odf.rb @@ -164,22 +164,13 @@ module SiSU_ODF @@odf[:metadata]=SiSU_Metadata::Summary.new(@md).odf.metadata end def odf_tail - generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] - lastdone="Last Generated on: #{Time.now}" - rubyv="Ruby version: #{@md.ruby_version}" - sc=if @md.sc_info - "Source file: #{@md.sc_filename}\nVersion number: #{@md.sc_number}\nVersion date: #{@md.sc_date}\n" - else '' - end - url=@md.fnb - fn=@md.file.base_filename.manifest manifest="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}" @@odf[:tail] << %{<text:p text:style-name="P_normal">Available document outputs: <br /> <<text:a xlink:type="simple" xlink:href="#{manifest}">#{manifest}</text:a>></text:p>} @@odf[:tail] << %{\n<text:p text:style-name="P_normal">SiSU: <<text:a xlink:type="simple" xlink:href="http://www.jus.uio.no/lm">www.jus.uio.no/sisu</text:a>> and <<text:a xlink:type="simple" xlink:href="http://www.sisudoc.org">www.sisudoc.org</text:a>></text:p>} @@odf[:tail] << "\n</office:text></office:body></office:document-content>" end def set_bookmark_tag(dob) - tags=SiSU_ODF_Format::Tags.new.set_bookmark_tag(dob) + SiSU_ODF_Format::Tags.new.set_bookmark_tag(dob) end def heading(dob,p_num) m=/#{$1}/ @@ -205,7 +196,6 @@ module SiSU_ODF dob end def toc(dob,p_num) - m=/#{$1}/ hardspace=(dob.lv =~/[A-C]/i) \ ? '<text:p text:style-name="Standard"/>' : '' @@ -216,7 +206,7 @@ module SiSU_ODF dob end def image_src(i) - image_source=if @md.fns =~/\.ss[tm]$/ \ + if @md.fns =~/\.ss[tm]$/ \ and FileTest.file?("#{@env.path.image_source_include}/#{i}") #review @env.path.image_source_include elsif @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/ @@ -245,7 +235,7 @@ module SiSU_ODF def image_odf(img) # copy image to od image directory (unless exists) # divide pixel dimension by 37.79485 and retain 3 decimal places - m,u=img[1],img[2] + m=img[1] i=/^(\S+?\.(?:png|jpg|gif))/.match(m).captures.join if m =~/^(\S+?\.(?:png|jpg|gif))/ c=/^\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"/.match(m).captures.join if m =~/^\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"/ w,h=/\s(\d+)x(\d+)/.match(m).captures if m =~/\s\d+x\d+/ @@ -254,7 +244,6 @@ module SiSU_ODF h=/([0-9]+\.\d{0,3})/.match(h).captures.join w=/([0-9]+\.\d{0,3})/.match(w).captures.join image_source=image_src(i) - pwd=Dir.pwd if image_source if FileTest.file?("#{image_source}/#{i}") FileUtils::cp("#{image_source}/#{i}","#{@env.processing_path.odt}/Pictures/#{i}") @@ -315,7 +304,7 @@ module SiSU_ODF t end def text_link_odf_bookmark(txt,url,trail) - map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map + SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map %{<text:bookmark-ref text:reference-format="text" text:ref-name="#{url}">#{txt.strip}</text:bookmark-ref>#{trail}} end def text_link(dob) @@ -582,7 +571,7 @@ module SiSU_ODF wordlist end def markup(data) # Used for major markup instructions - safe_characters=/[^a-zA-Z0-9}{\/?,."';:)(><\-_&!@%~#\]\[*=$| \n+`#{Mx[:tc_p]}]/u + #safe_characters=/[^a-zA-Z0-9}{\/?,."';:)(><\-_&!@%~#\]\[*=$| \n+`#{Mx[:tc_p]}]/u dir=SiSU_Env::InfoEnv.new(@md.fns) dir.path.odt_bld @data_mod,@endnotes,@level,@cont,@copen,@odf_contents_close=Array.new(6){[]} @@ -590,7 +579,6 @@ module SiSU_ODF (0..6).each { |x| @cont[x]=@level[x]=false } (4..6).each { |x| @odf_contents_close[x]='' } odf_tail #($1,$2) - fix=[] bullet=image_src('bullet_09.png') if bullet if FileTest.file?("#{bullet}/bullet_09.png") @@ -726,13 +714,6 @@ WOK x else '' end - breakpage=if @md.pagenew \ - or @md.pagebreak - ' fo:break-before="page"' - elsif @md.pageline ##fix - '' - else '' - end x=<<WOK <?xml version="1.0" encoding="UTF-8"?> <office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2"><office:scripts/> @@ -753,10 +734,8 @@ WOK def post end def publish - divider='=' content=[] br_pg='<text:p text:style-name="P_normal_page_new"> </text:p>' - data=@data content << @@odf[:head] << @@odf[:toc] << diff --git a/lib/sisu/v5/odf_format.rb b/lib/sisu/v5/odf_format.rb index 8abff36f..018fba83 100644 --- a/lib/sisu/v5/odf_format.rb +++ b/lib/sisu/v5/odf_format.rb @@ -70,12 +70,12 @@ module SiSU_ODF_Format def set_ref_and_display set_ref=@paranum.gsub(/(\d+)/,' <text:span text:style-name="Span_subscript"><text:reference-mark-start text:name="\1"/><text:reference-mark-end text:name="\1"/></text:span>') disp=@paranum.gsub(/(\d+)/,' <text:span text:style-name="Span_subscript">[\1]</text:span>') - ocn={ display: disp, set_ref: set_ref } + { display: disp, set_ref: set_ref } end def set_bookmark_and_display set_ref=@paranum.gsub(/(\d+)/,' <text:span text:style-name="Span_subscript"><text:bookmark-start text:name="\1"/><text:bookmark-end text:name="\1"/></text:span>') disp=@paranum.gsub(/(\d+)/,' <text:span text:style-name="Span_subscript">[\1]</text:span>') - ocn={ display: disp, set_ref: set_ref } + { display: disp, set_ref: set_ref } end def name @paranum.gsub(/(\d+)/,'<a name="\1"></a>') @@ -225,7 +225,7 @@ module SiSU_ODF_Format end %{<table:table-row>#{@br}} + %{<table:table-cell office:value-type="string">#{@br}} + - %{<text:p text:style-name="#{txt_name_row}">#{@br}} + %{<text:p text:style-name="#{txt_name_row}">#{@br}} + %{#{str}} + %{</text:p>#{@br}} + %{</table:table-cell>#{@br}} + diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index 2133a812..b7bf98a6 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -159,7 +159,6 @@ module SiSU_Commandline end def find_all(find_flag,opt) if find_flag - pwd_set=Dir.pwd x=Dir.glob('*.ss[tm]') Px[:lng_lst].each do |d| if FileTest.directory?(d) @@ -172,7 +171,6 @@ module SiSU_Commandline end def find_select(find_flag,opt) if find_flag - pwd_set=Dir.pwd x=[] if opt.inspect =~/"[a-zA-Z][a-zA-Z0-9._-]+?"/ opt.each do |g| @@ -221,7 +219,7 @@ module SiSU_Commandline end r=Px[:lng_lst_rgx].gsub(/\|#{@lng_base}\|/,'|') @lang_regx=%r{(?:#{r})} - z=if find_flag + if find_flag (f.length > 0) \ ? (b + find_select(find_flag,f)) : find_all(find_flag,b) @@ -270,9 +268,7 @@ module SiSU_Commandline SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown end end -# @files=@files.uniq @@act ? @act=@@act : @@act=@act=opt_act - @files self end def sisu_document_make_pod @@ -283,7 +279,7 @@ module SiSU_Commandline "#{pod_make_path}/#{makefile_name}" end def makefile_read(pod_make_path) - f=if FileTest.file?(makefile(pod_make_path)) + if FileTest.file?(makefile(pod_make_path)) sisu_doc_makefile=IO.read(makefile(pod_make_path), mode: 'r:utf-8') sisu_doc_makefile.split(/\s*\n\s*\n/m) else nil @@ -293,7 +289,7 @@ module SiSU_Commandline end def set_files_and_paths_and_general_extract(s) c,w='','' - m,f,pth,z,lng,lngs=[],[],[],[],[],[] + m,f,pth,lng,lngs=[],[],[],[],[] lng_is='' a=s.split(/\s+/) r_l=Px[:lng_lst].join('|') @@ -316,11 +312,9 @@ module SiSU_Commandline pt=Pathname.new(fullname) FileUtils::mkdir_p(pt.to_s) pod_make_path=fullname + '/sisupod/doc/_sisu' - pod_make_path_file=pod_make_path make_instruct_array=sisu_document_make_pod.makefile_read(pod_make_path) @make_instructions_pod=HeaderCommon.new(make_instruct_array).sisu_document_make_instructions Dir.chdir(pt.realpath) - options=s.gsub(/(\s+--?\S+)+.+/,'\1') system(" chdir #{fullname} tar xaf #{pwd}/#{x} @@ -470,38 +464,37 @@ module SiSU_Commandline cmd,mod,files=@cmd,@mod,@files if not m.empty? \ and m.inspect =~/"--pdf-/ - ps,psa='',[] - mod << '--pdf' - m.each do |m| - if m =~ /^--pdf-(?:(?:l|landscape)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:l|landscape))$/ - mod << '--landscape' - end - if m =~ /^--pdf-(?:(?:p|portrait)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:p|portrait))$/ - mod << '--portrait' - end - if m =~ /^--pdf(?:-(?:a4|letter|a5|b5|legal)(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))(?:-(?:a4|letter|a5|b5|legal)))$/ - if m =~ /^--pdf(?:-a4(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a4)$/ - mod << '--papersize-a4' - end - if m =~ /^--pdf(?:-a5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a5)$/ - mod << '--papersize-a5' - end - if m =~ /^--pdf(?:-b5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-b5)$/ - mod << '--papersize-b5' - end - if m =~ /^--pdf(?:-letter(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-letter)$/ - mod << '--papersize-letter' - end - if m =~ /^--pdf(?:-legal(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-legal)$/ - mod << '--papersize-legal' - end - end - end - mod=mod.uniq + mod << '--pdf' + m.each do |s| + if s =~ /^--pdf-(?:(?:l|landscape)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:l|landscape))$/ + mod << '--landscape' + end + if s =~ /^--pdf-(?:(?:p|portrait)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:p|portrait))$/ + mod << '--portrait' + end + if s =~ /^--pdf(?:-(?:a4|letter|a5|b5|legal)(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))(?:-(?:a4|letter|a5|b5|legal)))$/ + if s =~ /^--pdf(?:-a4(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a4)$/ + mod << '--papersize-a4' + end + if s =~ /^--pdf(?:-a5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a5)$/ + mod << '--papersize-a5' + end + if s =~ /^--pdf(?:-b5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-b5)$/ + mod << '--papersize-b5' + end + if s =~ /^--pdf(?:-letter(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-letter)$/ + mod << '--papersize-letter' + end + if s =~ /^--pdf(?:-legal(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-legal)$/ + mod << '--papersize-legal' + end + end + end + mod=mod.uniq end unless m.empty? - m.each do |m| - case m + m.each do |s| + case s when /^--(?:color-toggle)$/; c=c+'c' when /^--(?:color-off)$/; c=c+'k' when /^--(?:conf|config|configure|init|initialize|init-site)$/; c=c+'CC' @@ -509,7 +502,7 @@ module SiSU_Commandline when /^--(?:txt|text|plaintext)$/; c=c+'t' when /^--(?:html)$/; c=c+'h' when /^--(?:html-scroll|html-seg)$/; c=c+'H' - mod << m + mod << s when /^--(?:epub)$/; c=c+'e' when /^--(?:od[ft])$/; c=c+'o' when /^--(?:pdf)$/; c=c+'p' @@ -547,7 +540,7 @@ module SiSU_Commandline when /^--(?:verbose(?:[=-]1)?)$/; c=c+'v' when /^--(?:version)$/; c=c+'v' when /^--(?:verbose[=-]0|quiet|silent)$/; c=c+'q' - else mod << m #mod only contains command modifiers; commands converted to character + else mod << s #mod only contains command modifiers; commands converted to character end end end @@ -578,7 +571,7 @@ module SiSU_Commandline end end if cmd !~/y/ - extra+=if cmd =~/[abeHhIiNopQsSstwXxz]/ \ + extra+=if cmd =~/[abeHhIiNopQSstwXxz]/ \ and cmd !~/y/ 'ym' #% add manifest elsif (cmd =~/[Dd]/ \ diff --git a/lib/sisu/v5/param.rb b/lib/sisu/v5/param.rb index a78e9fbd..18e9721e 100644 --- a/lib/sisu/v5/param.rb +++ b/lib/sisu/v5/param.rb @@ -116,7 +116,6 @@ module SiSU_Param else param_msg='Parameters extracted' fns_array=@env.read_source_file(@opt.fns) - md=SiSU_Param::Parameters::Instructions.new(fns_array,@opt) @md=SiSU_Param::Parameters::Instructions.new(fns_array,@opt).extract @md end @@ -947,7 +946,6 @@ module SiSU_Param @fnstex=@fns.gsub(/_/,'\_\-').gsub(/\./,'.\-') @flag_endnotes,@flag_auto_endnotes,@flag_separate_endnotes=false,false,false @flag_separate_endnotes_make=true - regx_date=/^\d{4}(?:-(?:[0][0-9]|1[0-2])(-(?:[0-2][0-9]|3[01]))?)?$/ ver=SiSU_Env::InfoVersion.instance @sisu_version=ver.get_version @ruby_version=ver.rbversion @@ -980,11 +978,11 @@ module SiSU_Param when /^@publisher:\s+(.+)/m #% * header metadata - publisher @publisher=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).current_publisher @current_publisher=@publisher - when /^@rights:(.+)/m; #% * header metadata - rights + when /^@rights:(.+)/m #% * header metadata - rights @rights=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).rights - when /^@classify:(.+)/m; classify=$1 #% * header metadata - classify + when /^@classify:(.+)/m #% * header metadata - classify @classify=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).classify - when /^@identifier:(.+)/m; identify=$1 #% * header metadata - identifier + when /^@identifier:(.+)/m #% * header metadata - identifier @identifier=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).identifier when /^@original:(.+)/m #% * header metadata - original (document) @original=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).original @@ -1218,9 +1216,9 @@ module SiSU_Param u.each do |l| v << l.scan(/[^:]+/m) end - v.each do |m| - m[-1]=m[-1].scan(/[^|]+/m) if m[-1] =~/[|]/m - @topic_register_array << m + v.each do |s| + s[-1]=s[-1].scan(/[^|]+/m) if s[-1] =~/[|]/m + @topic_register_array << s end @topic_register_array end diff --git a/lib/sisu/v5/param_identify_markup.rb b/lib/sisu/v5/param_identify_markup.rb index 148c73d5..94d28ab8 100644 --- a/lib/sisu/v5/param_identify_markup.rb +++ b/lib/sisu/v5/param_identify_markup.rb @@ -81,11 +81,6 @@ module SiSU_MarkupType end @flag_2_0,@flag_66,@flag_57,@flag_38=false,false,false,false @cont.each_with_index do |y,i| - if y =~/^(?:0\{?~links?|@links?:)\s/ - links=unless y =~/\{.+?\}\S+/; oldlinks=' (pre 0.20.4 header links)' - else ' (post 0.20.4 header links)' - end - end if y =~/^@make:|^@classify|^\s\s?:\S+?:\s+\S/ version=2.0.to_f @version[:determined]=version diff --git a/lib/sisu/v5/param_make.rb b/lib/sisu/v5/param_make.rb index 24a4dbb7..ba89c7b3 100644 --- a/lib/sisu/v5/param_make.rb +++ b/lib/sisu/v5/param_make.rb @@ -176,7 +176,7 @@ module SiSU_Param_Make { page_new: page_new, page_break: page_break, page_line: page_line } end def language - l=if @h['language'] && (@h['language']=~/\S{2,}/) + if @h['language'] && (@h['language']=~/\S{2,}/) ((@h['language'] =~/,/) \ ? (@h['language'].split(/,\s*/)) : [ @h['language'] ]) @@ -186,7 +186,7 @@ module SiSU_Param_Make def bold m=@h['bold'] i=(m=~/\/i$/)? 'i' : '' - z=if m + if m x=m.gsub(/^\/(.+?)\/i?/,'\1'). gsub(/\((?:\?:)?/,'(?:') # avoid need to escape use of brackets within regex provided rgx='\b(' + x + ')\b' @@ -198,7 +198,7 @@ module SiSU_Param_Make def italics m=@h['italics'] i=((m=~/\/i$/) ? 'i' : '') - z=if m + if m x=m.gsub(/^\/(.+?)\/i?/,'\1'). gsub(/\((?:\?:)?/,'(?:') # avoid need to escape use of brackets within regex provided rgx='\b(' + x + ')\b' @@ -216,7 +216,7 @@ module SiSU_Param_Make end def substitute m=@h['substitute'] - z=if m + if m w=m.scan(/\/(.+?)\/(i?,)\s*'(.+?)'(?:\s+|\s*;\s*|$)/) arr_hash=[] matches='' @@ -430,12 +430,10 @@ module SiSU_Param_Make {w: w, h: h} end def home_button_text - s=if @h['home_button_text'] + if @h['home_button_text'] @h['home_button_text'].split(/\s*;\s*/) else nil end - #l,n=Db[:home_button],'make.home_button_text' - #validate_length(s,l,n) end def home_button_image s=nil @@ -488,7 +486,7 @@ module SiSU_Param_Make end end def footer - s=if @h['footer'] + if @h['footer'] @h['footer'].split(/\s*;\s*/) else nil end diff --git a/lib/sisu/v5/plaintext.rb b/lib/sisu/v5/plaintext.rb index 9980b170..f5701b68 100644 --- a/lib/sisu/v5/plaintext.rb +++ b/lib/sisu/v5/plaintext.rb @@ -70,7 +70,6 @@ module SiSU_Plaintext require_relative 'shared_txt' # shared_txt.rb include SiSU_Param include SiSU_Viz - pwd=Dir.pwd @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' class Source @@ -85,7 +84,6 @@ module SiSU_Plaintext md=SiSU_Param::Parameters.new(@opt).get env=SiSU_Env::InfoEnv.new(@opt.fns) unless @opt.cmd =~/q/ - path=env.path.output_tell tool=(@opt.cmd =~/[MVv]/) \ ? "#{env.program.text_editor} #{md.file.output_path.txt.dir}/#{md.file.base_filename.txt}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" @@ -189,7 +187,6 @@ WOK def plaintext_tail # env=SiSU_Env::InfoEnv.new(@md.fns) vz=SiSU_Viz::Defaults.new - base_url="#{@env.url.root}/#{@md.fnb}" generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" @@ -268,14 +265,13 @@ WOK @@endnotes[:para]=[] end def markup(data) # Used for major markup instructions - dir=SiSU_Env::InfoEnv.new(@md.fns) + SiSU_Env::InfoEnv.new(@md.fns) @data_mod,@endnotes,@level,@cont,@copen,@plaintext_contents_close=Array.new(6){[]} (0..6).each { |x| @cont[x]=@level[x]=false } (4..6).each { |x| @plaintext_contents_close[x]='' } plaintext_tail #($1,$2) plaintext_metadata table_message='[table omitted, see other document formats]' - fix=[] data.each do |dob| dob.obj=dob.obj.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{@br}#{table_message}"). #fix gsub(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,''). # remove dummy headings (used by html) #check also [~-]# @@ -337,7 +333,6 @@ WOK gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]") gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]'). gsub(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') - wordlist=dob.obj.scan(/\S+/) if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ #if defined? dob.ocn and dob.ocn.to_s =~/\d+/ # paranum=dob.ocn.to_s diff --git a/lib/sisu/v5/po4a.rb b/lib/sisu/v5/po4a.rb index b3bcc81f..a152a397 100644 --- a/lib/sisu/v5/po4a.rb +++ b/lib/sisu/v5/po4a.rb @@ -69,7 +69,6 @@ module SiSU_Po4a require_relative 'po4a_set' # po4a_set.rb include SiSU_Param include SiSU_Viz - pwd=Dir.pwd class Source @@opt_src,@@opt_trn,@@opt_src_,@@opt_trn_,@@md_src,@@md_trn=nil,nil,nil,nil,nil,nil def initialize(opt,fn=nil) @@ -133,7 +132,7 @@ module SiSU_Po4a end else nil end - x=if FileTest.file?("#{srcdir}/#{opt_lang_src_fn}") + if FileTest.file?("#{srcdir}/#{opt_lang_src_fn}") @dal_array_lang_src=SiSU_DAL::Source.new(@@opt_src,opt_lang_src_fn).get # dal file drawn here else puts "no identified source document" @@ -836,77 +835,75 @@ GSUB #[dob_src,dob_trn] end def markup(dob) # Used for major markup instructions - dir=SiSU_Env::InfoEnv.new(@md.fns) - fix=[] - dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/, - "#{Px[:po_bold_o]}\\1#{Px[:po_bold_c]}"). - gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/, - "#{Px[:po_italics_o]}\\1#{Px[:po_italics_c]}"). - gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/, - "#{Px[:po_underscore_o]}\\1#{Px[:po_underscore_c]}"). - gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/, - "#{Px[:po_subscript_o]}\\1#{Px[:po_subscript_c]}"). - gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/, - "#{Px[:po_superscript_o]}\\1#{Px[:po_superscript_c]}"). - gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/, - "#{Px[:po_insert_o]}\\1#{Px[:po_insert_c]}"). - gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/, - "#{Px[:po_cite_o]}\\1#{Px[:po_cite_c]}"). - gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/, - "#{Px[:po_strike_o]}\\1#{Px[:po_strike_c]}"). - gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/, - "#{Px[:po_monospace_o]}\\1#{Px[:po_monospace_c]}") - notes='' - unless dob.is==:code - dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1'). - gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). - gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). - gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1') - #dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}") - notes=extract_endnotes(dob) - #% ### footnotes current state - extracted - dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'~^'). # endnote marker marked up - #% ### footnotes current state - keep inline - #dob.obj.gsub!(/#{Mx[:en_a_o]}[\d]+\s+(.+?)#{Mx[:en_a_c]}/,'~{ \1 }~') # inline endnote with marker marked up - gsub(/#{Mx[:en_b_o]}[\d]+\s+(.+?)#{Mx[:en_b_c]}/,'~[ \1 ]~'). # inline endnote with marker marked up - gsub(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/,'~{\1 \2 }~'). # inline endnote with marker marked up - gsub(/#{Mx[:en_b_o]}([*+]+)\s+(.+?)#{Mx[:en_b_c]}/,'~[\1 \2 ]~'). # inline endnote with marker marked up - gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<'). - gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>'). - gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&'). - gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!'). - gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#'). - gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*'). - gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-'). - gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/'). - gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_'). - gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'). - gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}'). - gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~'). - gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©') - end - dob.obj=if dob.of==:block # watch - dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* "). - gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n") - else dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n") - end - if dob.is==:code - dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _< - gsub(/(^|[^}])_([<>])/m,'\1\2') # _<_< - end - dob.obj=dob.obj.gsub(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,''). # remove page breaks + SiSU_Env::InfoEnv.new(@md.fns) + dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/, + "#{Px[:po_bold_o]}\\1#{Px[:po_bold_c]}"). + gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/, + "#{Px[:po_italics_o]}\\1#{Px[:po_italics_c]}"). + gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/, + "#{Px[:po_underscore_o]}\\1#{Px[:po_underscore_c]}"). + gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/, + "#{Px[:po_subscript_o]}\\1#{Px[:po_subscript_c]}"). + gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/, + "#{Px[:po_superscript_o]}\\1#{Px[:po_superscript_c]}"). + gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/, + "#{Px[:po_insert_o]}\\1#{Px[:po_insert_c]}"). + gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/, + "#{Px[:po_cite_o]}\\1#{Px[:po_cite_c]}"). + gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/, + "#{Px[:po_strike_o]}\\1#{Px[:po_strike_c]}"). + gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/, + "#{Px[:po_monospace_o]}\\1#{Px[:po_monospace_c]}") + notes='' + unless dob.is==:code + dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1'). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). - gsub(/<a href=".+?">(.+?)<\/a>/m,'\1'). - gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). # remove name links - gsub(/ |#{Mx[:nbsp]}/,' '). # decide on - gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]") - gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]") - gsub(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') + gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). + gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1') + #dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}") + notes=extract_endnotes(dob) + #% ### footnotes current state - extracted + dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'~^'). # endnote marker marked up + #% ### footnotes current state - keep inline + #dob.obj.gsub!(/#{Mx[:en_a_o]}[\d]+\s+(.+?)#{Mx[:en_a_c]}/,'~{ \1 }~') # inline endnote with marker marked up + gsub(/#{Mx[:en_b_o]}[\d]+\s+(.+?)#{Mx[:en_b_c]}/,'~[ \1 ]~'). # inline endnote with marker marked up + gsub(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/,'~{\1 \2 }~'). # inline endnote with marker marked up + gsub(/#{Mx[:en_b_o]}([*+]+)\s+(.+?)#{Mx[:en_b_c]}/,'~[\1 \2 ]~'). # inline endnote with marker marked up + gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<'). + gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>'). + gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&'). + gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!'). + gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#'). + gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*'). + gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-'). + gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/'). + gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_'). + gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'). + gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}'). + gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~'). + gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©') + end + dob.obj=if dob.of==:block # watch + dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* "). + gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n") + else dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n") + end + if dob.is==:code + dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _< + gsub(/(^|[^}])_([<>])/m,'\1\2') # _<_< + end + dob.obj=dob.obj.gsub(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,''). # remove page breaks + gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). + gsub(/<a href=".+?">(.+?)<\/a>/m,'\1'). + gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). # remove name links + gsub(/ |#{Mx[:nbsp]}/,' '). # decide on + gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]") + gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]") + gsub(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') [dob,notes] end def publish(fn,pot) - divider='=' content=[] content << pot[:open] content << pot[:head] @@ -942,7 +939,7 @@ GSUB else emptyline=0 end file_pot.puts line if emptyline < 2 #remove extra line spaces (fix upstream) - end + end end else file_pot.puts para #unix plaintext # /^([*=-]|\.){5}/ end diff --git a/lib/sisu/v5/po4a_set.rb b/lib/sisu/v5/po4a_set.rb index 042bbaa0..44660ef5 100644 --- a/lib/sisu/v5/po4a_set.rb +++ b/lib/sisu/v5/po4a_set.rb @@ -180,7 +180,7 @@ WOK @md,@p=md,para end def extract(tag,tag_content,type,attrib) - dc=if dc_tag \ + if dc_tag \ and dc_content [dc_tag,dc_content,{dc_tag=>dc_content}] else nil @@ -215,7 +215,7 @@ WOK self end def start_is_match - meta=case @p + case @p when /^#{Mx[:meta_o]}(title)#{Mx[:meta_c]}\s*(.+?)$/; header($1,@md.title.full,'meta','dc') #dc 1 when /^#{Mx[:meta_o]}(creator|author)#{Mx[:meta_c]}\s*(.+?)$/; header('creator',$2,'meta','dc') #dc 2 when /^#{Mx[:meta_o]}(subject)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 3 @@ -266,16 +266,14 @@ WOK end end def dublin - out=if @p =~/^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/ - start_is_match - else nil - end + (@p =~/^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/) \ + ? start_is_match + : nil end def meta - out=if @p =~/^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/ - start_is_match - else nil - end + (@p =~/^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/) \ + ? start_is_match + : nil end end class ParagraphNumber diff --git a/lib/sisu/v5/prog_text_translation.rb b/lib/sisu/v5/prog_text_translation.rb index b35741c1..8425a109 100644 --- a/lib/sisu/v5/prog_text_translation.rb +++ b/lib/sisu/v5/prog_text_translation.rb @@ -278,7 +278,7 @@ module SiSU_Translate @lang_class.language_list end def language_list - lang=case @trans_str + case @trans_str when /American/i; 'American English' # tag depreciated, see iso 639-2 when /English/i; 'English' when /French/i; 'français' @@ -497,7 +497,7 @@ module SiSU_Translate 'Document Metadata' end def language_list_translated - lang=case @trans_str + case @trans_str when /American/i; 'American English' # tag depreciated, see iso 639-2 when /English/i; 'English' when /French/i; 'French' @@ -712,7 +712,7 @@ module SiSU_Translate 'Manifeste SiSU des métadonnées du document' end def language_list_translated - lang=case @trans_str + case @trans_str when /American/i; 'Anglais americain' # tag depreciated, see iso 639-2 when /English/i; 'Anglais' when /French/i; 'Français' @@ -924,7 +924,7 @@ module SiSU_Translate 'SiSU Zusammenfassung der Metadaten' end def language_list_translated - lang=case @trans_str + case @trans_str when /American/i; 'Amerikanisch-Englisch' # tag depreciated, see iso 639-2 when /English/i; 'Englisch' when /French/i; 'Französisch' @@ -1136,7 +1136,7 @@ module SiSU_Translate 'Manifiesto SiSU de metadatos de documento' end def language_list_translated - lang=case @trans_str + case @trans_str when /American/i; 'Inglés Americano' # tag depreciated, see iso 639-2 when /English/i; 'Inglés' when /French/i; 'Francés' @@ -1348,7 +1348,7 @@ module SiSU_Translate 'Inventario SiSU dei metadati' end def language_list_translated - lang=case @trans_str + case @trans_str when /American/i; 'Inglese USA' # tag depreciated, see iso 639-2 when /English/i; 'Inglese' when /French/i; 'Francese' @@ -1560,7 +1560,7 @@ module SiSU_Translate 'Dokumenttimetadatan SISU-manifesti' end def language_list_translated - lang=case @trans_str + case @trans_str when /American/i; 'Amerikanenglanti' # tag depreciated, see iso 639-2 when /English/i; 'Englanti' when /French/i; 'Ranska' diff --git a/lib/sisu/v5/qrcode.rb b/lib/sisu/v5/qrcode.rb index 6d93cd64..65f127f7 100644 --- a/lib/sisu/v5/qrcode.rb +++ b/lib/sisu/v5/qrcode.rb @@ -121,7 +121,6 @@ module SiSU_QRcode fn=@f.base_filename.manifest_txt mn='' if @md.opt.cmd =~/M/ - pt=@f.output_path.manifest.dir fn=@f.base_filename.manifest_txt manifest=@f.write_file.manifest_txt end @@ -132,26 +131,16 @@ module SiSU_QRcode mn += x end manifest.close if @md.opt.cmd =~/M/ - #system(%{ - # cat #{pt}/#{fn} | qrencode -s 3 -o qrcm.autonomy_markup0.png - #}) cmd=SiSU_Env::SystemCall.new(mn,@f.place_file.qrcode_md.dir,@md.opt.cmd) cmd.qrencode - #system(%{ - # echo "#{mn}" | qrencode -s 3 -o #{@dest}/qrc_md.#{fn}.png - #}) end def output_metadata_short - fn=@f.base_filename.manifest_txt mn='' @manifest[:txt_title].each do |x| mn += x end cmd=SiSU_Env::SystemCall.new(mn,@f.place_file.qrcode_title.dir,@md.opt.cmd) cmd.qrencode - #system(%{ - # echo "#{mn}" | qrencode -s 3 -o #{@dest}/qrc_title.#{fn}.png - #}) end def summarize(id,file,pth='',rel='',url='',img='● ') size=(File.size("#{pth}/#{file}")/1024.00).to_s @@ -213,22 +202,14 @@ WOK @m << { mu: mu, l: lng } end end - #url=@f.output_path.base.url - #@en_manifest=if @env.output_dir_structure.by_language_code? - # "#{url}/en/manifest/#{@md.fnb}.html" - #elsif @env.output_dir_structure.by_filetype? - # "#{url}/manifest/#{@md.fnb}.#{lc}.html" - #else - # "#{url}/sisu_manifest.#{lc}.html" - #end - manifests + #manifests @m=@m.uniq @m end def languages(id,file) flv=published_manifests? flv.each do |l| - lang=SiSU_Translate::Source.new(@md,@language,l[:n]).language_list + SiSU_Translate::Source.new(@md,@language,l[:n]).language_list @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n" end end @@ -446,7 +427,6 @@ WOK end def source_tests if @md.fns =~/\.ssm\.sst$/ #% decide whether to extract and include requested/required documents - req=@md.fns if FileTest.file?(@f.place_file.src.dir)==true pth=@f.output_path.src.dir rel=@f.output_path.src.rel @@ -709,8 +689,6 @@ WOK end def check_output(data) begin - id,file='','' - vz=SiSU_Viz::Defaults.new @f=SiSU_Env::FileOp.new(@md) #.base_filename url=@f.output_path.base.url @en_manifest=if @env.output_dir_structure.by_language_code? diff --git a/lib/sisu/v5/remote.rb b/lib/sisu/v5/remote.rb index 3a560ae1..19160826 100644 --- a/lib/sisu/v5/remote.rb +++ b/lib/sisu/v5/remote.rb @@ -62,7 +62,6 @@ module SiSU_Remote require_relative 'sysenv' # sysenv.rb include SiSU_Env - pwd=Dir.pwd class Put def initialize(opt) @opt=opt @@ -122,7 +121,7 @@ module SiSU_Remote threads << Thread.new(requested_page) do |url| open(url) do |f| raise "#{url} not found" unless f - base_uri,fnb,instr=re_fnb.match(url)[1..3] if re_fnb + base_uri,fnb=re_fnb.match(url)[1..2] if re_fnb imagedir=base_uri + '/_sisu/image' #check on downloaded_file=File.new("#{fnb}.-sst",'w+') image_download_url=SiSU_Assemble::RemoteImage.new.image(imagedir) @@ -191,7 +190,7 @@ module SiSU_Remote end def dir_stub re_p_stub=/.+?([^\/]+)$/ - pod_stub= re_p_stub.match(path).captures.join if path + re_p_stub.match(path).captures.join if path end def name_source @pod diff --git a/lib/sisu/v5/share_src_kdissert.rb b/lib/sisu/v5/share_src_kdissert.rb index e91a3cf3..2ed26aec 100644 --- a/lib/sisu/v5/share_src_kdissert.rb +++ b/lib/sisu/v5/share_src_kdissert.rb @@ -62,7 +62,6 @@ module SiSU_KdiSource require_relative 'sysenv' # sysenv.rb include SiSU_Env - pwd=Dir.pwd class Source require 'fileutils' include FileUtils diff --git a/lib/sisu/v5/shared_html_lite.rb b/lib/sisu/v5/shared_html_lite.rb index c01ec086..e46510ea 100644 --- a/lib/sisu/v5/shared_html_lite.rb +++ b/lib/sisu/v5/shared_html_lite.rb @@ -251,7 +251,7 @@ GSUB def ocn %{<label class="ocn">#{@ocn}</label>} << "\n" end - def html_table # get rid of use html_table + def html_table # get rid of use html_table @new_content=[] @txt.split(/\n/).each do |parablock| m=parablock[/<!f(.+?)!>/,1] diff --git a/lib/sisu/v5/shared_markup_alt.rb b/lib/sisu/v5/shared_markup_alt.rb index e0fec924..f2fca338 100644 --- a/lib/sisu/v5/shared_markup_alt.rb +++ b/lib/sisu/v5/shared_markup_alt.rb @@ -192,7 +192,7 @@ module SiSU_TextRepresentation @s=@s end else - p __FILE__ +':'+ __LINE__.to_s + p __FILE__ << ':' << __LINE__.to_s end @s end @@ -227,7 +227,6 @@ module SiSU_TextRepresentation SiSU_TextRepresentation::Alter.new(@s).strip_clean_of_markup end def dgst - en_dgst,img_dgst={},{} txt_dgst=digest(txt) { txt: txt, dgst_txt: txt_dgst } end @@ -253,7 +252,6 @@ module SiSU_TextRepresentation def images(imgs) sys=SiSU_Env::SystemCall.new line_image=[] - img_dgst={} if imgs and imgs.length > 0 @image_name,@image_dgst,@img=[],[],[] imgs.each do |i| @@ -268,7 +266,6 @@ module SiSU_TextRepresentation nil end img_type = /\S+\.(png|jpg|gif)/.match(i)[1] - not_found_msg='image not found' if image_source para_image = image_source + '/' + i image_name = i @@ -298,7 +295,6 @@ module SiSU_TextRepresentation if @t_o.of !=:comment \ && @t_o.of !=:structure \ && @t_o.of !=:layout - en_dgst,img_dgst={},{} txt_stripped_dgst=digest(stripped_clean(@t_o)) txt_markup_reverted_dgst=digest(markup_reverted(@t_o)) endnotes_dgst=[] diff --git a/lib/sisu/v5/shared_metadata.rb b/lib/sisu/v5/shared_metadata.rb index 5c8c225d..91b12043 100644 --- a/lib/sisu/v5/shared_metadata.rb +++ b/lib/sisu/v5/shared_metadata.rb @@ -67,9 +67,7 @@ module SiSU_Metadata @tag,@inf,@class,@attrib=nil end def metadata_base - meta,tag=[],[] - dir=SiSU_Env::InfoEnv.new(@md.fns) - base_html="#{dir.url.root}/#{@md.fnb}" + meta=[] l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language language=l[:n] tr=SiSU_Translate::Source.new(@md,language) @@ -904,8 +902,6 @@ WOK end def metadata_tex meta=[] - dir=SiSU_Env::InfoEnv.new(@md.fns) - base_html="#{dir.url.root}/#{@md.fnb}" l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language language=l[:n] tr=SiSU_Translate::Source.new(@md,language) diff --git a/lib/sisu/v5/shared_sisupod_source.rb b/lib/sisu/v5/shared_sisupod_source.rb index f35287de..bd9b2d36 100644 --- a/lib/sisu/v5/shared_sisupod_source.rb +++ b/lib/sisu/v5/shared_sisupod_source.rb @@ -66,7 +66,6 @@ module SiSU_Source require_relative 'particulars' # particulars.rb def initialize(opt,build=nil,place=nil) @opt=opt - m=/.+\/(?:src\/)?(\S+)/im @date=SiSU_Env::InfoDate.new.dt @env=SiSU_Env::InfoEnv.new(opt.fns) @ver=SiSU_Env::InfoVersion.instance.get_version diff --git a/lib/sisu/v5/shared_txt.rb b/lib/sisu/v5/shared_txt.rb index 3401b05b..8e8e7edb 100644 --- a/lib/sisu/v5/shared_txt.rb +++ b/lib/sisu/v5/shared_txt.rb @@ -132,7 +132,7 @@ module SiSU_TextUtils @md,@p=md,para end def extract(tag,tag_content,type,attrib) - dc=if dc_tag \ + if dc_tag \ and dc_content [dc_tag,dc_content,{dc_tag=>dc_content}] else nil @@ -167,7 +167,7 @@ module SiSU_TextUtils self end def start_is_match - meta=case @p + case @p when /^#{Mx[:meta_o]}(title)#{Mx[:meta_c]}\s*(.+?)$/; header($1,@md.title.full,'meta','dc') #dc 1 when /^#{Mx[:meta_o]}(creator|author)#{Mx[:meta_c]}\s*(.+?)$/; header('creator',$2,'meta','dc') #dc 2 when /^#{Mx[:meta_o]}(subject)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 3 @@ -218,13 +218,13 @@ module SiSU_TextUtils end end def dublin - out=if @p =~/^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/ + if @p =~/^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/ start_is_match else nil end end def meta - out=if @p =~/^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/ + if @p =~/^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/ start_is_match else nil end diff --git a/lib/sisu/v5/shared_xml.rb b/lib/sisu/v5/shared_xml.rb index fe4be74e..af9b0992 100644 --- a/lib/sisu/v5/shared_xml.rb +++ b/lib/sisu/v5/shared_xml.rb @@ -654,12 +654,11 @@ module SiSU_XML_Tags #Format @vz=SiSU_Viz::Defaults.new end def meta_content_clean(content='') - content - unless content.nil? + content=if not content.nil? content=content.tr('"',"'") content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content) + else content end - content end def rdfseg #segHead rdftoc @@ -693,7 +692,7 @@ WOK * SiSU http://www.jus.uio.no/sisu --> WOK - end + end end def comment_xml_sax desc='SiSU XML, SAX type representation' diff --git a/lib/sisu/v5/sitemaps.rb b/lib/sisu/v5/sitemaps.rb index fcdfe883..a8cb5e97 100644 --- a/lib/sisu/v5/sitemaps.rb +++ b/lib/sisu/v5/sitemaps.rb @@ -127,7 +127,7 @@ module SiSU_Sitemaps def sitemap_index sitemap_files=Dir.glob("#{@env.path.sitemaps}/sitemap_*.xml") sitemap_idx=[] - sitemap_idx <<<<WOK + sitemap_idx << <<WOK <?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemaps/0.9 @@ -137,19 +137,19 @@ WOK sitemap_files.each do |s| f=s.gsub(/.+?\/sitemap_([^\/]+?)\.xml$/,'\1') @trans.char_enc.utf8(f) if @sys.locale =~/utf-?8/i #% utf8 -sitemap_idx <<<<WOK +sitemap_idx << <<WOK <sitemap> <loc>#{@env.path.url.remote}/#{f}/sitemap.xml</loc> </sitemap> WOK end - sitemap_idx <<<<WOK + sitemap_idx << <<WOK </sitemapindex> WOK - idx=sitemap_idx.join + sitemap_idx.join end def sitemap - map=if defined? @md.date.modified \ + if defined? @md.date.modified \ and @md.date.modified=~/\d{4}-\d{2}-\d{2}/ sitemap_date_modified else sitemap_no_date diff --git a/lib/sisu/v5/spell.rb b/lib/sisu/v5/spell.rb index 8f10e3be..60d2e947 100644 --- a/lib/sisu/v5/spell.rb +++ b/lib/sisu/v5/spell.rb @@ -77,7 +77,7 @@ module SiSU_SpellUtility gsub(/( |#{Mx[:nbsp]})/i,' '). gsub(/<\/?(table|tr|td|b|p|href).*?>/i,' '). gsub(/(<==.+|<:\S+>|<!.+?!>|^@\S+?:.+|\{\{\{|~)/,' '). - gsub(/(["|<>)(\n'`'.;&_-]|\=)/,' '). + gsub(/(["|<>)(\n'`.;&_-]|\=)/,' '). gsub(/\b(altExternal| target|externalimg| srcimagebext| diff --git a/lib/sisu/v5/sst_do_inline_footnotes.rb b/lib/sisu/v5/sst_do_inline_footnotes.rb index 08dd9f4f..2fc4d90f 100644 --- a/lib/sisu/v5/sst_do_inline_footnotes.rb +++ b/lib/sisu/v5/sst_do_inline_footnotes.rb @@ -92,7 +92,6 @@ module SiSU_ConvertFootnotes end def read #creates dal begin - dal=[] @@dal_array=[] @@fns=@opt.fns create_dal @@ -158,7 +157,7 @@ module SiSU_ConvertFootnotes def initialize(md,data) @md,@data=md,data @my_make=SiSU_Env::CreateFile.new(@md.fns) - dir=SiSU_Env::InfoEnv.new(@md.fns) + SiSU_Env::InfoEnv.new(@md.fns) @hard="#{Dir.pwd}/#{@md.fns}.fn" end def hard_output @@ -191,7 +190,7 @@ module SiSU_ConvertFootnotes reset data=@data @metafile="#{@env.processing_path.dal}/#{@md.fns}.meta" - my_make_source_file=SiSU_Env::CreateFile.new(@md.fns) + SiSU_Env::CreateFile.new(@md.fns) data=data.join.split("\n\n") data_new=[] data.each do |x| @@ -417,8 +416,7 @@ module SiSU_ConvertFootnotes def endnotes #% endnote work zone data=@data @tuned_file=[] - endnote_no,endnote_ref=1,1 - + endnote_ref=1 data.each do |para| case para # manually numbered endnotes <!e(\d)!> <!e_(\d)!> --> when /~\{\s+.+?\}~/ # auto-numbered endnotes <!e!> <!e_!> --> diff --git a/lib/sisu/v5/sst_to_s_xml_sax.rb b/lib/sisu/v5/sst_to_s_xml_sax.rb index 3276d1fc..cc1a5347 100644 --- a/lib/sisu/v5/sst_to_s_xml_sax.rb +++ b/lib/sisu/v5/sst_to_s_xml_sax.rb @@ -88,12 +88,6 @@ module SiSU_SimpleXML_ModelSax begin @md=@particulars.md #bug, relies on info persistence, assumes -m has previously been run @env=@particulars.env - path=@env.path.output_tell - loc=@env.url.output_tell - tool=if @opt.cmd =~/[MV]/; "#{Dir.pwd}/#{@md.fn[:sxs]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:sxs]}" - elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{Dir.pwd}/#{@md.fn[:sxs]}" - else '' - end SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML SAX',"#{@md.fns} -> #{@md.fn[:sxs]}").colorize unless @opt.cmd =~/q/ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{Dir.pwd}/#{@md.fn[:sxs]}").flow if @opt.cmd =~/[MV]/ unless @@fns==@opt.fns @@ -199,8 +193,6 @@ WOK end def xml_structure(para='',lv='',hname='') #extracted endnotes lv=lv.to_i - n=lv - 1 - n3=lv + 2 lv=nil if lv==0 embedded_endnotes(para) if para[@regx] @@ -271,7 +263,6 @@ WOK end def markup data=[] - dir=SiSU_Env::InfoEnv.new(@md.fns) xml_sc(@md) @endnotes,@level,@cont,@copen,@xml_contents_close=[],[],[],[],[] @rcdc=false @@ -305,7 +296,7 @@ WOK if para !~/(^@\S+?:|^\s*$|<ENDNOTES>|<EOF>)/ @sto=SiSU_text_parts::SplitTextObject.new(@md,para).lev_segname_para unless @rcdc - format_scroll=SiSU_XML_Format::FormatScroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/ + SiSU_XML_Format::FormatScroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/ case @sto.format when /^(1):(\S*)/ xml_clean(para) @@ -407,7 +398,6 @@ WOK end def publish content=[] - data=@data content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata] content << @@xml[:owner_details] if @md.stmp =~/\w\w/ content << @@xml[:tail] << @@xml[:close] diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index 1a00baa7..973e0dcc 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -113,18 +113,13 @@ module SiSU_Env else #error tmp_processing=tmp_processing_individual="/tmp/#{prcss_dir_stub}" end - tmp_processing_home=if @@home \ - and File.writable?("#{@@home}/.") - "#{@@home}/#{prcss_dir_stub}" - else prcss_dir_stub - end processing_pth=tmp_processing_individual processing_dir=prcss_dir processing_git="#{Dir.pwd}/#{Gt[:grotto]}" user=ENV['USER'] port_pgsql=if defined? ENV['PGPORT'] \ and not (ENV['PGPORT'].nil? \ - or ENV['PGPORT'].empty?) \ + || ENV['PGPORT'].empty?) \ and ENV['PGPORT']=~/^\d+$/ ENV['PGPORT'] else '5432' @@ -219,7 +214,6 @@ module SiSU_Env @@default_dir=DEFAULT_DIR m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m @@pwd=@pwd=SiSU_Utils::Path.new.base_markup - stub_pwd=@pwd[m,1] attr_accessor :user,:home,:hostname,:pwd,:host,:arch,:rbver,:dir_arch,:dir_sitearch,:dir_bin,:locale,:webserv_path,:webserv_host_cgi,:webserv_port_cgi,:default_dir,:rc_path,:ad_path def initialize @user,@home,@hostname,@pwd,@sisu_etc,@host,@arch,@rbver,@dir_arch,@dir_sitearch,@dir_bin,@locale,@default_dir=\ @@ -239,7 +233,6 @@ module SiSU_Env end def prog load_prog=false - pp='' $:.each do |reqpath| if FileTest.exist?("#{reqpath}/#{@prog}.rb") load_prog=true @@ -560,7 +553,6 @@ module SiSU_Env @fn end def published_manifests?(output_base) - ob=output_base @fn={} @m=[] unless (@fns.nil? \ @@ -794,14 +786,14 @@ module SiSU_Env end def imagemagick #imagemagick is a image manipulation program program='identify' - program_ref="\n\t\tsee <http://www.imagemagick.org/>" + #program_ref="\n\t\tsee <http://www.imagemagick.org/>" found=(program_found?(program)) ? true : false #STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found found end def graphicksmagick #graphicsmagick is a image manipulation program program='gm' - program_ref="\n\t\tsee <http://www.graphicsmagick.org/>" + #program_ref="\n\t\tsee <http://www.graphicsmagick.org/>" found=(program_found?(program)) ? true : false #STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found found @@ -864,12 +856,8 @@ module SiSU_Env : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}") end def scp - program='scp' puts "scp -Cr #{@input} #{@output}" if @cmd =~/[vVM]/ puts "scp disabled" - #(program_found?(program)) \ - #? system("scp -Cr #{@input} #{@output}") \ - #: (STDERR.puts "\t*WARN* #{program} not found" ) end def rsync(action='',chdir=nil) program='rsync' @@ -892,7 +880,7 @@ module SiSU_Env dir_change=Dir.chdir(chdir) dir_return=Dir.pwd end - dir_change + dir_change #check system(" #{rsync_cmd} #{msg} #{amp} ") @@ -922,7 +910,7 @@ module SiSU_Env @@lang_info ||=@lang_info.language.list end def lang(l='') # from i18n - x=if l =~/^#{@r}$/ + if l =~/^#{@r}$/ @lang_info.language.list[l] elsif @language =~/^#{@r}$/ @lang_info.language.list[@language] @@ -1294,14 +1282,14 @@ module SiSU_Env : false end def html_minitoc? - flag=if defined? @rc['html']['minitoc'] \ + if defined? @rc['html']['minitoc'] \ and @rc['html']['minitoc'].is_a?(String) @rc['html']['minitoc'] else false end end def manifest_minitoc? - flag=if defined? @rc['manifest']['minitoc'] \ + if defined? @rc['manifest']['minitoc'] \ and @rc['manifest']['minitoc'].is_a?(String) @rc['manifest']['minitoc'] else false @@ -1358,7 +1346,7 @@ module SiSU_Env end end def links_to_manifest? - flag=if (defined? @rc['omit']['links_to_manifest'] \ + if (defined? @rc['omit']['links_to_manifest'] \ and not @rc['omit']['links_to_manifest'].nil?) \ or (listed?('links_to_manifest') \ || listed?('manifest_links')) @@ -1377,7 +1365,7 @@ module SiSU_Env end end def minitoc? - flag=if (defined? @rc['omit']['minitoc'] \ + if (defined? @rc['omit']['minitoc'] \ and not @rc['omit']['minitoc'].nil?) \ or (listed?('minitoc')) :off @@ -1386,7 +1374,7 @@ module SiSU_Env end end def manifest_minitoc? - flag=if (defined? @rc['omit']['manifest_minitoc'] \ + if (defined? @rc['omit']['manifest_minitoc'] \ and not @rc['omit']['manifest_minitoc'].nil?) \ or listed?('manifest_minitoc') :off @@ -1395,7 +1383,7 @@ module SiSU_Env end end def html_minitoc? - flag=if (defined? @rc['omit']['html_minitoc'] \ + if (defined? @rc['omit']['html_minitoc'] \ and not @rc['omit']['html_minitoc'].nil?) \ or (listed?('html_minitoc') \ || listed?('minitoc')) @@ -1405,7 +1393,7 @@ module SiSU_Env end end def html_navigation? - flag=if (defined? @rc['omit']['html_navigation'] \ + if (defined? @rc['omit']['html_navigation'] \ and not @rc['omit']['html_navigation'].nil?) \ or listed?('html_navigation') :off @@ -1414,7 +1402,7 @@ module SiSU_Env end end def html_navigation_bar? - flag=if (defined? @rc['omit']['html_navigation_bar'] \ + if (defined? @rc['omit']['html_navigation_bar'] \ and not @rc['omit']['html_navigation_bar'].nil?) \ or listed?('html_navigation_bar') :off @@ -1423,7 +1411,7 @@ module SiSU_Env end end def segsubtoc? - flag=if (defined? @rc['omit']['segsubtoc'] \ + if (defined? @rc['omit']['segsubtoc'] \ and not @rc['omit']['segsubtoc'].nil?) \ or listed?('segsubtoc') :off @@ -1432,7 +1420,7 @@ module SiSU_Env end end def html_right_pane? - flag=if (defined? @rc['omit']['html_right_pane'] \ + if (defined? @rc['omit']['html_right_pane'] \ and not @rc['omit']['html_right_pane'].nil?) \ or listed?('html_right_pane') :off @@ -1441,7 +1429,7 @@ module SiSU_Env end end def html_top_band? - flag=if (defined? @rc['omit']['html_top_band'] \ + if (defined? @rc['omit']['html_top_band'] \ and not @rc['omit']['html_top_band'].nil?) \ or listed?('html_top_band') :off @@ -1450,7 +1438,7 @@ module SiSU_Env end end def search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line - flag=if (defined? @rc['omit']['search_form'] \ + if (defined? @rc['omit']['search_form'] \ and not @rc['omit']['search_form'].nil?) \ or listed?('search_form') :off @@ -1459,7 +1447,7 @@ module SiSU_Env end end def html_search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line - flag=if (defined? @rc['omit']['html_search_form'] \ + if (defined? @rc['omit']['html_search_form'] \ and not @rc['omit']['html_search_form'].nil?) \ or listed?('html_search_form') :off @@ -1654,7 +1642,7 @@ WOK end end def search_action #check - action=if search? + if search? else '' end end @@ -1759,7 +1747,7 @@ WOK end end def search_action #check - action=if search? + if search? else '' end end @@ -1767,7 +1755,7 @@ WOK end def source_file_path file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst') - pth=unless file =~/\.ssm\.sst$/; "#{Dir.pwd}" + unless file =~/\.ssm\.sst$/; "#{Dir.pwd}" else "#{processing_path.composite_file}" end end @@ -1845,7 +1833,7 @@ WOK self end def read_source_file_array(fns) - fns_array=(fns !~/\.ssm.sst$/) \ + (fns !~/\.ssm.sst$/) \ ? (IO.readlines(fns, mode: 'r:utf-8', cr_newline: true)) : (IO.readlines("#{processing_path.composite_file}/#{fns}", mode: 'r:utf-8', cr_newline: true)) end @@ -1853,12 +1841,12 @@ WOK read_source_file_array(fns) end def read_source_file_string(fns) - fns_str=(fns !~/\.ssm.sst$/) \ + (fns !~/\.ssm.sst$/) \ ? (IO.read(fns, mode: 'r:utf-8', cr_newline: true)) : (IO.read("#{processing_path.composite_file}/#{fns}", mode: 'r:utf-8', cr_newline: true)) end def source_file_processing_array(fns) - sf=read_source_file_string(fns).split(/\s*\n\s*\n/m) + read_source_file_string(fns).split(/\s*\n\s*\n/m) end def path #dir def home @@ -2030,7 +2018,7 @@ WOK url.webserv_map_pwd end def image_source #image repository source directory - image_path=if defined? @rc['image']['path'] \ + if defined? @rc['image']['path'] \ and defined? @rc['image']['public'] pth="#{@rc['image']['path']}" "#{pth}/#{@rc['image']['public']}" @@ -2042,7 +2030,7 @@ WOK "#{share}/image" end def image_source_include #image repository source directory - image_path=if defined? @rc['image']['path'] \ + if defined? @rc['image']['path'] \ and defined? @rc['image']['public'] \ and FileTest.directory?("#{@rc['image']['path']}/#{@rc['image']['public']}")==true "#{@rc['image']['path']}/#{@rc['image']['public']}" @@ -2143,7 +2131,6 @@ WOK FileUtils::mkdir_p(processing_path_usr) unless FileTest.directory?(processing_path_usr) File.chmod(0700,processing_path_usr) end - fn_base_bundle=paths[:fnb] sisupod_processing_path=paths[:sisupod] FileUtils::mkdir_p(sisupod_processing_path) unless FileTest.directory?(sisupod_processing_path) sisupod_processing_path_lng=if defined? @opt.lng @@ -2210,7 +2197,7 @@ WOK def git pth=if defined? @rc['git']['dir'] \ and @rc['git']['dir'].is_a?(String) - x=(@rc['git']['dir'] =~/^(?:~|home)$/) \ + (@rc['git']['dir'] =~/^(?:~|home)$/) \ ? home + '/' + Gt[:git] : @rc['git']['dir'] + '/' + Gt[:git] else defaults[:processing_git] @@ -2256,7 +2243,6 @@ WOK FileUtils::mkdir_p("#{processing_path.epub}/META-INF") unless FileTest.directory?("#{processing_path.epub}/META-INF") FileUtils::mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/image") unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/image") FileUtils::mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/css") unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/css") - images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png] processing_path.epub end def epub_cp_images(md) @@ -2494,13 +2480,13 @@ WOK end def cgi_sample_search_form_name(opt=nil) if opt.mod.inspect =~/--(?:cgi-)?search-form-name[=-]["']?(\S+?\.cgi)/ - m=$1 - elsif not (opt.mod.inspect =~/--db[=-]["']?sqlite/) \ + $1 + elsif not opt.mod.inspect =~/--db[=-]["']?sqlite/ \ and defined? @rc['search'] \ and defined? @rc['search']['sisu'] \ and defined? @rc['search']['sisu']['action'] \ and @rc['search']['sisu']['action'] =~/https?:\/\/\S+?\.cgi/ - x=/(?:https?:\/\/\S+?)\/([^\/]+?\.cgi)$/.match(@rc['search']['sisu']['action'])[1] + /(?:https?:\/\/\S+?)\/([^\/]+?\.cgi)$/.match(@rc['search']['sisu']['action'])[1] else (opt.mod.inspect =~/--db[=-]["']?sqlite/) \ ? 'sisu_sqlite.cgi' \ @@ -2521,7 +2507,7 @@ WOK @rc['show_output_on'] else 'filesystem' end - output=case output_type + case output_type when /^filesystem(?:_url)?/; url.dir_url when /^remote(?:_webserv)?/; url.remote when /^(?:webserv|local_webserv)/; url.local @@ -2843,7 +2829,7 @@ WOK end if f_pod \ && FileTest.file?(f_pod) - tree=(SiSU_Env::SystemCall.new.program_found?('tree')) \ + (SiSU_Env::SystemCall.new.program_found?('tree')) \ ? "tree #{processing_path.processing}/#{Gt[:sisupod]}" : '' if FileTest.directory?(processing_path.processing) @@ -2858,7 +2844,6 @@ WOK sisupod_processing_path end def sisupod_gen_v2(fns_pod) - pwd=Dir.pwd sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}" if FileTest.directory?(sisupod_processing_path) \ or FileTest.file?(sisupod_processing_path) @@ -3338,7 +3323,7 @@ WOK #local_gen_image_external="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." remote_rel=remote_conn[:name] + '/' + f.output_path.stub.rcp - src_txt=@opt.fnc + @opt.fnc if (local_gen =~/\S/ \ and local_gen !~/\/\//) \ and (remote_gen =~/\S/ \ @@ -3346,7 +3331,7 @@ WOK and @@flag_remote==true \ and @opt.cmd !~/U/ # SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync - delete_extra_files='--delete' # '--delete-after' + #delete_extra_files='--delete' # '--delete-after' inp=[] if (@opt.act[:html][:set]==:on \ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ @@ -3438,8 +3423,8 @@ WOK inp.join(' ') else '' end - local_css,images,images_external,images_system='','','','' - images_gen=images=images_skin=images_system=local_css='' + local_css,images,images_system='','','' + images=images_skin=images_system=local_css='' if @opt.cmd =~/[hwbxX]/ \ && (defined? @md.ec[:image]) \ && (@md.ec[:image].length > 0) @@ -3509,7 +3494,6 @@ WOK ldest='_sisu/*' l_rel="#{@env.path.webserv}/#{@env.path.stub_pwd}" image_sys="#{@env.path.webserv}/_sisu/image_sys" - images="#{@env.path.webserv}/_sisu/image" self.remote_host_base.each do |remote_conn| remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}" remote_conf="#{remote_conn[:name]}/_sisu" @@ -3628,7 +3612,7 @@ WOK end def basefilename #Remove if possible m=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/m - fnb=@fns[m,1] + @fns[m,1] end def make_file(path,filename) (File.writable?("#{path}/.")) \ @@ -4068,9 +4052,9 @@ WOK end def psql def user(opt=nil) - x=if opt \ + if opt \ and opt.mod.inspect =~/--db-user[=-]["']?(\S+)["']+/ - m=$1 + $1 elsif opt \ and opt.mod =~/--webserv[=-]webrick/ @env.user @@ -4280,7 +4264,6 @@ WOK self end def mkdir - txt_path="#{output_path.base.dir}/#{@md.fnb}" def output def base FileUtils::mkdir_p(output_path.base.dir) unless FileTest.directory?(output_path.base.dir) @@ -4300,12 +4283,12 @@ WOK path="#{output_path.base.dir}/#{@md.fnb}" make_path(path) filename=@fno - file=make_file(path,filename) + make_file(path,filename) end def mkfile_pwd path=Dir.pwd filename=@fno - file=make_file(path,filename) + make_file(path,filename) end def write_file def txt @@ -4325,7 +4308,6 @@ WOK || (output_dir_structure.dump?)) \ ? "#{output_path.html.dir}" : "#{output_path.html.dir}/#{@md.fnb}" - fn=base_filename.html_seg_index make_path(pth) p_fn=place_file.html_seg_index.dir @@filename_html_index=File.new(p_fn,'w+') @@ -4336,7 +4318,6 @@ WOK || (output_dir_structure.redirect?)) \ ? "#{output_path.html.dir}" : "#{output_path.html.dir}/#{@md.fnb}" - fn=base_filename.html_segtoc make_path(pth) p_fn=place_file.html_segtoc.dir @@filename_html_index=File.new(p_fn,'w+') @@ -4345,43 +4326,43 @@ WOK path=output_path.xhtml.dir make_path(path) fn=base_filename.xhtml - file=make_file(path,fn) + make_file(path,fn) end def xml_sax path=output_path.xml.dir make_path(path) fn=base_filename.xml_sax - file=make_file(path,fn) + make_file(path,fn) end def xml_dom path=output_path.xml.dir make_path(path) fn=base_filename.xml_dom - file=make_file(path,fn) + make_file(path,fn) end def manpage path=output_path.manpage.dir make_path(path) fn=base_filename.manpage - file=make_file(path,fn) + make_file(path,fn) end def texinfo path=output_path.texinfo.dir make_path(path) fn=base_filename.texinfo - file=make_file(path,fn) + make_file(path,fn) end def info path=output_path.texinfo.dir make_path(path) fn=base_filename.info - file=make_file(path,fn) + make_file(path,fn) end def hash_digest path=output_path.hash_digest.dir make_path(path) fn=base_filename.hash_digest - file=make_file(path,fn) + make_file(path,fn) end def qrcode path=output_path.qrcode.dir @@ -5817,7 +5798,7 @@ WOK begin super(fns) @env=SiSU_Env::InfoEnv.new(fns) - ver=InfoVersion.instance + InfoVersion.instance if operation.class.inspect =~/SiSU_Param/ @md=operation end @@ -5896,7 +5877,7 @@ WOK @env=SiSU_Env::InfoEnv.new('',@md) end def html - css=if @md.doc_css \ + if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html.css") "#{@md.doc_css}_html.css" elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html.css") @@ -5906,7 +5887,7 @@ WOK end end def html_tables - css=if @md.doc_css \ + if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html_tables.css") "#{@md.doc_css}_html_tables.css" elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html_tables.css") @@ -5915,7 +5896,7 @@ WOK end end def xhtml - css=if @md.doc_css \ + if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xhtml.css") "#{@md.doc_css}_xhtml.css" elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xhtml.css") @@ -5924,7 +5905,7 @@ WOK end end def xml_sax - css=if @md.doc_css \ + if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_sax.css") "#{@md.doc_css}_xml_sax.css" elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_sax.css") @@ -5933,7 +5914,7 @@ WOK end end def xml_dom - css=if @md.doc_css \ + if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_dom.css") "#{@md.doc_css}_xml_dom.css" elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_dom.css") @@ -5942,7 +5923,7 @@ WOK end end def docbook_xml - css=if @md.doc_css \ + if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_docbook.css") "#{@md.doc_css}_xml_dom.css" elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_docbook.css") @@ -5951,7 +5932,7 @@ WOK end end def homepage - css=if @md.doc_css \ + if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_homepage.css") "#{@md.doc_css}_homepage.css" elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_homepage.css") diff --git a/lib/sisu/v5/termsheet.rb b/lib/sisu/v5/termsheet.rb index e25673b4..5f3700c4 100644 --- a/lib/sisu/v5/termsheet.rb +++ b/lib/sisu/v5/termsheet.rb @@ -70,7 +70,6 @@ require_relative 'param' # param.rb @cX=SiSU_Screen::Ansi.new('yes').cX @done << "\n#{@cX.blue_hi}#{@cX.black}Summary#{@cX.off*2}" def talent(termsheet,flag) - no_ocn='0' if flag =~/0/ #flag to request switch off of text object numbering @@info=nil @@info=termsheet.gsub(/(.+?)\.termsheet\.rb/,'../facility_data/\1.html') @env=SiSU_Env::InfoEnv.new @@ -104,7 +103,6 @@ WOK @report_file_i=File.new("#{@dir_fd}/#{@basename}.txt",'w+') @report_file_o=File.new("#{@dir_fd}/#{@basename}.html",'w+') @filename_new=File.new("#{@basename}.#{k}.sst",'w+') - file_array=IO.readlines(v,"\n") @do << %{#{k}} @filename_new << @document # "require v" pulls in the composite @document diff --git a/lib/sisu/v5/texinfo.rb b/lib/sisu/v5/texinfo.rb index 069d9166..aea3f372 100644 --- a/lib/sisu/v5/texinfo.rb +++ b/lib/sisu/v5/texinfo.rb @@ -106,11 +106,10 @@ module SiSU_TexInfo tool=(@opt.cmd =~/[MVv]/) \ ? "#{@env.program.texinfo} #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.info}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" - tell=@opt.cmd=~/[MVvz]/ \ + @opt.cmd=~/[MVvz]/ \ && @opt.cmd !~/q/ \ ? SiSU_Screen::Ansi.new(@opt.cmd,'TexInfo',tool).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'TexInfo',tool).green_title_hi - tell @md=SiSU_Param::Parameters.new(@opt).get directories @marshalfile=SiSU_Env::InfoFile.new(@opt.fns).marshal.dal_content @@ -260,7 +259,6 @@ module SiSU_TexInfo @tex_file=[] @row_break='\\\\\\' @break_page="#{@row_break}\n#{@row_break} \n" - md={} @tex_file << SiSU_TexInfoFormat::Texinfo.new(@md).head mono=SiSU_TexInfoFormat::Texinfo.new(@md) @tex_file << mono.topnode(@md.title.full) @@ -352,10 +350,6 @@ module SiSU_TexInfo def number_titles data,data_new=@data,[] @tex_file=[] - input=%{#{@md.markup}}[/(num_top\s*=\s*(\d?))?/m,2] # else default usually 4 # this was a bit of a trick required to pass nil to input if nothing matched... #puts input - num_top=input.to_i - t_no1=0; t_no2=0; t_no3=0; t_no4=0; - no1=num_top; no2=(num_top + 1); no3=(num_top + 2); no4=(num_top + 3); data.each do |dob| if (@md.markup =~ /num_top/i) \ && (dob.obj !~ /#{Rx[:meta]}/) diff --git a/lib/sisu/v5/texinfo_format.rb b/lib/sisu/v5/texinfo_format.rb index e4efdb3b..2da5d6c4 100644 --- a/lib/sisu/v5/texinfo_format.rb +++ b/lib/sisu/v5/texinfo_format.rb @@ -82,7 +82,6 @@ module SiSU_TexInfoFormat def head t=Time.now year=t.year - filename=%{#{@md.fns}}[/(.+?)\.\w\w\d\d$/,1] title=spec_char(@md.title.full) title=title.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} "). gsub(/\$/,"\\$"). @@ -98,7 +97,7 @@ module SiSU_TexInfoFormat author=@md.author if @md.author author ||='' author=author.gsub(/[\*]/,'') #if author - v=SiSU_Env::InfoVersion.instance.get_version + SiSU_Env::InfoVersion.instance.get_version head =<<WOK \\input texinfo @c -*-texinfo-*- @comment %**start of header @@ -165,8 +164,6 @@ WOK "@menu\n" end def dublincore - title=spec_char(@md.title.main) if @md.title.main - subtitle=spec_char(@md.title.sub) if @md.title.sub if defined? @md.title.full \ and @md.title.full=~/\S+/ full_title=spec_char(@md.title.full) @@ -465,7 +462,7 @@ WOK @row_break='\\\\\\\\' @break_page="#{@row_break}\n#{@row_break} \n" if @dob[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/ui] #fix - no_of_cols,cols_width=$1,$2 + cols_width=$2 @w=cols_width.split(/;\s+/) @colW=[] @w.each do |x| @@ -489,7 +486,6 @@ WOK else @dob.obj=@dob.obj.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') @@table_pg_break_counter+=1 - tablefoot=@dob[/\<!f(.+?)!\>/] @dob.obj=@dob.obj.gsub(/\<!f(.+?)!\>/,'') end end @@ -517,7 +513,7 @@ WOK def png # very messy clean up ! - work area, testing z=@dob[/\\\{(.+?)\}(?:image|png)/,1] # match operator for z \\ fragile ! - image,w,x,y=z.scan(/\S+/) + image=z.scan(/\S+/)[0] #image,w,x,y=z.scan(/\S+/) image=image.gsub(/\\/,'') @dob.obj=@dob.obj.gsub(/\\\{\S+\.(png|jpg|gif).+?\}(image|png)/,"<image #{image} not available>") # fragile match operator\\ fragile ! end @@ -526,7 +522,7 @@ WOK z=@dob[/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,1] # match operator for z \\ fragile ! url=@dob[/((?:https?|file|ftp):\S+)/im,1] if @dob =~/\.(png|jpg|gif)/ - image,w,x,y=z.scan(/\S+/) + image=z.scan(/\S+/)[0] #image,w,x,y=z.scan(/\S+/) image=image.gsub(/\\/,'') width=200 width=z[/w=(\d+)/im,1] if z =~/w=(\d+)/ diff --git a/lib/sisu/v5/texpdf.rb b/lib/sisu/v5/texpdf.rb index 7a98d9fa..08a3c953 100644 --- a/lib/sisu/v5/texpdf.rb +++ b/lib/sisu/v5/texpdf.rb @@ -112,7 +112,7 @@ module SiSU_TeX @md=@particulars.md SiSU_Screen::Ansi.new(@opt.cmd,'LaTeX/PDF',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_title_hi unless @opt.cmd =~/q/ if @opt.cmd =~/[MVv]/ - path=@env.url.output_tell + @env.url.output_tell if @md.opt.act[:pdf_l][:set]==:on SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}pdf").flow end @@ -229,7 +229,6 @@ module SiSU_TeX pwd=Dir.pwd Dir.chdir(pwd) #watch @tex_f_no=0 - info={} if FileTest.file?(@env.source_file_with_path) @md.papersize_array.each do |ps| if @md.fns =~/\.(?:-|ssm\.)?sst$/ @@ -505,8 +504,6 @@ module SiSU_TeX dob end def markup_common(dob) - tex_f=nil - txt_obj={ dal: dob } if dob.of==:block @lineone=if dob.is==:block \ || dob.is==:group \ @@ -711,7 +708,6 @@ module SiSU_TeX end def markup(data) @tex_file=[] - md={} home=@vz.txt_home.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex title=@md.title.full.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex @md.papersize_array.each do |ps| @@ -726,7 +722,7 @@ module SiSU_TeX @@tex_head[ps][:l]=orient_landscape.document_head_with_orientation(@codeblock_box) end end - @tex_file <<<<-WOK + @tex_file << <<-WOK #{@tex_ml.header}#{@tex_ml.footer} \\tolerance=300 \\clubpenalty=300 @@ -757,9 +753,6 @@ module SiSU_TeX % \\sloppy \\begin{document} WOK - sisu_rc_footnote=if @md.sc_info then @tex_ml.doc_sc_info_footnote_full - else @tex_ml.doc_sc_info_footnote_brief - end @copymark='' #check and remove as now is superflous x={} txt_obj={ title: @md.title.full } @@ -800,7 +793,7 @@ module SiSU_TeX @tex_file << unless @md.fnb =~/^mail\s*$/ then @tex_ml.site else '\date' end - @tex_file <<<<-WOK + @tex_file << <<-WOK \\pagenumbering{roman}\\maketitle \\pagestyle{fancy} WOK @@ -911,7 +904,6 @@ module SiSU_TeX dob end def number_paras(data) - tex_file=[] data.each do |dob| dob=if dob.is_a?(Hash) if ( dob['a4'] \ diff --git a/lib/sisu/v5/texpdf_format.rb b/lib/sisu/v5/texpdf_format.rb index df6c5a25..9e71e128 100644 --- a/lib/sisu/v5/texpdf_format.rb +++ b/lib/sisu/v5/texpdf_format.rb @@ -130,7 +130,7 @@ module SiSU_TeX_Pdf def longtable_landscape end_table='\end{longtable}' row_break='\\\\\\' - txt=if @dob.is==:table + if @dob.is==:table tw=case @dob.tmp[:paper_size] when /a4/i; @tx.a4.landscape.w #European default, SiSU default when /letter/i; @tx.letter.landscape.w #U.S. default @@ -175,7 +175,7 @@ module SiSU_TeX_Pdf def longtable_portrait end_table='\end{longtable}' row_break='\\\\\\' - txt=if @dob.is==:table + if @dob.is==:table tw=case @dob.tmp[:paper_size] when /a4/i; @tx.a4.portrait.w #European default, SiSU default when /letter/i; @tx.letter.portrait.w #U.S. default @@ -488,8 +488,6 @@ module SiSU_TeX_Pdf end def url_str_internal(str,idx=nil) map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags - rgx_url_generic=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/m - rgx_url_relative=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}:\S+?#{Mx[:rel_c]}/m rgx_url_internal=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}#?\S+?#{Mx[:rel_c]}/m while str =~/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/m link,url=$1,$2 @@ -581,7 +579,7 @@ module SiSU_TeX_Pdf images_hash={ } generic_rgx=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image\b)/m rgx_url_generic=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/m - url_bare_rgx=/#{Mx[:url_o]}\S+?#{Mx[:url_c]}/m + #url_bare_rgx=/#{Mx[:url_o]}\S+?#{Mx[:url_c]}/m url_image_rgx=/#{Mx[:lnk_o]}[a-zA-Z0-9_\\-]+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/m image_rgx=/#{Mx[:lnk_o]}[a-zA-Z0-9_\\-]+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}image/m @md.papersize_array.each do |ps| @@ -614,7 +612,7 @@ module SiSU_TeX_Pdf end if images_hash[ps] =~/#{Mx[:lnk_o]}\s*\S+\.?(?:png|jpg|gif)/m \ and images_hash[ps]=~/\s+\d+x\d+(\s+|\s*#{Mx[:lnk_c]})/m - image,x,y=z.scan(/\S+/) + image=z.scan(/\S+/)[0] #image,x,y=z.scan(/\S+/) image.gsub!(/\\/,'') w=((z =~/\s(\d+)x\d*/) ? z[/\s(\d+)x\d*/,1] : 200) width={} @@ -645,8 +643,6 @@ module SiSU_TeX_Pdf pt=/(\/\S+?\/sisupod\/\S+?\/sisupod)\/doc/.match(@md.opt.f_pth[:pth])[1] img_src=pt + '/image' if FileTest.file?("#{img_src}/#{image}") - img_src - case images_hash[ps] when url_image_rgx images_hash[ps].sub!(url_image_rgx, @@ -699,7 +695,6 @@ module SiSU_TeX_Pdf end #while loop images_hash end - images_hash use_images_hash={} images_hash.each do |k,t| use_images_hash[k]={ l: t, p: t} @@ -1425,7 +1420,7 @@ module SiSU_TeX_Pdf "\\rhead[ ]{ }\n" end def footer - f="\\lfoot[\\textrm{\\thepage}]{\\tiny \\href{#{@md.footer_links[:left][:url]}}{#{@md.footer_links[:left][:say]}}}\n" + + "\\lfoot[\\textrm{\\thepage}]{\\tiny \\href{#{@md.footer_links[:left][:url]}}{#{@md.footer_links[:left][:say]}}}\n" + "\\cfoot{\\href{#{@md.footer_links[:center][:url]}}{#{@md.footer_links[:center][:say]}}}\n" + "\\rfoot[\\tiny \\href{}{}]{\\textrm{\\thepage}}\n" end @@ -1518,7 +1513,6 @@ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu } \\\\ end def doc_tail dir=SiSU_Env::InfoEnv.new(@md.fns) - base_html="#{dir.url.root}/#{@md.fnb}" v=SiSU_Env::InfoVersion.instance.get_version sisu_ico=if FileTest.file?("#{dir.path.image_source_include}/sisu.png") "\\includegraphics*[width=60pt]{#{dir.path.image_source_include}/sisu.png}" diff --git a/lib/sisu/v5/update.rb b/lib/sisu/v5/update.rb index c311b77c..2d2a4115 100644 --- a/lib/sisu/v5/update.rb +++ b/lib/sisu/v5/update.rb @@ -96,7 +96,7 @@ module SiSU_UpdateControlFlag if FileTest.file?("#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}")==true flag=flag + 'a' end - if FileTest.file?("#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_seg}")==true + if FileTest.file?("#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_seg}")==true \ or FileTest.file?("#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}")==true flag=flag + 'h' end diff --git a/lib/sisu/v5/urls.rb b/lib/sisu/v5/urls.rb index 0a583f99..40bb90ed 100644 --- a/lib/sisu/v5/urls.rb +++ b/lib/sisu/v5/urls.rb @@ -236,8 +236,6 @@ module SiSU_Urls and opt.cmd =~/[abcehHmNoptwxXy]/ \ and x=~/^[#{opt.cmd}]/ \ and opt.cmd =~/[MV]/ - m=$1 - f=y tool=@prog.text_editor if x =~/^m/ \ and @opt.cmd=~/m/ \ @@ -247,7 +245,7 @@ module SiSU_Urls if x=~/^([hw])/ \ and @opt.cmd=~/[hw]/ \ and x=~/^[#{@opt.cmd}]/ \ - and x !~/segmented/; "#{y}.html" + and x !~/segmented/ SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.tune}/#{@md.fns}.tune").maintenance end if x=~/^p/ \ @@ -417,7 +415,7 @@ module SiSU_Urls i="(output manifest) [#{@opt.f_pth[:lng_is]}] #{@env.url.output_tell}/#{@fnb}/sisu_manifest.html" SiSU_Screen::Ansi.new(@opt.cmd,'URLs',i).grey_title_hi @u.each do |x,y| - tell=case x + case x when /^m/ show.meta(x,y) when /^[BcdNsxXy]/ diff --git a/lib/sisu/v5/webrick.rb b/lib/sisu/v5/webrick.rb index 67c44d50..021a03a4 100644 --- a/lib/sisu/v5/webrick.rb +++ b/lib/sisu/v5/webrick.rb @@ -74,7 +74,6 @@ module SiSU_Webserv @env=SiSU_Env::InfoEnv.new port=SiSU_Env::InfoPort.new @host=@env.url.webrick - host='localhost' @port=port.webrick @serve=[] Dir.foreach(@env.path.webserv) do |x| @@ -124,7 +123,7 @@ module SiSU_Webserv page.p {page.b{"Webrick Served Directories: "}} + WOK #% wb_s2 (mounts) - @mount.each do |x,y| wb_s2 <<<<WOK + @mount.each do |x,y| wb_s2 << <<WOK page.p {page.b{'<a href="#{@host}:#{@port}#{x}/">#{x}</a> '} + '<a href="#{@host}:#{@port}#{x}/">#{@host}:#{@port}#{x}</a> (mounts: #{y}/) <a href="#{@host}:#{@port}#{x}/wb.cgi">info (wb.cgi)</a>'} + WOK end diff --git a/lib/sisu/v5/wikispeak.rb b/lib/sisu/v5/wikispeak.rb index e9ada3be..ea6c8fe1 100644 --- a/lib/sisu/v5/wikispeak.rb +++ b/lib/sisu/v5/wikispeak.rb @@ -68,7 +68,6 @@ module SiSU_Wikispeak require_relative 'plaintext_format' # plaintext_format.rb include Format require_relative 'shared_txt' - pwd=Dir.pwd @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' class Source @@ -136,7 +135,7 @@ module SiSU_Wikispeak end end format=@format.dup - @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{#Mx[:id_c]}$/ + @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/ Format::FormatTextObject.new(format,@text,@ocn) else Format::FormatTextObject.new(format,@text,"#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}") @@ -164,9 +163,8 @@ module SiSU_Wikispeak publish end # Used for extraction of endnotes from paragraphs - def extract_endnotes(para='') - notes=para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*#{Mx[:id_o]}#{@dp}#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/) - @n=[] + def extract_endnotes(para='') #check + para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*#{Mx[:id_o]}#{@dp}#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/) end def wiki_metadata(meta) util=SiSU_TextUtils::Wrap.new(meta.text,70,15,1) @@ -212,8 +210,6 @@ WOK end def wiki_structure(para='',lv='',ocn='',hname='') #% Used to extract the structure of a document lv=lv.to_i - n=lv - 1 - n3=lv + 2 lv=nil if lv==0 extract_endnotes(para) para.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(?:[\d*+]+)\s+(.+?)#{Mx[:id_o]}#{@dp}#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,'<ref>\1</ref>') # endnote marker marked up @@ -231,13 +227,12 @@ WOK end def markup # Used for major markup instructions data=@data - dir=SiSU_Env::InfoEnv.new(@md.fns) + SiSU_Env::InfoEnv.new(@md.fns) @data_mod,@endnotes,@level,@cont,@copen,@wiki_contents_close=Array.new(6){[]} (0..6).each { |x| @cont[x]=@level[x]=false } (4..6).each { |x| @wiki_contents_close[x]='' } wiki_tail table_message='[table omitted, see other document formats]' - fix=[] data.each do |para| para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{@br}#{table_message}") #fix para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check @@ -259,7 +254,6 @@ WOK para.gsub!(/ |#{Mx[:nbsp]}/,' ') # decide on para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]') - wordlist=para.scan(/\S+/) if para =~/^@(\S+?):\s+(.+?)\Z/m # for headers d_meta=SiSU_TextUtils::HeaderScan.new(@md,para).meta if d_meta; wiki_metadata(d_meta) @@ -342,9 +336,7 @@ WOK end end def publish - divider="=" content=[] - data=@data content << @@wiki[:open] content << @@wiki[:head] content << @@wiki[:body] diff --git a/lib/sisu/v5/xhtml.rb b/lib/sisu/v5/xhtml.rb index 2b972e0e..3bb332ce 100644 --- a/lib/sisu/v5/xhtml.rb +++ b/lib/sisu/v5/xhtml.rb @@ -84,8 +84,6 @@ module SiSU_XHTML begin @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array unless @opt.cmd =~/q/ - path=@env.path.output_tell - loc=@env.url.output_tell tool=if @opt.cmd =~/[MV]/ "#{@env.program.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}" elsif @opt.cmd =~/v/ @@ -196,7 +194,7 @@ WOK if defined? dob.tags \ and dob.tags.length > 0 # insert tags "hypertargets" dob.tags.each do |t| - tags=tags +%{<named id="#{t}" />} + tags=tags << %{<named id="#{t}" />} end end tags @@ -207,8 +205,7 @@ WOK named=name_tags(dob) if dob.is==:heading lv=dob.ln - n=dob.ln - 1 - n3=dob.ln + 2 + dob.ln + 2 else lv=nil end extract_endnotes(dob) @@ -367,7 +364,6 @@ WOK end def pre rdf=SiSU_XML_Tags::RDF.new(@md) - dir=SiSU_Env::InfoEnv.new @@xml[:head],@@xml[:body]=[],[] stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xhtml').stylesheet encoding=(@sys.locale =~/utf-?8/i) ? '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' : '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>' diff --git a/lib/sisu/v5/xml.rb b/lib/sisu/v5/xml.rb index 913d1afc..a5048746 100644 --- a/lib/sisu/v5/xml.rb +++ b/lib/sisu/v5/xml.rb @@ -84,8 +84,6 @@ module SiSU_XML_SAX begin @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array unless @opt.cmd =~/q/ - path=@env.path.output_tell - loc=@env.url.output_tell tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}\n\t#{@env.program.xml_viewer} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}" elsif @opt.cmd =~/v/; "#{@env.program.web_browser} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}" else "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" @@ -216,8 +214,7 @@ WOK def xml_structure(dob,type='norm') if dob.is==:heading lv=dob.ln - n=dob.ln - 1 - n3=dob.ln + 2 + dob.ln + 2 else lv=nil end extract_endnotes(dob) @@ -404,7 +401,6 @@ WOK end def pre rdf=SiSU_XML_Tags::RDF.new(@md) - dir=SiSU_Env::InfoEnv.new @@xml[:head],@@xml[:body]=[],[] stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xml_sax').stylesheet encoding=if @sys.locale =~/utf-?8/i; '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' diff --git a/lib/sisu/v5/xml_dom.rb b/lib/sisu/v5/xml_dom.rb index 80dc397d..d22e0434 100644 --- a/lib/sisu/v5/xml_dom.rb +++ b/lib/sisu/v5/xml_dom.rb @@ -85,8 +85,6 @@ module SiSU_XML_DOM |