diff options
author | Ralph Amissah <ralph@amissah.com> | 2014-07-22 21:30:56 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2014-07-22 21:30:56 -0400 |
commit | 41796e30e4597c74e7e42c3144dbe5d4fb0687c5 (patch) | |
tree | d0615cafae5362873706f04595ee5b9333a758c3 /lib/sisu/v6/sysenv.rb | |
parent | v5 v6: version & changelog (& rakefile) (diff) |
v5 v6: cosmetic code
Diffstat (limited to 'lib/sisu/v6/sysenv.rb')
-rw-r--r-- | lib/sisu/v6/sysenv.rb | 1205 |
1 files changed, 775 insertions, 430 deletions
diff --git a/lib/sisu/v6/sysenv.rb b/lib/sisu/v6/sysenv.rb index 72aaf2b9..196a757d 100644 --- a/lib/sisu/v6/sysenv.rb +++ b/lib/sisu/v6/sysenv.rb @@ -110,11 +110,12 @@ module SiSU_Env rescue LoadError SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rbconfig NOT FOUND (LoadError)') end - @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@rc,@@sisurc_path,@@ad=ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD'],Config::CONFIG['sysconfdir'] + '/sisu',Config::CONFIG['host'],Config::CONFIG['arch'],%x{ruby -v}.strip,Config::CONFIG['archdir'],Config::CONFIG['sitearchdir'],Config::CONFIG['bindir'],%x{locale charmap}.strip,nil,nil,{} # %x{ruby -v}.strip # Config::CONFIG['rb_ver'] + @@user, @@home, @@hostname, @@pwd, @@sisu_etc, @@host, @@arch, @@rbver, @@dir_arch, @@dir_sitearch, @@dir_bin, @@locale, @@rc,@@sisurc_path,@@ad= + ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD'],Config::CONFIG['sysconfdir'] + '/sisu',Config::CONFIG['host'],Config::CONFIG['arch'],%x{ruby -v}.strip,Config::CONFIG['archdir'],Config::CONFIG['sitearchdir'],Config::CONFIG['bindir'],%x{locale charmap}.strip,nil, nil, {} # %x{ruby -v}.strip # Config::CONFIG['rb_ver'] out=Config::CONFIG['localstatedir'] etc=Config::CONFIG['sysconfdir'] + '/sisu' - share=Config::CONFIG['datadir'] + '/sisu' - data=Config::CONFIG['datadir'] + '/doc/sisu' + share=Config::CONFIG['datadir'] + '/sisu' + data=Config::CONFIG['datadir'] + '/doc/sisu' m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m @base_markup_dir_stub=SiSU_Utils::Path.new.base_markup_stub prcss_dir='_sisu_processing_' + '.' + SiSU_is[:version_dir] @@ -229,8 +230,8 @@ module SiSU_Env @@pwd=@pwd=SiSU_Utils::Path.new.base_markup 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=\ - @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir + @user, @home, @hostname, @pwd, @sisu_etc, @host, @arch, @rbver, @dir_arch, @dir_sitearch, @dir_bin, @locale, @default_dir= + @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir #note rbver is duplicated in InfoVersion end end @@ -259,14 +260,16 @@ module SiSU_Env begin require 'dbi' rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('dbi NOT FOUND (LoadError)') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('dbi NOT FOUND (LoadError)') end end if load_prog begin require @prog rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error("#{@prog} NOT FOUND (LoadError)") + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error("#{@prog} NOT FOUND (LoadError)") end else @mandatory \ @@ -355,7 +358,8 @@ module SiSU_Env begin require 'yaml' rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('yaml NOT FOUND (LoadError)') end @@sisurc_path=v @@rc=YAML::load(File::open(p_f)) @@ -368,7 +372,8 @@ module SiSU_Env begin require 'yaml' rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('yaml NOT FOUND (LoadError)') end @@sisurc_path=v @@rc=YAML::load(File::open(p_f)) @@ -411,7 +416,8 @@ module SiSU_Env begin require 'yaml' rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('yaml NOT FOUND (LoadError)') end @@ad[:promo_list] ||= YAML::load(File::open("#{v}/list.yml")) end @@ -433,7 +439,8 @@ module SiSU_Env begin require 'yaml' rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('yaml NOT FOUND (LoadError)') end @@ad[:promo] ||= YAML::load(File::open("#{v}/promo.yml")) end @@ -639,12 +646,14 @@ module SiSU_Env fns_c="#{@fn[:m]}~#{lng.code}.#{@fn[:t]}" fns_l="#{@fn[:m]}~#{lng.name}.#{@fn[:t]}" if FileTest.file?(fns_c) - fn_set_lang=SiSU_Env::StandardiseLanguage.new.file_to_language(fns_c) #reconsider file_to_language + fn_set_lang=SiSU_Env::StandardiseLanguage.new. + file_to_language(fns_c) #reconsider file_to_language lng=fn_set_lang[:n] fn=SiSU_Env::EnvCall.new(fns_c).lang(fn_set_lang[:c]) @m << { m: fn[:manifest], l: lng } elsif FileTest.file?(fns_l) - fn_set_lang=SiSU_Env::StandardiseLanguage.new.file_to_language(fns_l) #reconsider file_to_language + fn_set_lang=SiSU_Env::StandardiseLanguage.new. + file_to_language(fns_l) #reconsider file_to_language @fnl=dir.i18n.lang_filename(fn_set_lang[:c]) fn=SiSU_Env::EnvCall.new(fns_l).lang(fn_set_lang[:c]) @m << { m: fn[:manifest], l: lng } @@ -717,13 +726,13 @@ module SiSU_Env found=`which #{program}` #`whereis #{program}` (found =~/bin\/#{program}\b/) ? true : false end - def locale #locales utf8 or other + def locale #locales utf8 or other unless @@locale_flag @@locale_flag=true end @sys.locale end - def file_encoding(filename,cmd='') #file encoding + def file_encoding(filename,cmd='') #file encoding program='file' fnsp=SiSU_Env::InfoEnv.new(filename).source_file_with_path if program_found?(program) @@ -739,7 +748,7 @@ module SiSU_Env else encoding='UTF-8 assumed, file encoding check program unavailable' end end - def wc #word count + def wc #word count program='wc' if program_found?(program) \ and locale !~/utf-?8/i @@ -750,39 +759,47 @@ module SiSU_Env false end end - def rcs #rcs for document markup data + def rcs #rcs for document markup data program='rcs' program_ref="\n\t\tdocument version information requested" if program_found?(program); true - else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") + else + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + warn("#{program} is not installed #{program_ref}") false end end - def cvs #cvs for document markup data + def cvs #cvs for document markup data program='cvs' program_ref="\n\t\tdocument version information requested" if program_found?(program); true - else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") + else + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + warn("#{program} is not installed #{program_ref}") false end end - def zip #zip + def zip #zip program='zip' program_ref="\n\t\tused to in the making of number of file formats, odf, epub" if program_found?(program); true - else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).mark("*WARN* #{program} is not installed #{program_ref}") + else + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + mark("*WARN* #{program} is not installed #{program_ref}") false end end - def openssl #openssl for digests + def openssl #openssl for digests program='openssl' program_ref="\n\t\tused to generate requested source document identification digest" if program_found?(program); true - else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") + else + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + warn("#{program} is not installed #{program_ref}") false end end - def md5(filename) #md5 dgst + def md5(filename) #md5 dgst program='openssl' program_ref="\n\t\tmd5 digest requested" if program_found?(program) @@ -791,11 +808,13 @@ module SiSU_Env dgst=%x{openssl dgst -md5 #{File.basename(filename)}}.strip #use file name without file path Dir.chdir(pwd) dgst.scan(/\S+/) - else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") + else + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + warn("#{program} is not installed #{program_ref}") false end end - def sha256(filename) #sha dgst + def sha256(filename) #sha dgst program='openssl' program_ref="\n\t\tsha digest requested" if program_found?(program) @@ -804,11 +823,13 @@ module SiSU_Env dgst=%x{openssl dgst -sha256 #{File.basename(filename)}}.strip #use file name without file path Dir.chdir(pwd) dgst.scan(/\S+/) - else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") + else + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + warn("#{program} is not installed #{program_ref}") false end end - def sha512(filename) #sha dgst + def sha512(filename) #sha dgst program='openssl' program_ref="\n\t\tsha digest requested" if program_found?(program) @@ -817,19 +838,23 @@ module SiSU_Env dgst=%x{openssl dgst -sha512 #{File.basename(filename)}}.strip #use file name without file path Dir.chdir(pwd) dgst.scan(/\S+/) - else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") + else + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + warn("#{program} is not installed #{program_ref}") false end end - def psql #psql + def psql #psql program='psql' program_ref="\n\t\tpsql requested" if program_found?(program); true - else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") + else + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + warn("#{program} is not installed #{program_ref}") false end end - def create_pg_db(dbname_stub=nil) #createdb + def create_pg_db(dbname_stub=nil) #createdb unless dbname_stub @pwd ||=Dir.pwd m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m @@ -842,14 +867,14 @@ module SiSU_Env ? system("#{program} #{dbname_name}") : (STDERR.puts "\t*WARN* #{program} is not available #{program_ref}") end - def relaxng(cmd='') #trang - convert between different schema languages for XML + def relaxng(cmd='') #trang - convert between different schema languages for XML program='trang' program_ref="\n\t\tsee <http://www.thaiopensource.com/relaxng/trang.html>" (program_found?(program)) \ ? system("#{program} #{@input} #{@output}") : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if cmd =~/V/) end - def qrencode #qrcode - for generating QR code + def qrencode #qrcode - for generating QR code program='qrencode' program_ref="\n\t\tsee <http://megaui.net/fukuchi/works/qrencode/index.en.html>" found=(program_found?(program)) ? true : false @@ -860,21 +885,21 @@ module SiSU_Env : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if @cmd =~/V/) #found end - def imagemagick #imagemagick is a image manipulation program + def imagemagick #imagemagick is a image manipulation program program='identify' #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 + def graphicksmagick #graphicsmagick is a image manipulation program program='gm' #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 end - def well_formed? #tidy - check for well formed xml xhtml etc. + def well_formed? #tidy - check for well formed xml xhtml etc. program=@prog.tidy program_ref="\n\t\tsee <http://tidy.sourceforge.net/>" (program_found?(program)) \ @@ -898,7 +923,7 @@ module SiSU_Env end @texpdf end - def latex2pdf(md,papersize='a4') #convert from latex to pdf + def latex2pdf(md,papersize='a4') #convert from latex to pdf tell=if @cmd =~/[MV]/ '' elsif @cmd =~/[v]/ @@ -922,7 +947,7 @@ module SiSU_Env else STDERR.puts "\t*WARN* none of the following programs are installed: #{@texpdf}" end end - def makeinfo #texinfo + def makeinfo #texinfo program='makeinfo' options='' #'--force' #'' program_ref="\n\t\tsee http://www.gnu.org/software/texinfo/" @@ -949,17 +974,17 @@ module SiSU_Env : ((@cmd =~/[vVM]/) ? '' : '&') rsync_cmd="rsync -az#{vb} #{action} #{@input} #{@output}" puts rsync_cmd if @cmd =~/[vVM]/ - dir_change,dir_return='','' + dir_change=dir_return=nil if not chdir.nil? \ && chdir != Dir.pwd dir_change=Dir.chdir(chdir) dir_return=Dir.pwd end - dir_change #check + dir_change if dir_change system(" #{rsync_cmd} #{msg} #{amp} ") - dir_return + dir_return if dir_return else STDERR.puts "\t*WARN* #{program} not found" end end @@ -981,10 +1006,10 @@ module SiSU_Env @r=%{(?:#{Px[:lng_lst_rgx]})} @lang_info=SiSU_i18n::Languages.new end - def lang_lst # from i18n + def lang_lst # from i18n @@lang_info ||=@lang_info.language.list end - def lang(l='') # from i18n + def lang(l='') # from i18n if l =~/^#{@r}$/ @lang_info.language.list[l] elsif @language =~/^#{@r}$/ @@ -1069,7 +1094,7 @@ module SiSU_Env def tex_name language[:xlp] end - def file_to_language(file) # used, fix and remove + def file_to_language(file) # used, fix and remove m=/.+?\~(\w{2,3})\.(?:-|ssm\.)?sst$/ @language=if file =~m ; file[m,1] else '' @@ -1142,7 +1167,8 @@ module SiSU_Env elsif output_dir_structure.by_filename? '' else - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn('set output type, by: language, filetype or filename') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + warn('set output type, by: language, filetype or filename') end @stub_set_manifest=stub + '/manifest' end @@ -1170,7 +1196,7 @@ module SiSU_Env ? @rc['processing']['concord_max'] : (defaults[:concord_max]) end - def language_default_set #set directory (default) language + def language_default_set #set directory (default) language ((defined? @rc['default']['language']) \ && @rc['default']['language'] =~/\S+/) \ ? @rc['default']['language'] @@ -1205,10 +1231,10 @@ module SiSU_Env @@current_document||=Dir.pwd @@current_document end - def base_markup_dir_stub #200412 + def base_markup_dir_stub @base_markup_dir_stub end - def stub_md_harvest #watch + def stub_md_harvest #watch @stub_set_manifest end def stub_src @@ -1240,7 +1266,8 @@ module SiSU_Env FileUtils::rm_rf(spp) end paths=[] - flv=SiSU_Env::EnvCall.new(opt.fns).document_language_versions_found + flv=SiSU_Env::EnvCall.new(opt.fns). + document_language_versions_found flv[:f].each {|l| lng_dirs << l[:l] } lng_dirs.uniq.each do |lng| paths << "#{spp}/doc/#{lng}" @@ -1287,7 +1314,8 @@ module SiSU_Env FileUtils::rm_rf(spp) end paths=[] - flv=SiSU_Env::EnvCall.new(opt.fns).document_language_versions_found + flv=SiSU_Env::EnvCall.new(opt.fns). + document_language_versions_found flv[:f].each {|l| lng_dirs << l[:l] } lng_dirs.uniq.each do |lng| paths << "#{spp}/doc/#{lng}" @@ -1336,7 +1364,7 @@ module SiSU_Env ] paths.each {|x| FileUtils::mkdir_p(x) unless FileTest.directory?(x) } end - def defaults #multiple default directories + def defaults #multiple default directories @default_dir ||=@sys.default_dir #DEFAULT_DIR end def html_seg_title_banner? @@ -1585,7 +1613,12 @@ module SiSU_Env @rc=SiSU_Env::GetInit.new.sisu_yaml.rc @ad=SiSU_Env::GetInit.new.ads @vz=SiSU_Viz::Defaults.new - @flag={ ad: false, md: false, sk: false, rc: false } + @flag={ + ad: false, + md: false, + sk: false, + rc: false + } def promo? @flag[:ad]=if @md.flag_promo && @ad[:flag_promo] @flag[:md]=true @@ -1883,7 +1916,8 @@ WOK && (@rc['default']['pdf_hyperlinks']=~/color/) :color elsif (defined? @rc['default']['pdf_hyperlinks']) \ - && (@rc['default']['pdf_hyperlinks']=~/(?:no-color|color-off|mono(?:chrome)?)/) + && (@rc['default']['pdf_hyperlinks'] \ + =~/(?:no-color|color-off|mono(?:chrome)?)/) :mono else :na end @@ -1894,7 +1928,8 @@ WOK && (@rc['default']['pdf_hyperlinks_landscape']=~/color/) :color elsif (defined? @rc['default']['pdf_hyperlinks_landscape']) \ - && (@rc['default']['pdf_hyperlinks_landscape']=~/(?:no-color|color-off|mono(?:chrome)?)/) + && (@rc['default']['pdf_hyperlinks_landscape'] \ + =~/(?:no-color|color-off|mono(?:chrome)?)/) :mono elsif @hyplnks != :na @hyplnks @@ -1908,7 +1943,8 @@ WOK && (@rc['default']['pdf_hyperlinks_portrait']=~/color/) :color elsif (defined? @rc['default']['pdf_hyperlinks_portrait']) \ - && (@rc['default']['pdf_hyperlinks_portrait']=~/(?:no-color|color-off|mono(?:chrome)?)/) + && (@rc['default']['pdf_hyperlinks_portrait'] \ + =~/(?:no-color|color-off|mono(?:chrome)?)/) :mono elsif @hyplnks != :na @hyprlnks @@ -1937,13 +1973,13 @@ WOK ? @rc['default']['texpdf_fontface'] : 'Liberation Sans' end - def sans # not used + def sans # not used (defined? @rc['default']['texpdf_fontface_sans']) \ && (@rc['default']['texpdf_fontface_sans']=~/\S{3,}/) \ ? @rc['default']['texpdf_fontface_sans'] : 'Liberation Sans' end - def serif # not used + def serif # not used (defined? @rc['default']['texpdf_fontface_serif']) \ && (@rc['default']['texpdf_font_serif']=~/\S{3,}/) \ ? @rc['default']['texpdf_fontface_serif'] @@ -2038,7 +2074,11 @@ WOK def read_source_file_array(fns) (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)) + : (IO.readlines( + "#{processing_path.composite_file}/#{fns}", + mode: 'r:utf-8', + cr_newline: true + )) end def read_source_file(fns) read_source_file_array(fns) @@ -2046,12 +2086,16 @@ WOK def read_source_file_string(fns) (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)) + : (IO.read( + "#{processing_path.composite_file}/#{fns}", + mode: 'r:utf-8', + cr_newline: true + )) end def source_file_processing_array(fns) read_source_file_string(fns).split(/\s*\n\s*\n/m) end - def path #dir + def path #dir def home @sys.home end @@ -2085,8 +2129,10 @@ WOK def bin @sys.dir_bin end - def share #shared data repository source directory - defaults[:sisu_share] #; p __LINE__.to_s + ':' + __FILE__ + ' ' + defaults[:sisu_share] + def share #shared data repository source directory + #SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green). + # mark(defaults[:sisu_share]) + defaults[:sisu_share] end def style if @md \ @@ -2099,7 +2145,7 @@ WOK defaults[:stylesheet_stub] end end - def sample_data #sample data repository source directory + def sample_data #sample data repository source directory defaults[:sample_data_path] end def rc @@ -2116,7 +2162,7 @@ WOK def webserv_path #testing, check need, remove webserv end - def webserv #separation required for webrick which cannot use path.output (different requirements as no file is passed) + def webserv #separation required for webrick which cannot use path.output (different requirements as no file is passed) man_path=if @@man_path.nil? man_path=if defined? @rc['webserv']['path'] \ and @rc['webserv']['path'] =~/\S\S+/ @@ -2154,17 +2200,17 @@ WOK def webserv_map_pwd #dir "#{path.webserv}/#{base_markup_dir_stub}" end - def webserv_dir #fixed/hard path to /www web/presentation directory, on Debian /var/www subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name) + def webserv_dir #fixed/hard path to /www web/presentation directory, on Debian /var/www subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name) defaults[:webserv_dir] end - def webserv_image #web/presentation directory, subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name) + def webserv_image #web/presentation directory, subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name) images=if defined? @rc['webserv']['images'] @rc['webserv']['images'] else defaults[:images] end "#{path.webserv}/#{images}" end - def output #web/webserv output directory... subdirectory into which further subdirectories are made based on file names + def output #web/webserv output directory... subdirectory into which further subdirectories are made based on file names r=Px[:lng_lst_rgx] u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ base_stub=@sys.pwd.gsub(u,'\1') @@ -2183,7 +2229,8 @@ WOK "#{public_output}/#{@rc['webserv']['feed_home']}" end def scripts #used previously only to include tla version info - if defined? @rc['project']['path']; "#{home}/#{@rc['project']['path']}" + if defined? @rc['project']['path'] + "#{home}/#{@rc['project']['path']}" end end def cgi @@ -2196,11 +2243,11 @@ WOK ? "#{public_output}/#{@rc['webserv']['php']}" : (defaults[:webserv_php]) end - # programs + #% programs def output_tell url.webserv_map_pwd end - def image_source #image repository source directory + def image_source #image repository source directory if defined? @rc['image']['path'] \ and defined? @rc['image']['public'] pth="#{@rc['image']['path']}" @@ -2212,14 +2259,18 @@ WOK def image_source_sisu_includes "#{share}/image" end - def image_source_include #image repository source directory + def image_source_include #image repository source directory if defined? @rc['image']['path'] \ and defined? @rc['image']['public'] \ - and FileTest.directory?("#{@rc['image']['path']}/#{@rc['image']['public']}")==true + and FileTest.directory?( + "#{@rc['image']['path']}/#{@rc['image']['public']}" + )==true "#{@rc['image']['path']}/#{@rc['image']['public']}" elsif FileTest.directory?("#{@@pwd}/#{defaults[:image_stub]}")==true "#{@@pwd}/#{defaults[:image_stub]}" - elsif FileTest.directory?("#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}")==true + elsif FileTest.directory?( + "#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}" + )==true "#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}" else "#{share}/image" @@ -2229,7 +2280,8 @@ WOK "#{processing}/external_document/image" end def image_source_include_local - if FileTest.directory?(defaults[:image_local]); defaults[:image_local] + if FileTest.directory?(defaults[:image_local]) + defaults[:image_local] end end def image_source_include_remote @@ -2296,13 +2348,19 @@ WOK ? ("#{root_dir}/#{user}/#{base_markup_dir_stub}") : ("#{root_dir}/#{base_markup_dir_stub}") # see defaults[:processing_path] end - def processing_sisupod(opt=nil) #processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc) + def processing_sisupod(opt=nil) #processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc) @opt=opt def paths processing_path_usr="#{root_dir}/#{user}" - processing_path_fnb=processing_path_usr + '/' + Gt[:pods] + '/' + @opt.fng - processing_path_sisupod=processing_path_fnb + '/' + Gt[:sisupod] - { fnb: processing_path_fnb, sisupod: processing_path_sisupod } + processing_path_fnb=processing_path_usr \ + + '/' + Gt[:pods] \ + + '/' + @opt.fng + processing_path_sisupod=processing_path_fnb \ + + '/' + Gt[:sisupod] + { + fnb: processing_path_fnb, + sisupod: processing_path_sisupod, + } end def make unless FileTest.directory?(root_dir) @@ -2311,15 +2369,20 @@ WOK end if usr_dir? processing_path_usr="#{root_dir}/#{user}" - FileUtils::mkdir_p(processing_path_usr) unless FileTest.directory?(processing_path_usr) + FileUtils::mkdir_p(processing_path_usr) \ + unless FileTest.directory?(processing_path_usr) File.chmod(0700,processing_path_usr) end sisupod_processing_path=paths[:sisupod] - FileUtils::mkdir_p(sisupod_processing_path) unless FileTest.directory?(sisupod_processing_path) + FileUtils::mkdir_p(sisupod_processing_path) \ + unless FileTest.directory?(sisupod_processing_path) sisupod_processing_path_lng=if defined? @opt.lng - sisupod_processing_path + '/' + Gt[:doc] + '/' + @opt.lng + sisupod_processing_path \ + + '/' + Gt[:doc] \ + + '/' + @opt.lng else - sisupod_processing_path + '/' + Gt[:doc] + sisupod_processing_path \ + + '/' + Gt[:doc] end unless FileTest.directory?(sisupod_processing_path_lng) #puts "a processing directory (#{sisupod_processing_path_lng}) is being created for use by sisu" @@ -2330,19 +2393,25 @@ WOK end self end - def processing #processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc) + def processing #processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc) unless FileTest.directory?(root_dir) FileUtils::mkdir_p(root_dir) File.chmod(0777,root_dir) end if usr_dir? processing_path_usr="#{root_dir}/#{user}" - FileUtils::mkdir_p(processing_path_usr) unless FileTest.directory?(processing_path_usr) + FileUtils::mkdir_p(processing_path_usr) \ + unless FileTest.directory?(processing_path_usr) File.chmod(0700,processing_path_usr) end - FileUtils::mkdir_p(stub_dir) unless FileTest.directory?(stub_dir) + FileUtils::mkdir_p(stub_dir) \ + unless FileTest.directory?(stub_dir) File.chmod(0700,stub_dir) - path_processing=[stub_dir,defaults[:processing_path],defaults[:processing_path_home]] + path_processing=[ + stub_dir, + defaults[:processing_path], + defaults[:processing_path_home] + ] processing=nil path_processing.each do |v| # processing=v @@ -2410,22 +2479,32 @@ WOK end def odt_bld FileUtils::rm_rf(processing_path.odt) - FileUtils::mkdir_p(processing_path.odt) unless FileTest.directory?(processing_path.odt) - FileUtils::mkdir_p("#{processing_path.odt}/Configurations2") unless FileTest.directory?("#{processing_path.odt}/Configurations2") - FileUtils::mkdir_p("#{processing_path.odt}/META-INF") unless FileTest.directory?("#{processing_path.odt}/META-INF") - FileUtils::mkdir_p("#{processing_path.odt}/Pictures") unless FileTest.directory?("#{processing_path.odt}/Pictures") - FileUtils::mkdir_p("#{processing_path.odt}/Thumbnails") unless FileTest.directory?("#{processing_path.odt}/Thumbnails") + FileUtils::mkdir_p(processing_path.odt) \ + unless FileTest.directory?(processing_path.odt) + FileUtils::mkdir_p("#{processing_path.odt}/Configurations2") \ + unless FileTest.directory?("#{processing_path.odt}/Configurations2") + FileUtils::mkdir_p("#{processing_path.odt}/META-INF") \ + unless FileTest.directory?("#{processing_path.odt}/META-INF") + FileUtils::mkdir_p("#{processing_path.odt}/Pictures") \ + unless FileTest.directory?("#{processing_path.odt}/Pictures") + FileUtils::mkdir_p("#{processing_path.odt}/Thumbnails") \ + unless FileTest.directory?("#{processing_path.odt}/Thumbnails") processing_path.odt end def epub "#{processing}/epub/#{@fnb}" end def epub_bld #(md) - FileUtils::rm_rf(processing_path.epub) if FileTest.directory?(processing_path.epub) - FileUtils::mkdir_p(processing_path.epub) unless FileTest.directory?(processing_path.epub) - 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") + FileUtils::rm_rf(processing_path.epub) \ + if FileTest.directory?(processing_path.epub) + FileUtils::mkdir_p(processing_path.epub) \ + unless FileTest.directory?(processing_path.epub) + 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") processing_path.epub end def epub_cp_images(md) @@ -2435,7 +2514,8 @@ WOK images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png] images.each do |i| #move to avoid repeated tests if FileTest.file?("#{src}/#{i}") - FileUtils::cp("#{src}/#{i}","#{pth}/#{i}") unless FileTest.file?("#{pth}/#{i}") + FileUtils::cp("#{src}/#{i}","#{pth}/#{i}") \ + unless FileTest.file?("#{pth}/#{i}") else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} end end @@ -2459,7 +2539,7 @@ WOK FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) pth end - def texinfo #texinfo webserv, check + def texinfo #texinfo webserv, check "#{processing}/#{defaults[:processing_texinfo]}" end def manpage @@ -2562,24 +2642,32 @@ WOK else defaults[:webserv_host_cgi] end end - def webserv_cgi(opt=nil) #web url for local webserv (localhost, or hostname) + def webserv_cgi(opt=nil) #web url for local webserv (localhost, or hostname) http=if defined? @rc['webserv_cgi']['host'] \ and @rc['webserv_cgi']['host'].is_a?(String) http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') #check https? missing if port.webserv_port_cgi - "#{http}#{@rc['webserv_cgi']['host']}:#{port.webserv_port_cgi}/#{@base_markup_dir_stub}" - else "#{http}#{@rc['webserv_cgi']['host']}/#{@base_markup_dir_stub}" + http + @rc['webserv_cgi']['host'] + ':' \ + + port.webserv_port_cgi + '/' \ + + @base_markup_dir_stub + else + http + @rc['webserv_cgi']['host'] + '/' \ + + @base_markup_dir_stub end else http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://') if port.webserv_port_cgi(opt) - "#{http}#{webserv_host_base}:#{port.webserv_port_cgi(opt)}/#{@base_markup_dir_stub}" - else "#{http}#{webserv_host_base}/#{@base_markup_dir_stub}" + http + webserv_host_base + ':' \ + + port.webserv_port_cgi(opt) + '/'\ + + @base_markup_dir_stub + else + http + webserv_host_base + '/' \ + + @base_markup_dir_stub end end http=http.strip end - def webserv_base_cgi(opt=nil) #web url for local webserv (localhost, or hostname) + def webserv_base_cgi(opt=nil) #web url for local webserv (localhost, or hostname) http=if opt.mod.inspect =~/--webserv-(?:cgi|db|search)[=-]["']?(\S+)["']+/ m=$1 (m=~/http\/\/:/) ? m : %{http://#{m}} @@ -2587,20 +2675,23 @@ WOK and @rc['webserv_cgi']['host'].is_a?(String) http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') if port.webserv_port_cgi(opt) - "#{http}#{@rc['webserv_cgi']['host']}:#{port.webserv_port_cgi(opt)}" - else "#{http}#{@rc['webserv_cgi']['host']}" + http + @rc['webserv_cgi']['host'] + ':' \ + + port.webserv_port_cgi(opt) + else + http + @rc['webserv_cgi']['host'] end else http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://') if port.webserv_port_cgi(opt) - "#{http}#{webserv_host_base}:#{port.webserv_port_cgi(opt)}" + http + webserv_host_base + ':' \ + + port.webserv_port_cgi(opt) else "#{http}#{webserv_host_base}" end end http=http.strip #%q{http://#{ENV['HTTP_HOST']}} end - def webrick #must have a port #REMOVE + def webrick #must have a port #REMOVE if defined? @rc['webserv_cgi']['host'] \ and @rc['webserv_cgi']['host'].is_a?(String) http=if @rc['webserv_cgi']['host'] =~/http:\/\// @@ -2612,30 +2703,38 @@ WOK "#{http}#{@rc['webserv_cgi']['host']}" elsif webserv_host_base \ and webserv_host_base.is_a?(String) - "#{http}#{webserv_host_base}" - else "#{http}localhost" end + http + webserv_host_base + else + http + 'localhost' + end end - def webserv #web url for local webserv (localhost, or hostname) + def webserv #web url for local webserv (localhost, or hostname) if defined? @rc['webserv']['url_root'] \ and @rc['webserv']['url_root'] =~/http/ # needed for alternative output dir structures, fixes manifest url links, check may cause problems elsewhere @rc['webserv']['url_root'] elsif path.webserv_dir \ and path.webserv =~ /#{path.webserv_dir}/ #revisit - "#{path.webserv}/#{@base_markup_dir_stub}".gsub(/#{path.webserv_dir}/,"#{url.hostname}/#{@base_markup_dir_stub}") + path.webserv + '/' \ + + @base_markup_dir_stub. + gsub(/#{path.webserv_dir}/, + "#{url.hostname}/#{@base_markup_dir_stub}") elsif defined? @rc['webserv']['webrick_url'] \ and @rc['webserv']['webrick_url']==false - "file://#{path.webserv}" + 'file://' + path.webserv elsif port.webserv_port_cgi =~/\S+/ - "#{url.hostname}:#{port.webserv_port_cgi}" + url.hostname + ':' + port.webserv_port_cgi else url.hostname end end - def webserv_base #web url for local webserv (localhost, or hostname) + def webserv_base #web url for local webserv (localhost, or hostname) if path.webserv_dir \ and path.webserv =~ /#{path.webserv_dir}/ #revisit - "#{path.webserv}/#{@base_markup_dir_stub}".gsub(/#{path.webserv_dir}/,"#{url.hostname}") + path.webserv + '/' \ + + @base_markup_dir_stub. + gsub(/#{path.webserv_dir}/, + "#{url.hostname}") elsif defined? @rc['webserv']['webrick_url'] \ and @rc['webserv']['webrick_url']==false "file://#{path.webserv}" @@ -2657,21 +2756,23 @@ WOK when /webserv_cgi/ then url.webserv_base_cgi(opt) when /webserv/ then @rc['webserv']['url_root'] when /https?:\/\// then @rc['webserv_cgi']['file_links'] - when /\S+/ then "http://#{@rc['webserv_cgi']['file_links']}" + when /\S+/ then 'http://' + @rc['webserv_cgi']['file_links'] else webserv_base_cgi(opt) end end #%q{http://#{ENV['HTTP_HOST']}/cgi-bin} end def cgi_sample_search_form_name(opt=nil) - if opt.mod.inspect =~/--(?:cgi-)?search-form-name[=-]["']?(\S+?\.cgi)/ + if opt.mod.inspect \ + =~/--(?:cgi-)?search-form-name[=-]["']?(\S+?\.cgi)/ $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/ - /(?:https?:\/\/\S+?)\/([^\/]+?\.cgi)$/.match(@rc['search']['sisu']['action'])[1] + /(?:https?:\/\/\S+?)\/([^\/]+?\.cgi)$/. + match(@rc['search']['sisu']['action'])[1] else (opt.mod.inspect =~/--db[=-]["']?sqlite/) \ ? "#{Db[:name_prefix_db]}sqlite.cgi" \ @@ -2686,9 +2787,10 @@ WOK end title=title + " (content organised by #{organised_by})" end - def output_tell #BROKEN Revisit 2011-02 + def output_tell #BROKEN Revisit 2011-02 output_type=if defined? @rc['show_output_on'] \ - and @rc['show_output_on'] =~/^(?:filesystem|webserv|(?:local|remote)(?:_webserv)?|webrick)/ + and @rc['show_output_on'] \ + =~/^(?:filesystem|webserv|(?:local|remote)(?:_webserv)?|webrick)/ @rc['show_output_on'] else 'filesystem' end @@ -2742,7 +2844,7 @@ WOK if @@local_image==true SiSU_Screen::Ansi.new( @cmd, - "WARNING - image directory for external images or no such images:", + 'WARNING - image directory for external images or no such images:', :image_external ).warn unless @cmd =~/q/ @@local_image=false @@ -2824,9 +2926,9 @@ WOK when :sha512 then :sha512 when :sha256 then :sha256 when :md5 then :md5 - else digest_conf? + else digest_conf? end - else digest_conf? + else digest_conf? end end def length @@ -2934,48 +3036,57 @@ WOK : 'pinfo -f' #'pinfo -f' 'info' 'tkinfo' end def file_encoding - is=(defined? @rc['program_set']['file_encoding']) ? @rc['program_set']['encoding'] : '' + is=(defined? @rc['program_set']['file_encoding']) \ + ? @rc['program_set']['encoding'] : '' (is.nil? || is==true) ? 'encoding' : is end def wc #wordcount - is=(defined? @rc['program_set']['wc']) ? @rc['program_set']['wc'] : '' + is=(defined? @rc['program_set']['wc']) \ + ? @rc['program_set']['wc'] : '' (is.nil? || is==true) ? 'wc' : is end def tidy - is=(defined? @rc['program_set']['tidy']) ? @rc['program_set']['tidy'] : nil + is=(defined? @rc['program_set']['tidy']) \ + ? @rc['program_set']['tidy'] : nil (is.nil? || is==true) ? 'tidy' : is end def rmagick - is=(defined? @rc['program_set']['rmagick']) ? @rc['program_set']['rmagick'] : nil + is=(defined? @rc['program_set']['rmagick']) \ + ? @rc['program_set']['rmagick'] : nil (is.nil? || is==true) ? 'rmagick' : is end - def rexml #should be part of ruby 1.8 but apparently not always - is=(defined? @rc['program_set']['rexml']) ? @rc['program_set']['rexml'] : '' + def rexml #should be part of ruby 1.8 but apparently not always + is=(defined? @rc['program_set']['rexml']) ? \ + @rc['program_set']['rexml'] : '' (is.nil? || is==true) ? 'rexml' : is end def pdflatex - is=(defined? @rc['program_set']['pdflatex']) ? @rc['program_set']['pdflatex'] : '' + is=(defined? @rc['program_set']['pdflatex']) ? \ + @rc['program_set']['pdflatex'] : '' (is.nil? || is==true) ? 'pdflatex' : is end def postgresql - is=(defined? @rc['program_set']['postgresql']) ? @rc['program_set']['postgresql'] : '' + is=(defined? @rc['program_set']['postgresql']) ? \ + @rc['program_set']['postgresql'] : '' (is.nil? || is==true) ? 'postgresql' : is end def sqlite - is=(defined? @rc['program_set']['sqlite']) ? @rc['program_set']['sqlite'] : '' + is=(defined? @rc['program_set']['sqlite']) ? \ + @rc['program_set']['sqlite'] : '' (is.nil? || is==true) ? 'sqlite' : is end self end def i18n - def language # language settings + def language # language settings m=/.+\/\S+?\~(\S+)/ pwd=Dir.pwd - conf=(defined? @rc['default']['language']) ? @rc['default']['language'] : nil - l=if pwd=~ m; pwd[m,1] #2 directory: by visible directory name - elsif conf; @rc['default']['language'] #3 config: from sisurc.yaml - else defaults[:language] #4 sisu: program default - end #1 document: param gets + conf=(defined? @rc['default']['language']) \ + ? @rc['default']['language'] : nil + l=if pwd=~ m then pwd[m,1] #2 directory: by visible directory name + elsif conf then @rc['default']['language'] #3 config: from sisurc.yaml + else defaults[:language] #4 sisu: program default + end #1 document: param gets SiSU_Env::StandardiseLanguage.new(l) end #def multilingual @@ -2999,12 +3110,12 @@ WOK end if (l != defaults[:language_code]) \ or (language.code != defaults[:language_code]) #watch - if x==1; @lang[:pre],@lang[:mid],@lang[:post]="#{l}.",'','' - elsif x==2; @lang[:pre],@lang[:mid],@lang[:post]='',".#{l}",'' - elsif x==3; @lang[:pre],@lang[:mid],@lang[:post]='','',".#{l}" - else @lang[:pre],@lang[:mid],@lang[:post]='','','' + if x==1 then @lang[:pre],@lang[:mid],@lang[:post]="#{l}.",'','' + elsif x==2 then @lang[:pre],@lang[:mid],@lang[:post]='',".#{l}",'' + elsif x==3 then @lang[:pre],@lang[:mid],@lang[:post]='','',".#{l}" + else @lang[:pre],@lang[:mid],@lang[:post]='','','' end - else @lang[:pre],@lang[:mid],@lang[:post]='','','' + else @lang[:pre],@lang[:mid],@lang[:post]='','','' end @lang end @@ -3012,7 +3123,8 @@ WOK end def file_encoding is='' - if defined? @rc['program_set']['file_encoding']; is=@rc['program_set']['encoding'] + if defined? @rc['program_set']['file_encoding'] + is=@rc['program_set']['encoding'] end if is.nil? \ or is==true @@ -3020,7 +3132,7 @@ WOK end is end - def papersize # paper settings, default overidden in param if set within document + def papersize # paper settings, default overidden in param if set within document (defined? @rc['default']['papersize']) \ ? @rc['default']['papersize'].downcase : (defaults[:papersize].downcase) @@ -3028,14 +3140,17 @@ WOK def odf_structure FileUtils::rm_rf(processing_path.processing_path.odf_pth) FileUtils::mkdir_p(processing_path.processing_path.odf_pth) - system("unzip -q #{path.share}/#{SiSU_is[:version_dir]}/odf/odt.zip -d #{processing_path.odf_pth}") + system( + "unzip -q #{path.share}/#{SiSU_is[:version_dir]}/odf/odt.zip -d #{processing_path.odf_pth}" + ) end def sisupod_gen(fns_pod) sisupod_gen_v3(fns_pod) end def sisupod_gen_v3(fns_pod) pwd=Dir.pwd - sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}" + sisupod_processing_path= + processing_path.processing + '/' + Gt[:sisupod] if FileTest.directory?(sisupod_processing_path) \ or FileTest.file?(sisupod_processing_path) FileUtils::rm_rf(sisupod_processing_path) @@ -3051,7 +3166,7 @@ WOK if f_pod \ && FileTest.file?(f_pod) (SiSU_Env::SystemCall.new.program_found?('tree')) \ - ? "tree #{processing_path.processing}/#{Gt[:sisupod]}" + ? 'tree ' + processing_path.processing + '/' + Gt[:sisupod] : '' if FileTest.directory?(processing_path.processing) Dir.chdir(processing_path.processing) @@ -3060,12 +3175,16 @@ WOK end #system(tree) #enable if (/[vVM]/) else - SiSU_Screen::Ansi.new('',"*WARN* file not found: #{fns_pod}").warn unless @cmd=~/q/ + SiSU_Screen::Ansi.new( + '', + '*WARN* file not found: ' + fns_pod + ).warn unless @cmd=~/q/ end sisupod_processing_path end def sisupod_gen_v2(fns_pod) - sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}" + sisupod_processing_path= + processing_path.processing + '/' + Gt[:sisupod] if FileTest.directory?(sisupod_processing_path) \ or FileTest.file?(sisupod_processing_path) FileUtils::rm_rf(sisupod_processing_path) @@ -3075,7 +3194,10 @@ WOK end (FileTest.file?(fns_pod)) \ ? system("unzip -q #{fns_pod} -d #{processing_path.processing}") - : (SiSU_Screen::Ansi.new('',"*WARN* file not found: #{fns_pod}").warn unless @cmd=~/q/) + : (SiSU_Screen::Ansi.new( + '', + "*WARN* file not found: #{fns_pod}" + ).warn unless @cmd=~/q/) sisupod_processing_path end end @@ -3084,45 +3206,47 @@ WOK def initialize @rc=GetInit.new.sisu_yaml.rc end - def color #processing flag shortcuts - (defined? @rc['flag']['color']) ? @rc['flag']['color'] : false + def color #processing flag shortcuts + (defined? @rc['flag']['color']) \ + ? @rc['flag']['color'] + : false end - def cf_0 #processing flag shortcuts + def cf_0 #processing flag shortcuts if defined? @rc['flag']['default'] \ and @rc['flag']['default'].is_a?(String) @rc['flag']['default'] else '-NQhewpotbxXdyYv' end end - def cf_1 #processing flag shortcuts + def cf_1 #processing flag shortcuts if defined? @rc['flag']['i'] \ and @rc['flag']['i'].is_a?(String) @rc['flag']['i'] else '-Qhewpoty' end end - def cf_2 #processing flag shortcuts + def cf_2 #processing flag shortcuts if defined? @rc['flag']['ii'] \ and @rc['flag']['ii'].is_a?(String) @rc['flag']['ii'] else '-NQhewpotbxXdy' end end - def cf_3 #processing flag shortcuts + def cf_3 #processing flag shortcuts if defined? @rc['flag']['iii'] \ and @rc['flag']['iii'].is_a?(String) @rc['flag']['iii'] else '-NQhewpotbxXdyY' end end - def cf_4 #processing flag shortcuts + def cf_4 #processing flag shortcuts if defined? @rc['flag']['iv'] \ and @rc['flag']['iv'].is_a?(String) @rc['flag']['iv'] else '-NQhewpotbxXdDyY --update' end end - def cf_5 #processing flag shortcuts + def cf_5 #processing flag shortcuts if defined? @rc['flag']['v'] \ and @rc['flag']['v'].is_a?(String) @rc['flag']['v'] @@ -3131,12 +3255,12 @@ WOK end end class InfoSettings < InfoEnv - def permission?(prog) #program defaults + def permission?(prog) #program defaults (defined? @rc['permission_set'][prog]) \ ? @rc['permission_set'][prog] : false end - def program?(prog) #program defaults + def program?(prog) #program defaults (defined? @rc['program_set'][prog]) \ ? @rc['program_set'][prog] : false @@ -3223,7 +3347,7 @@ WOK ft << @md.fn[:xml_scaffold_structure_collapse] end @fnb=@md.fnb - else # still needed where/when param is not parsed + else # still needed where/when param is not parsed if @opt.act[:html][:set]==:on #% --html, -h -H ft << '.html' << '.html.??' end @@ -3293,10 +3417,10 @@ WOK end ft=ft.uniq filetypes=ft.join(',') - @filetypes=if filetypes !~/..+/; '' # -r called alone, copy all - elsif @opt.cmd =~/u/; '' # -u added, copy all, (used to create remote directory tree see output path), not the usual function of -u - elsif filetypes =~/\S+?,\S+/; '*{' + filetypes + '}' # more than one relevant file type - else '*' + filetypes # one relevant file type + @filetypes=if filetypes !~/..+/ then '' # -r called alone, copy all + elsif @opt.cmd =~/u/ then '' # -u added, copy all, (used to create remote directory tree see output path), not the usual function of -u + elsif filetypes =~/\S+?,\S+/ then '*{' + filetypes + '}' # more than one relevant file type + else '*' + filetypes # one relevant file type end @source_path=(@fnb && !(@fnb.empty?) \ ? "#{@env.path.output}/#{@fnb}" @@ -3326,7 +3450,8 @@ WOK require 'fileutils' include FileUtils::Verbose rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('fileutils NOT FOUND (LoadError)') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('fileutils NOT FOUND (LoadError)') end def initialize(opt) @opt=opt @@ -3352,7 +3477,10 @@ WOK def remove_output if @opt.act[:maintenance][:set] == :on m=InfoFile.new(@opt.fnc) - tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns, 'remove maintenance files from: ' + @env.processing_path.ao) + tell=SiSU_Screen::Ansi.new( + @opt.cmd,@opt.fns, + 'remove maintenance files from: ' + @env.processing_path.ao + ) tell.warn unless @opt.cmd =~/q/ deletion(m.marshal.ao_content) deletion(m.marshal.ao_idx_sst_rel_html_seg) @@ -3486,7 +3614,8 @@ WOK begin require 'socket' rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('socket NOT FOUND (LoadError)') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('socket NOT FOUND (LoadError)') end def initialize(opt) super(opt) # @@ -3502,21 +3631,32 @@ WOK end remote_host_base_general end - def scp #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built + def scp #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built def document self.remote_host_base.each do |remote_conn| local_gen=@source_path remote_gen=case @opt.cmd - when /u/ then "#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." #creates remote directory tree, this is not the usual function of u - when /[abhHNopwxXy]/ then "#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/#{@fnb}/." - else "#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." + when /u/ + remote_conn[:name] + '/' \ + + @env.path.base_markup_dir_stub + '/.' #creates remote directory tree, this is not the usual function of u + when /[abhHNopwxXy]/ + remote_conn[:name] + '/' \ + + @env.path.base_markup_dir_stub + '/' \ + + @fnb + '/.' + else + remote_conn[:name] + '/' \ + + @env.path.base_markup_dir_stub \ + + '/.' end local_epub=@source_path_epub local_src=@source_path_src local_pod=@source_path_pod - remote_epub="#{remote_conn[:name]}/#{@env.path.stub_epub}/." - remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/." - remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/." + remote_epub= + remote_conn[:name] + '/' + @env.path.stub_epub + '/.' + remote_src= + remote_conn[:name] + '/' + @env.path.stub_src + '/.' + remote_pod= + remote_conn[:name] + '/' + @env.path.stub_pod + '/.' src_txt=@opt.fnc src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.txz') if (local_gen =~/\S/ \ @@ -3533,7 +3673,10 @@ WOK SiSU_Env::SystemCall.new("#{local_src}/#{src_pod}",remote_pod).scp end if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub") - SiSU_Env::SystemCall.new("#{local_epub}/#{@opt.fnb}.epub",remote_epub,@opt.cmd).scp + SiSU_Env::SystemCall.new( + "#{local_epub}/#{@opt.fnb}.epub", + remote_epub,@opt.cmd + ).scp end elsif @opt.cmd =~/U/ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ @@ -3551,7 +3694,7 @@ WOK end end end - def site_base #base site + def site_base #base site self.remote_host_base.each do |remote_conn| local=@source_path remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." @@ -3569,10 +3712,12 @@ WOK end end end - def site_base_all #base site + def site_base_all #base site self.remote_host_base.each do |remote_conn| local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." + remote= + remote_conn[:name] + '/' \ + + @env.path.base_markup_dir_stub + '/.' if defined? @rc['permission_set']['remote_base_site'] \ and @rc['permission_set']['remote_base_site'] \ and @@flag_remote==true \ @@ -3587,7 +3732,9 @@ WOK puts "#{local}/_sisu/image_sys/ -> #{remote}" puts "#{local}/_sisu/image/ -> #{remote}" puts "#{local}/#{@env.path.style}/ -> #{remote}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + else + puts "permission not granted #{__FILE__} #{__LINE__}" \ + if @opt.cmd =~/M/ end end end @@ -3603,8 +3750,12 @@ WOK local_gen=@source_path #local_gen_image="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" #local_gen_image_external="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external" - remote_gen="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." - remote_rel=remote_conn[:name] + '/' + f.output_path.stub.rcp + remote_gen= + remote_conn[:name] + '/' \ + + @env.path.base_markup_dir_stub + '/.' + remote_rel= + remote_conn[:name] + '/' \ + + f.output_path.stub.rcp @opt.fnc if (local_gen =~/\S/ \ and local_gen !~/\/\//) \ @@ -3618,7 +3769,9 @@ WOK if (@opt.act[:html][:set]==:on \ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ && FileTest.file?(f.place_file.html_scroll.dir) - inp << f.output_path.html_seg.rel << f.place_file.html_scroll.rel + inp \ + << f.output_path.html_seg.rel \ + << f.place_file.html_scroll.rel end if (@opt.act[:concordance][:set]==:on \ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ @@ -3704,7 +3857,9 @@ WOK if (@opt.act[:qrcode][:set]==:on \ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ && FileTest.file?(f.place_file.qrcode_md.dir) - inp << f.place_file.qrcode_md.rel << f.place_file.qrcode_title.rel + inp \ + << f.place_file.qrcode_md.rel \ + << f.place_file.qrcode_title.rel end if (@opt.act[:manifest][:set]==:on \ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ @@ -3720,7 +3875,9 @@ WOK if @opt.cmd =~/[hwbxX]/ \ && (defined? @md.ec[:image]) \ && (@md.ec[:image].length > 0) - images=f.place_file.images.rel + '/' + @md.ec[:image].join(" #{f.output_path.images.rel}/") + images= + f.place_file.images.rel + '/' \ + + @md.ec[:image].join(" #{f.output_path.images.rel}/") end if @opt.cmd =~/[yhwbxX]/ \ && (defined? @md.ec[:image]) \ @@ -3734,7 +3891,8 @@ WOK #local_dirs=%{-f"+ */" -f"- *" #{f.output_path.base.dir}/*} #SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync local=local_gen + ' ' + images + ' ' + images_skin + ' ' + images_system + ' ' + local_css - SiSU_Env::SystemCall.new(local,remote_rel,@opt.cmd).rsync('--relative',f.output_path.base.dir) + SiSU_Env::SystemCall.new(local,remote_rel,@opt.cmd). + rsync('--relative',f.output_path.base.dir) rescue p __LINE__.to_s + ':' + __FILE__ local_dirs=%{--include='*/' --exclude='*' #{f.output_path.base.dir}} @@ -3750,7 +3908,8 @@ WOK else puts 'suspect rsync request, ignored' puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" - puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "permission not granted #{__FILE__} #{__LINE__}" \ + if @opt.cmd =~/M/ end end end @@ -3761,28 +3920,37 @@ WOK l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}" lng='en' if @env.output_dir_structure.by? == :language - ldest="#{lng}/manifest" - files="#{ldest}/authors.html #{ldest}/topics.html" + ldest=lng + '/manifest' + files= + ldest + '/authors.html' + ' ' \ + + ldest + '/topics.html' elsif @env.output_dir_structure.by? == :filetype ldest="manifest" - files="#{ldest}/authors.#{lng}.html #{ldest}/topics.#{lng}.html" + files= + ldest + '/authors.' + lng + '.html' + ' ' \ + + ldest + '/topics.' + lng + '.html' elsif @env.output_dir_structure.by? == :filename - files="#{l_rel}/authors.#{lng}.html #{l_rel}/topics.#{lng}.html" + files= + l_rel + '/authors.' + lng + '.html' + ' ' \ + + l_rel + '/topics.' + lng + '.html' end remote="#{remote_conn[:name]}/#{@opt.base_stub}" if @opt.act[:harvest][:set] \ && @opt.act[:rsync][:set] (@env.output_dir_structure.by? == :filename) \ ? (SiSU_Env::SystemCall.new(files,remote).rsync) - : (SiSU_Env::SystemCall.new(ldest,remote).rsync('--relative',l_rel)) + : (SiSU_Env::SystemCall.new(ldest,remote). + rsync('--relative',l_rel)) elsif @opt.cmd =~/U/ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ puts "rsync_harvest: #{local} -> #{remote}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + else + puts "permission not granted #{__FILE__} #{__LINE__}" \ + if @opt.cmd =~/M/ end end end - def site_base #base site + def site_base #base site ldest='_sisu/*' l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}" image_sys="#{@env.path.webserv}/_sisu/image_sys" @@ -3803,24 +3971,30 @@ WOK and @opt.cmd !~/U/ delete_extra_files='--delete' # '--delete-after' puts "begin rsync_base_sync: #{local} -> #{remote}" - SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).rsync(delete_extra_files) - SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).rsync(delete_extra_files) - SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).rsync(delete_extra_files) + SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote). + rsync(delete_extra_files) + SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote). + rsync(delete_extra_files) + SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote). + rsync(delete_extra_files) elsif @opt.cmd =~/U/ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ puts "rsync_base_sync: #{local} -> #{remote}" puts "#{local}/_sisu/image_sys/ -> #{remote}" puts "#{local}/_sisu/image/ -> #{remote}" puts "#{local}/#{@env.path.style}/ -> #{remote}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + else + puts "permission not granted #{__FILE__} #{__LINE__}" \ + if @opt.cmd =~/M/ end end end self end - def rsync_sitemaps #sitemap directory + def rsync_sitemaps #sitemap directory self.remote_host_base.each do |remote_conn| - local="#{@source_path}/sitemapindex.xml" + local= + @source_path + '/sitemapindex.xml' remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if @@flag_remote delete_extra_files='--delete' # '--delete-after' @@ -3828,7 +4002,9 @@ WOK elsif @opt.cmd =~/U/ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ puts "rsync_sitemaps: #{local} -> #{remote}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + else + puts "permission not granted #{__FILE__} #{__LINE__}" \ + if @opt.cmd =~/M/ end end end @@ -3839,13 +4015,17 @@ WOK require 'rbconfig' require 'yaml' rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rbconfig or yaml NOT FOUND (LoadError)') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('rbconfig or yaml NOT FOUND (LoadError)') end @@lib_path=nil def get_version @version={} @pwd=ENV['PWD'] - lib_path=@@lib_path ? @@lib_path : `echo $RUBYLIB`.split(':') + lib_path= + @@lib_path \ + ? @@lib_path + : `echo $RUBYLIB`.split(':') @@lib_path ||=lib_path if File.exist?(SiSU_is[:version_info_path]) @version=YAML::load(File::open(SiSU_is[:version_info_path])) #unless @@noyaml @@ -3876,7 +4056,15 @@ WOK @color.cmd else '-v' end - SiSU_Screen::Ansi.new(opt_cmd,version[:project],version[:version],version[:date_stamp],version[:date],version[:install_method],rb_ver).version + SiSU_Screen::Ansi.new( + opt_cmd, + version[:project], + version[:version], + version[:date_stamp], + version[:date], + version[:install_method], + rb_ver + ).version else puts 'SiSU (version information not available)' end end @@ -3895,13 +4083,13 @@ WOK WOK end end - class InfoFile <InfoEnv #todo unify with FileOp + class InfoFile <InfoEnv #todo unify with FileOp def initialize(fns) begin super(fns) @fns=fns @env=SiSU_Env::InfoEnv.new(@fns) - m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm)$/ #watch added match for sss + m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm)$/ @fnn,@fnb,@fnt=@fns[m,1],@fns[m,2],@fns[m,3] rescue SiSU_Screen::Ansi.new('',$!,$@).rescue do @@ -3917,12 +4105,19 @@ WOK def make_file(path,filename) (File.writable?("#{path}/.")) \ ? File.new("#{path}/#{filename}",'w+') - : (SiSU_Screen::Ansi.new('',"*WARN* is the file or directory writable?, could not create #{filename}").warn) + : (SiSU_Screen::Ansi.new( + '', + "*WARN* is the file or directory writable?, could not create #{filename}" + ).warn) end def touch_file(path,filename) if File.writable?("#{path}/."); FileUtils::touch("#{path}/#{filename}") - else SiSU_Screen::Ansi.new('',"*WARN* is the file or directory writable?, could not create #{filename}").warn + else + SiSU_Screen::Ansi.new( + '', + "*WARN* is the file or directory writable?, could not create #{filename}" + ).warn end end def make_path(path) @@ -3930,31 +4125,40 @@ WOK end def marshal def ao_content - "#{@env.processing_path.ao}/#{@fns}.content.rbm" + @env.processing_path.ao + '/' \ + + @fns + '.content.rbm' end def ao_idx_sst_rel_html_seg - "#{@env.processing_path.ao}/#{@fns}.idx_sst.rbm" + @env.processing_path.ao + '/' \ + + @fns + '.idx_sst.rbm' end def ao_idx_sst_rel #used by tex & odf - "#{@env.processing_path.ao}/#{@fns}.idx_raw.rbm" + @env.processing_path.ao + '/' \ + + @fns + '.idx_raw.rbm' end def ao_idx_html - "#{@env.processing_path.ao}/#{@fns}.idx_html.rbm" + @env.processing_path.ao + '/' \ + + @fns + '.idx_html.rbm' end def ao_idx_xhtml - "#{@env.processing_path.ao}/#{@fns}.idx_xhtml.rbm" + @env.processing_path.ao + '/' \ + + @fns + '.idx_xhtml.rbm' end def ao_metadata - "#{@env.processing_path.ao}/#{@fns}.metadata.rbm" + @env.processing_path.ao + '/' \ + + @fns + '.metadata.rbm' end def ao_map_nametags - "#{@env.processing_path.ao}/#{@fns}.map_name_tags.rbm" + @env.processing_path.ao + '/' \ + + @fns + '.map_name_tags.rbm' end def ao_map_ocn_htmlseg - "#{@env.processing_path.ao}/#{@fns}.map_ocn_htmlseg.rbm" + @env.processing_path.ao + '/' \ + + @fns + '.map_ocn_htmlseg.rbm' end def html_tune - "#{@env.processing_path.tune}/#{@fns}.marshal_tune" + @env.processing_path.tune + '/' \ + + @fns + '.marshal_tune' end self end @@ -3967,10 +4171,12 @@ WOK def mkdir #check moved from FileOp, existing mkdir def processing def ao - FileUtils::mkdir_p(@env.processing_path.ao) unless FileTest.directory?(@env.processing_path.ao) + FileUtils::mkdir_p(@env.processing_path.ao) \ + unless FileTest.directory?(@env.processing_path.ao) end def tune - FileUtils::mkdir_p(@env.processing_path.tune) unless FileTest.directory?(@env.processing_path.tune) + FileUtils::mkdir_p(@env.processing_path.tune) \ + unless FileTest.directory?(@env.processing_path.tune) end self end @@ -4491,7 +4697,9 @@ WOK end def sqlite_discrete def db - "#{@md.file.output_path.sqlite_discrete.dir}/#{@md.file.base_filename.sqlite_discrete}" + @md.file.output_path.sqlite_discrete.dir \ + + '/' \ + + @md.file.base_filename.sqlite_discrete end def dbi "DBI:SQLite3:#{sqlite_discrete.db}" @@ -4509,13 +4717,14 @@ WOK SQLite3::Database.new(sqlite_discrete.sqlite3) rescue LoadError $sqlite3=:no - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('sqlite3 NOT FOUND (LoadError)') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('sqlite3 NOT FOUND (LoadError)') end end self end end - class FileOp <InfoFile #todo unify with CreateFile + class FileOp <InfoFile #todo unify with CreateFile def initialize(md,fno='') begin @md,@fno=md,fno @@ -4530,12 +4739,17 @@ WOK def output_dir_structure ProcessingSettings.new(@md).output_dir_structure end - def mkdir_initialize # not used but consider using - FileUtils::mkdir_p(output_path.base.dir) unless FileTest.directory?(output_path.base.dir) - FileUtils::mkdir_p("#{output_path.base.dir}/#{@md.fnb}") unless FileTest.directory?("#{output_path.base.dir}/#{@md.fnb}") - FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}") - FileUtils::mkdir_p(@env.processing_path.ao) unless FileTest.directory?(@env.processing_path.ao) - FileUtils::mkdir_p(@env.processing_path.tune) unless FileTest.directory?(@env.processing_path.tune) + def mkdir_initialize # not used but consider using + FileUtils::mkdir_p(output_path.base.dir) \ + unless FileTest.directory?(output_path.base.dir) + FileUtils::mkdir_p("#{output_path.base.dir}/#{@md.fnb}") \ + unless FileTest.directory?("#{output_path.base.dir}/#{@md.fnb}") + FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") \ + unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}") + FileUtils::mkdir_p(@env.processing_path.ao) \ + unless FileTest.directory?(@env.processing_path.ao) + FileUtils::mkdir_p(@env.processing_path.tune) \ + unless FileTest.directory?(@env.processing_path.tune) end def path_rel_links def html_scroll_2 @@ -4620,10 +4834,12 @@ WOK def mkdir def output def base - FileUtils::mkdir_p(output_path.base.dir) unless FileTest.directory?(output_path.base.dir) + FileUtils::mkdir_p(output_path.base.dir) \ + unless FileTest.directory?(output_path.base.dir) end def css - FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}") + FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") \ + unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}") end def epub path=output_path.epub.dir @@ -4683,7 +4899,7 @@ WOK end def html_seg_index pth=((output_dir_structure.by_filename?) \ - || (output_dir_structure.dump?)) \ + || (output_dir_structure.dump?)) \ ? "#{output_path.html.dir}" : "#{output_path.html.dir}/#{@md.fnb}" make_path(pth) @@ -4692,8 +4908,8 @@ WOK end def html_segtoc pth=((output_dir_structure.by_filename?) \ - || (output_dir_structure.dump?) \ - || (output_dir_structure.redirect?)) \ + || (output_dir_structure.dump?) \ + || (output_dir_structure.redirect?)) \ ? "#{output_path.html.dir}" : "#{output_path.html.dir}/#{@md.fnb}" make_path(pth) @@ -4801,109 +5017,133 @@ WOK def place_file def txt def dir - output_path.txt.dir + '/' + base_filename.txt + output_path.txt.dir + '/' \ + + base_filename.txt end def rel - output_path.txt.rel + '/' + base_filename.txt + output_path.txt.rel + '/' \ + + base_filename.txt end self end def textile def dir - output_path.textile.dir + '/' + base_filename.textile + output_path.textile.dir + '/' \ + + base_filename.textile end def rel - output_path.textile.rel + '/' + base_filename.textile + output_path.textile.rel + '/' \ + + base_filename.textile end self end def asciidoc def dir - output_path.asciidoc.dir + '/' + base_filename.asciidoc + output_path.asciidoc.dir + '/' \ + + base_filename.asciidoc end def rel - output_path.asciidoc.rel + '/' + base_filename.asciidoc + output_path.asciidoc.rel + '/' \ + + base_filename.asciidoc end self end def markdown def dir - output_path.markdown.dir + '/' + base_filename.markdown + output_path.markdown.dir + '/' \ + + base_filename.markdown end def rel - output_path.markdown.rel + '/' + base_filename.markdown + output_path.markdown.rel + '/' \ + + base_filename.markdown end self end def rst def dir - output_path.rst.dir + '/' + base_filename.rst + output_path.rst.dir + '/' \ + + base_filename.rst end def rel - output_path.rst.rel + '/' + base_filename.rst + output_path.rst.rel + '/' \ + + base_filename.rst end self end def html_scroll def dir - output_path.html_scroll.dir + '/' + base_filename.html_scroll + output_path.html_scroll.dir + '/' \ + + base_filename.html_scroll end def rel - output_path.html_scroll.rel + '/' + base_filename.html_scroll + output_path.html_scroll.rel + '/' \ + + base_filename.html_scroll end self end def html_seg_index def dir - output_path.html_seg.dir + '/' + base_filename.html_seg_index + output_path.html_seg.dir + '/' \ + + base_filename.html_seg_index end def rel - output_path.html_seg.rel + '/' + base_filename.html_seg_index + output_path.html_seg.rel + '/' \ + + base_filename.html_seg_index end self end def html_segtoc def dir - output_path.html_seg.dir + '/' + base_filename.html_segtoc + output_path.html_seg.dir + '/' \ + + base_filename.html_segtoc end def rel - output_path.html_seg.rel + '/' + base_filename.html_segtoc + output_path.html_seg.rel + '/' \ + + base_filename.html_segtoc end self end def html_book_index def dir - output_path.html_seg.dir + '/' + base_filename.html_book_index + output_path.html_seg.dir + '/' \ + + base_filename.html_book_index end def rel - output_path.html_seg.rel + '/' + base_filename.html_book_index + output_path.html_seg.rel + '/' \ + + base_filename.html_book_index end self end def html_concordance def dir - output_path.html_seg.dir + '/' + base_filename.html_concordance + output_path.html_seg.dir + '/' \ + + base_filename.html_concordance end def rel - output_path.html_seg.rel + '/' + base_filename.html_concordance + output_path.html_seg.rel + '/' \ + + base_filename.html_concordance end self end def odt def dir - output_path.odt.dir + '/' + base_filename.odt + output_path.odt.dir + '/' \ + + base_filename.odt end def rel - output_path.odt.rel + '/' + base_filename.odt + output_path.odt.rel + '/' \ + + base_filename.odt end self end def epub def dir - output_path.epub.dir + '/' + base_filename.epub + output_path.epub.dir + '/' \ + + base_filename.epub end def rel - output_path.epub.rel + '/' + base_filename.epub + output_path.epub.rel + '/' \ + + base_filename.epub end self end @@ -4915,124 +5155,151 @@ WOK end def xhtml def dir - output_path.xhtml.dir + '/' + base_filename.xhtml + output_path.xhtml.dir + '/' \ + + base_filename.xhtml end def rel - output_path.xhtml.rel + '/' + base_filename.xhtml + output_path.xhtml.rel + '/' \ + + base_filename.xhtml end self end def xml_sax def dir - output_path.xml.dir + '/' + base_filename.xml_sax + output_path.xml.dir + '/' \ + + base_filename.xml_sax end def rel - output_path.xml.rel + '/' + base_filename.xml_sax + output_path.xml.rel + '/' \ + + base_filename.xml_sax end self end def xml_dom def dir - output_path.xml.dir + '/' + base_filename.xml_dom + output_path.xml.dir + '/' \ + + base_filename.xml_dom end def rel - output_path.xml.rel + '/' + base_filename.xml_dom + output_path.xml.rel + '/' \ + + base_filename.xml_dom end self end def xml_docbook_book def dir - output_path.xml_docbook.dir + '/' + base_filename.xml_docbook_book + output_path.xml_docbook.dir + '/' \ + + base_filename.xml_docbook_book end def rel - output_path.xml_docbook.rel + '/' + base_filename.xml_docbook_book + output_path.xml_docbook.rel + '/' \ + + base_filename.xml_docbook_book end self end def xml_fictionbook def dir - output_path.xml_fictionbook.dir + '/' + base_filename.xml_fictionbook + output_path.xml_fictionbook.dir + '/' \ + + base_filename.xml_fictionbook end def rel - output_path.xml_fictionbook.rel + '/' + base_filename.xml_fictionbook + output_path.xml_fictionbook.rel + '/' \ + + base_filename.xml_fictionbook end self end def xml_scaffold_structure_sisu def dir - output_path.xml.dir + '/' + base_filename.xml_scaffold_structure_sisu + output_path.xml.dir + '/' \ + + base_filename.xml_scaffold_structure_sisu end def rel - output_path.xml.rel + '/' + base_filename.xml_scaffold_structure_sisu + output_path.xml.rel + '/' \ + + base_filename.xml_scaffold_structure_sisu end self end def xml_scaffold_structure_collapse def dir - output_path.xml.dir + '/' + base_filename.xml_scaffold_structure_collapse + output_path.xml.dir + '/' \ + + base_filename.xml_scaffold_structure_collapse end def rel - output_path.xml.rel + '/' + base_filename.xml_scaffold_structure_collapse + output_path.xml.rel + '/' \ + + base_filename.xml_scaffold_structure_collapse end self end def sqlite_discrete def dir - output_path.sqlite_discrete.dir + '/' + base_filename.sqlite_discrete + output_path.sqlite_discrete.dir + '/' \ + + base_filename.sqlite_discrete end def rel - output_path.sqlite_discrete.rel + '/' + base_filename.sqlite_discrete + output_path.sqlite_discrete.rel + '/' \ + + base_filename.sqlite_discrete end self end def hash_digest def dir - output_path.hash_digest.dir + '/' + base_filename.hash_digest + output_path.hash_digest.dir + '/' \ + + base_filename.hash_digest end def rel - output_path.hash_digest.rel + '/' + base_filename.hash_digest + output_path.hash_digest.rel + '/' \ + + base_filename.hash_digest end self end def src def dir - output_path.src.dir + '/' + base_filename.src + output_path.src.dir + '/' \ + + base_filename.src end def rel - output_path.src.rel + '/' + base_filename.src + output_path.src.rel + '/' \ + + base_filename.src end self end def sisupod def dir - output_path.sisupod.dir + '/' + base_filename.sisupod + output_path.sisupod.dir + '/' \ + + base_filename.sisupod end def rel - output_path.sisupod.rel + '/' + base_filename.sisupod + output_path.sisupod.rel + '/' \ + + base_filename.sisupod end self end def po def dir - output_path.po.dir + '/' + base_filename.po + output_path.po.dir + '/' \ + + base_filename.po end def rel - output_path.po.rel + '/' + base_filename.po + output_path.po.rel + '/' \ + + base_filename.po end self end def pot def dir - output_path.pot.dir + '/' + base_filename.pot + output_path.pot.dir + '/' \ + + base_filename.pot end def rel - output_path.pot.rel + '/' + base_filename.pot + output_path.pot.rel + '/' \ + + base_filename.pot end self end def po_git def dir - output_path.po_git + '/' + base_filename.po + output_path.po_git + '/' \ + + base_filename.po end def rel #output_path.po_git + '/' + base_filename.po @@ -5041,7 +5308,8 @@ WOK end def pot_git def dir - output_path.pot_git + '/' + base_filename.pot + output_path.pot_git + '/' \ + + base_filename.pot end def rel #output_path.pot_git + '/' + base_filename.pot @@ -5050,55 +5318,67 @@ WOK end def manpage def dir - output_path.manpage.dir + '/' + base_filename.manpage + output_path.manpage.dir + '/' \ + + base_filename.manpage end def rel - output_path.manpage.rel + '/' + base_filename.manpage + output_path.manpage.rel + '/' \ + + base_filename.manpage end self end def texinfo def dir - output_path.texinfo.dir + '/' + base_filename.texinfo + output_path.texinfo.dir + '/' \ + + base_filename.texinfo end def rel - output_path.texinfo.rel + '/' + base_filename.texinfo + output_path.texinfo.rel + '/' \ + + base_filename.texinfo end self end def info def dir - output_path.texinfo.dir + '/' + base_filename.info + output_path.texinfo.dir + '/' \ + + base_filename.info end def rel - output_path.texinfo.rel + '/' + base_filename.info + output_path.texinfo.rel + '/' \ + + base_filename.info end self end def qrcode_title def dir - output_path.qrcode.dir + '/' + base_filename.qrcode_title + output_path.qrcode.dir + '/' \ + + base_filename.qrcode_title end def rel - output_path.qrcode.rel + '/' + base_filename.qrcode_title + output_path.qrcode.rel + '/' \ + + base_filename.qrcode_title end self end def qrcode_md def dir - output_path.qrcode.dir + '/' + base_filename.qrcode_md + output_path.qrcode.dir + '/' \ + + base_filename.qrcode_md end def rel - output_path.qrcode.rel + '/' + base_filename.qrcode_md + output_path.qrcode.rel + '/' \ + + base_filename.qrcode_md end self end def manifest def dir - output_path.manifest.dir + '/' + base_filename.manifest + output_path.manifest.dir + '/' \ + + base_filename.manifest end def rel - output_path.manifest.rel + '/' + base_filename.manifest + output_path.manifest.rel + '/' \ + + base_filename.manifest end self end @@ -5705,44 +5985,49 @@ WOK def dir def abc if output_dir_structure.redirect? - "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}" + @md.opt.opt_act[:redirect][:inst] + '/' + @md.fnb elsif output_dir_structure.dump? @md.opt.opt_act[:dump][:inst] elsif output_dir_structure.by_language_code? - "#{output_path.base.dir}/#{@md.opt.lng}/#{@ft}" + output_path.base.dir + '/' + @md.opt.lng + '/' + @ft elsif output_dir_structure.by_filetype? - "#{output_path.base.dir}/#{@ft}" + output_path.base.dir + '/' + @ft else - "#{output_path.base.dir}/#{@md.fnb}" + output_path.base.dir + '/' + @md.fnb end end def ab if output_dir_structure.redirect? - "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}" + @md.opt.opt_act[:redirect][:inst] + '/' + @md.fnb elsif output_dir_structure.dump? @md.opt.opt_act[:dump][:inst] elsif output_dir_structure.by_language_code? - "#{output_path.base.dir}/#{@md.opt.lng}/#{@ft}" + output_path.base.dir + '/' + @md.opt.lng + '/' + @ft else - "#{output_path.base.dir}/#{@ft}" + output_path.base.dir + '/' + @ft end end def ab_src if output_dir_structure.redirect? - "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}" + @md.opt.opt_act[:redirect][:inst] + '/' + @md.fnb elsif output_dir_structure.dump? @md.opt.opt_act[:dump][:inst] else - "#{output_path.base.dir}/#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}" + output_path.base.dir + '/' \ + + @ft + '/' \ + + @md.opt.fng + '/' \ + + Gt[:sisupod] + '/' \ + + Gt[:doc] + '/' \ + + @md.opt.lng end end def ab_pod if output_dir_structure.redirect? - "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}" + @md.opt.opt_act[:redirect][:inst] + '/' + @md.fnb elsif output_dir_structure.dump? @md.opt.opt_act[:dump][:inst] else - "#{output_path.base.dir}/#{@ft}" + output_path.base.dir + '/' + @ft end end self @@ -5750,43 +6035,48 @@ WOK def url def abc if output_dir_structure.by_language_code? - "#{output_path.base.url}/#{@md.opt.lng}/#{@ft}" + output_path.base.url + '/' + @md.opt.lng + '/' + @ft elsif output_dir_structure.by_filetype? - "#{output_path.base.url}/#{@ft}" + output_path.base.url + '/' + @ft else - "#{output_path.base.url}/#{@md.fnb}" + output_path.base.url + '/' + @md.fnb end end def ab if output_dir_structure.by_language_code? - "#{output_path.base.url}/#{@md.opt.lng}/#{@ft}" + output_path.base.url + '/' + @md.opt.lng + '/' + @ft else - "#{output_path.base.url}/#{@ft}" + output_path.base.url + '/' + @ft end end def ab_src - "#{output_path.base.url}/#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}" + output_path.base.url + '/' \ + + @ft + '/' \ + + @md.opt.fng + '/' \ + + Gt[:sisupod] + '/' \ + + Gt[:doc] + '/' \ + + @md.opt.lng end def ab_pod - "#{output_path.base.url}/#{@ft}" + output_path.base.url + '/' + @ft end self end def rel def abc if output_dir_structure.by_language_code? - "#{@md.opt.lng}/#{@ft}" + @md.opt.lng + '/' + @ft elsif output_dir_structure.by_filetype? - "#{@ft}" + @ft else - "#{@md.fnb}" + @md.fnb end end def ab if output_dir_structure.by_language_code? - "#{@md.opt.lng}/#{@ft}" + @md.opt.lng + '/' + @ft else - "#{@ft}" + @ft end end def ab_src @@ -5800,11 +6090,11 @@ WOK def rel_sm def abc if output_dir_structure.by_language_code? - "#{@md.opt.lng}/#{@ft}" + @md.opt.lng + '/' + @ft elsif output_dir_structure.by_filetype? - "#{@ft}" + @ft else - "#{@md.fnb}" + @md.fnb end end def ab @@ -5821,18 +6111,18 @@ WOK if output_dir_structure.dump_or_redirect? '.' elsif output_dir_structure.by_language_code? - "../../#{locate}" + '../../' + locate else - "../#{locate}" + '../' + locate end end def ab_pod if output_dir_structure.dump_or_redirect? '.' elsif output_dir_structure.by_language_code? - "../../#{@ft}" + '../../' + @ft else - "../#{@ft}" + '../' + @ft end end self @@ -5840,18 +6130,18 @@ WOK def rcp def abc if output_dir_structure.by_language_code? - "#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}" + output_path.stub.rcp + '/' + @md.opt.lng + '/' + @ft elsif output_dir_structure.by_filetype? - "#{output_path.stub.rcp}/#{@ft}" + output_path.stub.rcp + '/' + @ft else - "#{output_path.stub.rcp}/#{@md.fnb}" + output_path.stub.rcp + '/' + @md.fnb end end def ab if output_dir_structure.by_language_code? - "#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}" + output_path.stub.rcp + '/' + @md.opt.lng + '/' + @ft else - "#{output_path.stub.rcp}/#{@ft}" + output_path.stub.rcp + '/' + @ft end end self @@ -5876,16 +6166,16 @@ WOK end def stub def dir - "#{@md.opt.f_pth[:pth_stub]}" + @md.opt.f_pth[:pth_stub] end #def url # "#{@env.url.root}" #end def rel - "./#{@md.opt.f_pth[:pth_stub]}" + './' + @md.opt.f_pth[:pth_stub] end def rcp - "#{@md.opt.f_pth[:pth_stub]}" + @md.opt.f_pth[:pth_stub] end self end @@ -5900,31 +6190,31 @@ WOK end def base def dir - "#{webserver_path}/#{@md.opt.f_pth[:pth_stub]}" + webserver_path + '/' + @md.opt.f_pth[:pth_stub] end def url - "#{@env.url.webserv}/#{@md.opt.f_pth[:pth_stub]}" + @env.url.webserv + '/' + @md.opt.f_pth[:pth_stub] end def rel - "./#{@md.opt.f_pth[:pth_stub]}" + './' + @md.opt.f_pth[:pth_stub] end def rcp - "./#{@md.opt.f_pth[:pth_stub]}" + './' + @md.opt.f_pth[:pth_stub] end self end def sisugit def dir - "#{output_path.base.dir}/git" + output_path.base.dir + '/git' end def url - "#{output_path.base.url}/git" + output_path.base.url + '/git' end def rel - "#{output_path.base.rel}/git" + output_path.base.rel + '/git' end def rcp - "#{output_path.base.rcp}/git" + output_path.base.rcp + '/git' end self end @@ -5976,19 +6266,27 @@ WOK end def po def dir - "#{output_path.base.dir}/#{Gt[:src]}/#{@md.opt.fng}/po4a/po/#{@md.opt.lng}" + output_path.base.dir + '/' \ + + Gt[:src] + '/' \ + + @md.opt.fng + '/po4a/po/' \ + + @md.opt.lng end def url - "#{output_path.base.url}/po4a/#{@md.fnb}/po/#{@md.opt.lng}" + output_path.base.url + '/po4a/' \ + + @md.fnb + '/po/' \ + + @md.opt.lng end self end def pot def dir - "#{output_path.base.dir}/#{Gt[:src]}/#{@md.opt.fng}/po4a/pot" + output_path.base.dir + '/' \ + + Gt[:src] + '/' \ + + @md.opt.fng + '/po4a/pot' end def url - "#{output_path.base.url}/po4a/#{@md.fnb}/pot" + output_path.base.url + '/po4a/' \ + + @md.fnb + '/pot' end def rcp #p "#{output_path.base.dir}/po4a/#{@md.fnb}/pot" @@ -6000,7 +6298,10 @@ WOK Gt[:po] end def dir - pth=@env.processing_path.git + '/' + @md.fnb + '/' + ft + '/' + @md.opt.lng + pth=@env.processing_path.git + '/' \ + + @md.fnb + '/' \ + + ft + '/' \ + + @md.opt.lng FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) pth end @@ -6011,7 +6312,9 @@ WOK Gt[:pot] end def dir - @env.processing_path.git + '/' + @md.fnb + '/' + ft + @env.processing_path.git + '/' \ + + @md.fnb + '/' \ + + ft end self end @@ -6021,7 +6324,7 @@ WOK end def txt def ft - 'txt' + 'txt' end def dir set_path(ft).dir.abc @@ -6042,7 +6345,8 @@ WOK end def textile def ft - 'textile' + DEVELOPER[:under_construction] + 'textile' \ + + DEVELOPER[:under_construction] end def dir set_path(ft).dir.abc @@ -6063,7 +6367,8 @@ WOK end def asciidoc def ft - 'asciidoc' + DEVELOPER[:under_construction] + 'asciidoc' \ + + DEVELOPER[:under_construction] end def dir set_path(ft).dir.abc @@ -6084,7 +6389,8 @@ WOK end def markdown def ft - 'markdown' + DEVELOPER[:under_construction] + 'markdown' \ + + DEVELOPER[:under_construction] end def dir set_path(ft).dir.abc @@ -6105,7 +6411,8 @@ WOK end def rst def ft - 'rst' + DEVELOPER[:under_construction] + 'rst' \ + + DEVELOPER[:under_construction] end def dir set_path(ft).dir.abc @@ -6126,7 +6433,7 @@ WOK end def html_scroll def ft - 'html' + 'html' end def dir set_path(ft).dir.abc @@ -6158,7 +6465,7 @@ WOK end def html_seg def ft - "html/#{@md.fnb}" + 'html/' + @md.fnb end def dir set_path(ft).dir.abc @@ -6194,7 +6501,7 @@ WOK end def html def ft - 'html' + 'html' end def dir set_path(ft).dir.abc @@ -6224,7 +6531,7 @@ WOK end def xhtml def ft - 'xhtml' + 'xhtml' end def dir set_path(ft).dir.abc @@ -6248,7 +6555,7 @@ WOK end def epub def ft - 'epub' + 'epub' end def dir set_path(ft).dir.ab @@ -6272,7 +6579,7 @@ WOK end def odt def ft - 'odt' + 'odt' end def dir set_path(ft).dir.abc @@ -6293,7 +6600,7 @@ WOK end def xml def ft - 'xml' + 'xml' end def dir set_path(ft).dir.abc @@ -6325,7 +6632,7 @@ WOK end def xml_docbook def ft - 'docbook' + 'docbook' end def dir set_path(ft).dir.abc @@ -6349,7 +6656,8 @@ WOK end def xml_docbook_article def ft - 'docbook' + DEVELOPER[:under_construction] + 'docbook' \ + + DEVELOPER[:under_construction] end def dir set_path(ft).dir.abc @@ -6373,7 +6681,7 @@ WOK end def xml_docbook_book def ft - 'docbook' + 'docbook' end def dir set_path(ft).dir.abc @@ -6397,7 +6705,8 @@ WOK end def xml_fictionbook def ft - 'fictionbook' + DEVELOPER[:under_construction] + 'fictionbook' \ + + DEVELOPER[:under_construction] end def dir set_path(ft).dir.abc @@ -6421,8 +6730,7 @@ WOK end def xml_scaffold_structure_sisu def ft - 'sisu.scaffold.xml' - #'xml' + 'sisu.scaffold.xml' end def dir set_path(ft).dir.abc @@ -6446,8 +6754,7 @@ WOK end def xml_scaffold_structure_collapse def ft - 'collapsed.scaffold.xml' - #'xml' + 'collapsed.scaffold.xml' end def dir set_path(ft).dir.abc @@ -6471,7 +6778,7 @@ WOK end def pdf def ft - 'pdf' + 'pdf' end def dir set_path(ft).dir.abc @@ -6492,7 +6799,7 @@ WOK end def sqlite_discrete def ft - 'sql' + 'sql' end def dir set_path(ft).dir.ab @@ -6513,7 +6820,7 @@ WOK end def hash_digest def ft - 'hashes' + 'hashes' end def dir set_path(ft).dir.abc @@ -6534,7 +6841,7 @@ WOK end def manifest def ft - 'manifest' + 'manifest' end def dir set_path(ft).dir.abc @@ -6563,7 +6870,7 @@ WOK end def qrcode def ft - 'manifest/qrcode' + 'manifest/qrcode' end def dir set_path(ft).dir.abc @@ -6584,7 +6891,7 @@ WOK end def harvest def ft - 'site_metadata' + 'site_metadata' end def dir set_path(ft).dir.ab @@ -6611,7 +6918,7 @@ WOK end def manpage def ft - 'man' + 'man' end def dir set_path(ft).dir.ab @@ -6632,7 +6939,7 @@ WOK end def texinfo def ft - 'texinfo' + 'texinfo' end def dir set_path(ft).dir.ab @@ -6764,7 +7071,7 @@ WOK end end end - class CreateFile <InfoEnv #todo unify with FileOp + class CreateFile <InfoEnv #todo unify with FileOp def initialize(fns) begin super(fns) @@ -6780,7 +7087,8 @@ WOK #@env.path.output end def mkdir_pdf - Dir.mkdir(@env.processing_path.tex) unless FileTest.directory?(@env.processing_path.tex) + Dir.mkdir(@env.processing_path.tex) \ + unless FileTest.directory?(@env.processing_path.tex) end def file_generic(output_file='') filename="#{@env.path.output}/#{@fnb}/#{output_file}" @@ -6808,29 +7116,29 @@ WOK File.new("#{Dir.pwd}/#{@fns}.fn",'w+') end def meta - "#{@env.processing_path.ao}/#{@fns}.meta" + @env.processing_path.ao + '/' + @fns + '.meta' end def file_semantic - filename_semantic="./semantic.yaml" - @@filename_semantic=File.new(filename_semantic,'w+') + fn='./semantic.yaml' + @@filename_semantic=File.new(fn,'w+') end def file_rss - filename_rss="./semantic.xml" - @@filename_rss=File.new(filename_rss,'w+') + fn='./semantic.xml' + @@filename_rss=File.new(fn,'w+') end def epub @pth=@env.processing_path.epub def xhtml_index - filename_index="#{@pth}/#{Ep[:d_oebps]}/index.xhtml" - File.new(filename_index,'w+') + fn=@pth + '/' + Ep[:d_oebps] + '/index.xhtml' + File.new(fn,'w+') end def xhtml_cover_image - filename_index="#{@pth}/#{Ep[:d_oebps]}/cover_image.xhtml" - File.new(filename_index,'w+') + fn=@pth + '/' + Ep[:d_oebps] + '/cover_image.xhtml' + File.new(fn,'w+') end def xhtml_segtoc - filename_segtoc="#{@pth}/#{Ep[:d_oebps]}/toc.xhtml" - File.new(filename_segtoc,'w+') + fn=@pth + '/' + Ep[:d_oebps] + '/toc.xhtml' + File.new(fn,'w+') end def mimetype #fixed application/epub+zip ~/grotto/theatre/dbld/builds/epub_sample/mimetype File.new("#{@pth}/mimetype",'w') @@ -6853,7 +7161,7 @@ WOK File.new("#{@env.processing_path.texinfo}/#{@fnb}.texinfo",'w+') end end - class Clear <InfoEnv #todo unify with FileOp + class Clear <InfoEnv #todo unify with FileOp def initialize(cmd,fns,operation='') @cmd=cmd begin @@ -6899,11 +7207,12 @@ WOK @env.port.webrick_port end end - class InfoProgram < InfoEnv #revisit + class InfoProgram < InfoEnv #revisit attr_accessor :editor,:wc,:tidy,:rexml,:pdflatex,:postgresql,:sqlite def initialize prog=SiSU_Env::InfoEnv.new.program - @editor,@wc,@tidy,@rexml,@pdflatex,@postgresql,@sqlite=prog.text_editor,prog.wc,prog.tidy,prog.rexml,prog.pdflatex,prog.postgresql,prog.sqlite + @editor, @wc, @tidy, @rexml, @pdflatex, @postgresql, @sqlite= + prog.text_editor,prog.wc,prog.tidy,prog.rexml,prog.pdflatex,prog.postgresql,prog.sqlite end end class CSS_Default @@ -6940,9 +7249,9 @@ WOK def html if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html.css") - "#{@md.doc_css}_html.css" + @md.doc_css + '_html.css' elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_html.css") - "#{@env.path.base_markup_dir_stub}_html.css" + @env.path.base_markup_dir_stub + '_html.css' else SiSU_Env::CSS_Default.new.html end @@ -6950,54 +7259,54 @@ WOK def html_tables 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" + @md.doc_css + '_html_tables.css' elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_html_tables.css") - "#{@env.path.base_markup_dir_stub}_html_tables.css" + @env.path.base_markup_dir_stub + '_html_tables.css' else SiSU_Env::CSS_Default.new.html_tables end end def xhtml if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xhtml.css") - "#{@md.doc_css}_xhtml.css" + @md.doc_css + '_xhtml.css' elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xhtml.css") - "#{@env.path.base_markup_dir_stub}_xhtml.css" + @env.path.base_markup_dir_stub + '_xhtml.css' else SiSU_Env::CSS_Default.new.xhtml end end def xml_sax 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" + @md.doc_css + '_xml_sax.css' elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xml_sax.css") - "#{@env.path.base_markup_dir_stub}_xml_sax.css" + @env.path.base_markup_dir_stub + '_xml_sax.css' else SiSU_Env::CSS_Default.new.xml_sax end end def xml_dom 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" + @md.doc_css + '_xml_dom.css' elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xml_dom.css") - "#{@env.path.base_markup_dir_stub}_xml_dom.css" + @env.path.base_markup_dir_stub + '_xml_dom.css' else SiSU_Env::CSS_Default.new.xml_dom end end def xml_docbook if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_docbook.css") - "#{@md.doc_css}_xml_dom.css" + @md.doc_css + '_xml_dom.css' elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_docbook.css") - "#{@env.path.base_markup_dir_stub}_docbook.css" + @env.path.base_markup_dir_stub + '_docbook.css' else SiSU_Env::CSS_Default.new.xml_docbook end end def homepage if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_homepage.css") - "#{@md.doc_css}_homepage.css" + @md.doc_css + '_homepage.css' elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_homepage.css") - "#{@env.path.base_markup_dir_stub}_homepage.css" + @env.path.base_markup_dir_stub + '_homepage.css' else SiSU_Env::CSS_Default.new.homepage end end @@ -7010,15 +7319,24 @@ WOK @file=SiSU_Env::FileOp.new(@md) end def html - stylesheet="#{@file.path_rel_links.html_scroll_css}#{@env.path.style}/#{@css.html}" + stylesheet= + @file.path_rel_links.html_scroll_css \ + + @env.path.style + '/' \ + + @css.html %{ <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} end def html_seg - stylesheet="#{@file.path_rel_links.html_seg_css}#{@env.path.style}/#{@css.html}" + stylesheet= + @file.path_rel_links.html_seg_css \ + + @env.path.style + '/' \ + + @css.html %{ <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} end def html_tables - stylesheet="#{@file.path_rel_links.html_seg_css}#{@env.path.style}/#{@css.html}" + stylesheet= + @file.path_rel_links.html_seg_css \ + + @env.path.style + '/' \ + + @css.html %{ <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} end def xhtml_epub @@ -7028,19 +7346,31 @@ WOK xhtml_epub end def xhtml - stylesheet="#{@file.path_rel_links.xhtml_css}#{@env.path.style}/#{@css.xhtml}" + stylesheet= + @file.path_rel_links.xhtml_css \ + + @env.path.style + '/' \ + + @css.xhtml %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} end def xml_sax - stylesheet="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_sax}" + stylesheet= + @file.path_rel_links.xml_css \ + + @env.path.style + '/' \ + + @css.xml_sax %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} end def xml_dom - stylesheet="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_dom}" + stylesheet= + @file.path_rel_links.xml_css \ + + @env.path.style + '/' \ + + @css.xml_dom %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} end def xml_docbook - stylesheet="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_docbook}" + stylesheet= + @file.path_rel_links.xml_css \ + + @env.path.style + '/' \ + + @css.xml_docbook %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} end end @@ -7061,8 +7391,12 @@ WOK puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (no action taken)} else puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (in order to replace default sisu homepage)} - filename_homepage="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/index.html" - filename_home_toc="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/toc.html" + filename_homepage= + @env.path.webserv + '/' \ + + @env.path.base_markup_dir_stub + '/index.html' + filename_home_toc= + @env.path.webserv + '/' \ + + @env.path.base_markup_dir_stub + '/toc.html' file_homepage=File.new(filename_homepage,'w') file_home_toc=File.new(filename_home_toc,'w') file_homepage << @vz_home.homepage @@ -7073,7 +7407,8 @@ WOK end def homepage home_pages_manually_created=Dir.glob("#{@env.path.rc}/home/*.html") - FileUtils::mkdir_p("#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") + FileUtils::mkdir_p("#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") \ + unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") if home_pages_manually_created.length > 0 home_pages_manually_created.each do |homepage| FileUtils.cp(homepage,"#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") @@ -7101,13 +7436,17 @@ WOK end end def cp_local_images - src="#{@pwd}/_sisu/image" - dest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" + src=@pwd + '/_sisu/image' + dest= + @env.path.webserv + '/' \ + + @env.path.base_markup_dir_stub + '/_sisu/image' cp_images(src,dest) if FileTest.directory?(src) end def cp_external_images - src="#{@env.processing_path.processing}/external_document/image" - dest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external" + src=@env.processing_path.processing + '/external_document/image' + dest= + @env.path.webserv + '/' \ + + @env.path.base_markup_dir_stub + '/_sisu/image_external' if FileTest.directory?(src) cp_images(src,dest) if FileTest.directory?(src) end @@ -7116,15 +7455,17 @@ WOK src=@env.path.image_source dest_arr=[ "#{@env.path.webserv}/_sisu/image", - "#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" + "#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image", ] dest_arr.each do |dest| cp_images(src,dest) if FileTest.directory?(src) end end - def cp_webserver_images_local #this should not have been necessary + def cp_webserver_images_local #this should not have been necessary src=@env.path.image_source - dest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" + dest= + @env.path.webserv + '/' \ + + @env.path.base_markup_dir_stub + '/_sisu/image' cp_images(src,dest) if FileTest.directory?(src) end def cp_base_images #fix images @@ -7147,7 +7488,10 @@ WOK ] #BROKEN if defined? @rc['permission_set']['css_modify'] \ and @rc['permission_set']['css_modify'] - SiSU_Screen::Ansi.new(@opt.cmd,"*WARN* modify is css set to: #{@rc['permission_set']['css_modify']}").warn if @opt.cmd=~/[MV]/ + SiSU_Screen::Ansi.new( + @opt.cmd, + "*WARN* modify is css set to: #{@rc['permission_set']['css_modify']}" + ).warn if @opt.cmd=~/[MV]/ css_path.each do |x| if FileTest.directory?(x) FileUtils::cd(x) @@ -7170,7 +7514,8 @@ WOK fn_css=SiSU_Env::CSS_Default.new css=SiSU_Style::CSS.new path_style="#{@env.path.output}/#{@env.path.style}" - FileUtils::mkdir_p(path_style) unless FileTest.directory?(path_style) + FileUtils::mkdir_p(path_style) \ + unless FileTest.directory?(path_style) if @opt.cmd =~/C/ \ or not FileTest.file?("#{path_style}/#{fn_css.homepage}") style=File.new("#{path_style}/#{fn_css.homepage}",'w') |