diff options
| author | Ralph Amissah <ralph@amissah.com> | 2012-02-14 21:10:19 -0500 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2012-02-14 21:17:32 -0500 | 
| commit | 2b884fb73428186df29bf22ff38d77e5d2f823cf (patch) | |
| tree | 117330ff01c641b19c3963d3e91ce7f19056ca66 | |
| parent | v3dv: sysenv, output_dir_structure, rewritten, affected code modified (diff) | |
v3dv: --redirect (--redirect=dir_path) & --dump (--dump=dir_path) + consequences
* --dump places output in directory specified, if none specified in the current
  directory (pwd).
* --redirect places output in subdirectory under specified directory,
  subdirectory uses the filename (without the suffix). If no output directory is
  specified places the subdirectory under the current directory (pwd).
* html, css incorporated into each file (concordance & manifest included)
* html, xhtml & xmls, css copied into css subdirectory (not used by html as
  embedded)
* html xmls, images copied to output directory
* no links to manifest
* manifest with relative links only
* longer html filenames given to avoid names clashing (e.g. for toc, manifest,
  concordance)
* html, epub, remove manifest toc links
* -j copy images associated with file (images used by html & xmls)
  * automatically invoked by --dump & redirect
* v3 v3dv: document --redirect, --dump, -j update sisu_commands.sst
  [documents not generated until v3.2.0 (when v3dv branch is merged into v3)]
| -rw-r--r-- | data/doc/sisu/CHANGELOG_v3 | 24 | ||||
| -rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/sisu_commands.sst | 13 | ||||
| -rw-r--r-- | lib/sisu/v3dv/concordance.rb | 4 | ||||
| -rw-r--r-- | lib/sisu/v3dv/css.rb | 92 | ||||
| -rw-r--r-- | lib/sisu/v3dv/defaults.rb | 2 | ||||
| -rw-r--r-- | lib/sisu/v3dv/html.rb | 27 | ||||
| -rw-r--r-- | lib/sisu/v3dv/html_format.rb | 116 | ||||
| -rw-r--r-- | lib/sisu/v3dv/hub.rb | 8 | ||||
| -rw-r--r-- | lib/sisu/v3dv/manifest.rb | 70 | ||||
| -rw-r--r-- | lib/sisu/v3dv/options.rb | 30 | ||||
| -rw-r--r-- | lib/sisu/v3dv/param.rb | 2 | ||||
| -rw-r--r-- | lib/sisu/v3dv/shared_images.rb | 125 | ||||
| -rw-r--r-- | lib/sisu/v3dv/sisupod_make.rb | 2 | ||||
| -rw-r--r-- | lib/sisu/v3dv/sysenv.rb | 310 | ||||
| -rw-r--r-- | lib/sisu/v3dv/xhtml.rb | 4 | ||||
| -rw-r--r-- | lib/sisu/v3dv/xml.rb | 4 | ||||
| -rw-r--r-- | lib/sisu/v3dv/xml_dom.rb | 4 | ||||
| -rw-r--r-- | lib/sisu/v3dv/xml_format.rb | 6 | 
18 files changed, 660 insertions, 183 deletions
| diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 8bd53fea..314da884 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -23,6 +23,30 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.1.14.orig.tar.xz  * v3dv: sysenv, output_dir_structure, rewritten, affected code modified +* v3dv: --redirect (--redirect=dir_path) & --dump (--dump=dir_path) +  * --dump places output in directory specified, if none specified in the +    current directory (pwd). +  * --redirect places output in subdirectory under specified directory, +    subdirectory uses the filename (without the suffix). If no output +    directory is specified places the subdirectory under the current directory +    (pwd). +  * html, css incorporated into each file (concordance & manifest included) +  * html, xhtml & xmls, css copied into css subdirectory (not used by html as +    embedded) +  * html xmls, images copied to output directory +  * no links to manifest +  * manifest with relative links only +  * longer html filenames given to avoid names clashing (e.g. for toc, +    manifest, concordance) + +* v3dv: html, epub, remove manifest toc links + +* v3dv: -j copy images associated with file (images used by html & xmls) +  * automatically invoked by --dump & redirect + +* v3 v3dv: document --redirect, --dump, -j update sisu_commands.sst +  [documents not generated until v3.2.0 (when v3dv branch is merged into v3)] +  %% 3.1.13.orig.tar.xz (2012-02-03:05/5)  http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.1.13  http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.1.13-1 diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_commands.sst b/data/doc/sisu/markup-samples/sisu_manual/sisu_commands.sst index 201b927e..253553a0 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_commands.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/sisu_commands.sst @@ -87,6 +87,9 @@ assumed for most other flags, creates new intermediate files for processing (doc  !_ --delete [filename/wildcard] \\  see --zap +!_ --dump[=directory_path] [filename/wildcard] \\ +places output in directory specified, if none is specified in the current directory (pwd). Compare --redirect +  !_ -D [instruction] [filename] \\  see --pg @@ -124,7 +127,7 @@ see --git  makes two lists of sisu output based on the sisu markup documents in a directory: list of author and authors works (year and titles), and; list by topic with titles and author. Makes use of header metadata fields (author, title, date, topic_register). Can be used with maintenance (-M) and remote placement (-R) flags.  !_ --help [topic] \\ -provides help on the selected topic, where topics (keywords) include: list, (com)mands, short(cuts), (mod)ifiers, (env)ironment, markup, syntax, headers, headings, endnotes, tables, example, customise, skin, (dir)ectories, path, (lang)uage, db, install, setup, (conf)igure, convert, termsheet, search, sql, features, license +provides help on the selected topic, where topics (keywords) include: list, (com)mands, short(cuts), (mod)ifiers, (env)ironment, markup, syntax, headers, headings, endnotes, tables, example, customise, skin, (dir)ectories, path, (lang)uage, db, install, setup, (conf)igure, convert, termsheet, search, sql, features, license.  !_ --html [filename/wildcard] \\  produces html output, segmented text with table of contents (toc.html and index.html) and the document in a single file (scroll.html). Alias -h @@ -138,6 +141,9 @@ see --texinfo  !_ -i [filename/wildcard] \\  see --manpage +!_ -j [filename/wildcard] \\ +copies images associated with a file for use by html, xhtml & xml outputs (automatically invoked by --dump & redirect). +  !_ --keep-processing-files [filename/wildcard/url] \\  see --maintenance @@ -148,7 +154,7 @@ prints license information.  see --dal (document abstraction level/layer)  !_ --maintenance [filename/wildcard/url] \\ -maintenance mode, interim processing files are preserved and their locations indicated. (also see -V). Aliases -M and --keep-processing-files +maintenance mode, interim processing files are preserved and their locations indicated. (also see -V). Aliases -M and --keep-processing-files.  !_ --manpage [filename/wildcard] \\  produces man page of file, not suitable for all outputs. Alias -i @@ -207,6 +213,9 @@ see --qrcode  !_ -q [filename/wildcard] \\  see --quiet +!_ --redirect[=directory_path] [filename/wildcard] \\ +places output in subdirectory under specified directory, subdirectory uses the filename (without the suffix). If no output directory is specified places the subdirectory under the current directory (pwd). Compare --dump +  !_ --rsync [filename/wildcard] \\  copies sisu output files to remote host using rsync. This requires that sisurc.yml has been provided with information on hostname and username, and that you have your "keys" and ssh agent in place. Note the behavior of rsync different if -R is used with other flags from if used alone. Alone the rsync --delete parameter is sent, useful for cleaning the remote directory (when -R is used together with other flags, it is not). Also see --scp. Alias -R diff --git a/lib/sisu/v3dv/concordance.rb b/lib/sisu/v3dv/concordance.rb index 82c53e7a..7ec234bc 100644 --- a/lib/sisu/v3dv/concordance.rb +++ b/lib/sisu/v3dv/concordance.rb @@ -121,7 +121,7 @@ WOK        def create          head_banner=SiSU_HTML_Format::HeadToc.new(@md)          minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,@data).songsheet.join("\n") -        @css=SiSU_Env::CSS_Stylesheet.new(@md) +        stylesheet=SiSU_Style::CSS_HeadInfo.new(@md).stylesheet          toc='<div class="toc">' + minitoc + '</div>'          <<WOK  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> @@ -136,7 +136,7 @@ WOK    <meta name="generator" content="SiSU (Linux & Ruby!)">    <link rel="generator" href="http://www.jus.uio.no/sisu" />    <link rel="shortcut icon" href="../_sisu/image/rb7.ico" /> -  #{@css.html_seg} +  #{stylesheet.css_head_seg}    #{@vz.js_head}  </head>  <body> diff --git a/lib/sisu/v3dv/css.rb b/lib/sisu/v3dv/css.rb index 522aae7e..cdcd16cd 100644 --- a/lib/sisu/v3dv/css.rb +++ b/lib/sisu/v3dv/css.rb @@ -59,6 +59,98 @@  module SiSU_Style    require_relative 'sysenv'                             # sysenv.rb    require_relative 'defaults'                           # defaults.rb +  class CSS_HeadInfo +    def initialize(md,ft='html') +      @md,@ft=md,ft +      @env=SiSU_Env::InfoEnv.new('',md) +      @fn_css ||=SiSU_Env::CSS_Default.new +      @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure +      css_copy +    end +    def stylesheet +      def css_path +        SiSU_Env::CSS_Stylesheet.new(@md) +      end +      def css_embed_content +        @css_embed_content ||=SiSU_Style::CSS.new +      end +      def css_embed? +        if @ft=='html' \ +        && @o_str.dump_or_redirect? +          true +        else +          false +        end +      end +      def css_embed(css) +        <<-WOK +          <style TYPE="text/css"> +          #{css} +          </style> +        WOK +      end +      def css_action +        style_css=SiSU_Style::CSS.new +        css=case @ft +        when 'html' +          css=css_embed_content.html +          css_embed(css) +        when 'xhtml' +          css_path.xhtml +        when 'xml_sax' +          css_path.xml_sax +        when 'xml_dom' +          css_path.xml_dom +        else +          css_embed_content.html +        end +      end +      def css_head +        (css_embed?) \ +        ? css_action\ +        : "#{css_path.html}#{css_path.html_seg}" +      end +      def css_head_seg +        (css_embed?) \ +        ? css_action \ +        : css_path.html_seg +      end +      def css_head_xml +        css_action +      end +      self +    end +    def css_copy +      if @o_str.dump_or_redirect? +        css=SiSU_Style::CSS.new +        if @o_str.dump? +          css_pth="#{@md.opt.opt_act[:dump][:inst]}/#{@env.path.style}" +        elsif @o_str.redirect? +          css_pth="#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}/#{@env.path.style}" +        end +        FileUtils::mkdir_p(css_pth) unless FileTest.directory?(css_pth) +        case @ft +        when 'html' +          style=File.new("#{css_pth}/#{@fn_css.html}",'w') +          style << css.html +          style.close +        when 'xhtml' +          style=File.new("#{css_pth}/#{@fn_css.xhtml}",'w') +          style << css.xhtml +          style.close +        when 'xml_sax' +          style=File.new("#{css_pth}/#{@fn_css.xml_sax}",'w') +          style << css.xml_sax +          style.close +        when 'xml_dom' +          style=File.new("#{css_pth}/#{@fn_css.xml_dom}",'w') +          style << css.xml_dom +          style.close +          css_path.xml_dom +        end +      end +    end +  end    class CSS      def initialize        @vz=SiSU_Env::GetInit.instance.skin diff --git a/lib/sisu/v3dv/defaults.rb b/lib/sisu/v3dv/defaults.rb index 1c9dd94f..eab42b71 100644 --- a/lib/sisu/v3dv/defaults.rb +++ b/lib/sisu/v3dv/defaults.rb @@ -1040,7 +1040,7 @@ module SiSU_Viz      def png_book        %{<img border="2" height="15" width="15" src="#{url_path_image_sys}/#{icon_book}" alt="Cameron May Books" />}      end -    #% png_nav +    #% png_nav #not currently used      def png_nav_home      end      def png_nav_toc diff --git a/lib/sisu/v3dv/html.rb b/lib/sisu/v3dv/html.rb index ec7b0573..75d89382 100644 --- a/lib/sisu/v3dv/html.rb +++ b/lib/sisu/v3dv/html.rb @@ -138,14 +138,10 @@ module SiSU_HTML        def link_images          @symlnk.images        end -      def directories -        title=File.basename(@md.fns,'.rb') -      end        def tuned_file_instructions          @tell=SiSU_Screen::Ansi.new(@md.opt.cmd)          @md.opt.cmd=@md.opt.cmd.gsub(/H/,'h') -        @md.file_type='html' if @md.opt.cmd =~/[hon]/ -        directories +        @md.file_type='html' if @md.opt.cmd =~/[hw]/          newfilename=%{#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_segtoc}} if @md.file_type =~/html/          dal_array=@particulars.dal_array # dal file drawn here          @tuned_file_array=SiSU_HTML_Tune::Tune.new(dal_array,@md).songsheet @@ -611,7 +607,8 @@ WOK      class Output        def initialize(data='',md='')          @data,@md=data,md -        @file=SiSU_Env::FileOp.new(@md) +        @file=SiSU_Env::FileOp.new(md) +        @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure        end        def scroll          begin @@ -646,15 +643,17 @@ WOK          rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error          ensure            @filename_html_segtoc.close -          unless FileTest.file?("#{@file.output_path.html_seg.dir}/#{@md.file.base_filename.html_seg_index}") -            pwd_set=Dir.pwd -            idx_lnk=@file.base_filename.html_segtoc -            mlnk=@file.base_filename.html_seg_index -            Dir.chdir(@file.output_path.html_seg.dir) -            FileUtils::rm_f(mlnk) -            FileUtils::ln_s(idx_lnk, mlnk) -            Dir.chdir(pwd_set) +          pwd_set=Dir.pwd +          idx_lnk=if @o_str.dump_or_redirect? +            @file.base_filename.manifest +          else +            @file.base_filename.html_segtoc            end +          mlnk=@file.base_filename.html_seg_index +          Dir.chdir(@file.output_path.html_seg.dir) +          FileUtils::rm_f(mlnk) +          FileUtils::ln_s(idx_lnk,mlnk) +          Dir.chdir(pwd_set)          end        end      end diff --git a/lib/sisu/v3dv/html_format.rb b/lib/sisu/v3dv/html_format.rb index 29d1bfcb..d8b44760 100644 --- a/lib/sisu/v3dv/html_format.rb +++ b/lib/sisu/v3dv/html_format.rb @@ -96,6 +96,7 @@ module SiSU_HTML_Format      end    end    class HeadInformation +    require_relative 'css'                              # css.rb      require_relative 'shared_xml'                       # shared_xml.rb      include SiSU_Viz      attr_reader :md,:rdf,:vz @@ -103,12 +104,61 @@ module SiSU_HTML_Format        @md=md        # DublinCore 1 - title        @vz=SiSU_Env::GetInit.instance.skin -      @css=SiSU_Env::CSS_Stylesheet.new(md)        @seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || [])        @seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || []) -      @toc,@index='toc','index'        @metalink='#metadata'        @tocband_scroll,@tocband_segtoc=nil,nil +      @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet +      @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure +      @index='index' +      @toc="#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}" +    end +    def url_path_image_sys +      (@o_str.dump_or_redirect?) \ +      ? './image' +      : "#{Xx[:html_relative2]}_sisu/image_sys" +    end +    def icon +      def up +        'arrow_up_red.png' +      end +      def next +        'arrow_next_red.png' +      end +      def previous +        'arrow_prev_red.png' +      end +      def dot_clear +        'dot_clear.png' +      end +      def dot_white +        'dot_white.png' +      end +      def dot +        dot_white +      end +      self +    end +    def png_nav +      def toc +        %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon.up}" alt="TOC" />} +      end +      def pre +        %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon.previous}" alt="<< previous" />} +      end +      def nxt +        %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon.next}" alt="next >>" />} +      end +      def dot_toc +        %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon.dot}" alt="^" />} +      end +      def dot_pre +        %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon.dot}" alt="<" />} +      end +      def dot_nxt +        %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon.dot}" alt=">" />} +      end +      self      end      def doc_types #used in toc & seg_nav_band        scroll=seg='' @@ -154,8 +204,9 @@ module SiSU_HTML_Format        super(md)        @md=md        @cf_defaults=SiSU_Env::InfoProcessingFlag.new -      @env=SiSU_Env::InfoEnv.new(@md.fns) -      @file=SiSU_Env::FileOp.new(@md) +      @env=SiSU_Env::InfoEnv.new(md.fns) +      @file=SiSU_Env::FileOp.new(md) +      @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure      end      def home        %{<td align="center" bgcolor=#{@vz.color_band2}> @@ -187,16 +238,19 @@ module SiSU_HTML_Format        env.widget.search_form('sisusearch',nil,nil,true)      end      def manifest -      manifest_lnk=if @file.output_dir_structure.by_language_code? \ -      or @file.output_dir_structure.by_filetype? -        "#{Xx[:html_relative1]}manifest/#{@file.base_filename.manifest}" -      else @file.base_filename.manifest -      end +      if not @o_str.dump_or_redirect? +        manifest_lnk=if @file.output_dir_structure.by_language_code? \ +        or @file.output_dir_structure.by_filetype? +          "#{Xx[:html_relative1]}manifest/#{@file.base_filename.manifest}" +        else @file.base_filename.manifest +        end          %{<td align="center" bgcolor=#{@vz.color_band2}>    <a href="#{manifest_lnk}" target="_top" #{@vz.js_manifest}>      #{@vz.nav_txt_manifest}    </a>  </td>} +      else '' +      end      end      def pdf #retired 2.7.9        pdf=if @md.programs[:pdf] \ @@ -267,6 +321,7 @@ module SiSU_HTML_Format      def initialize(md)        super(md)        @md=md +      @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure      end      def scroll_head_navigation_band        pdf=if @md.programs[:pdf] @@ -293,14 +348,14 @@ WOK  </td>  <td width="20%" align="right">     <a href="toc.html" target="_top" alt="->"> -      #{@vz.png_nav_toc} +      #{png_nav.toc}      </a>   #{@vz.table_close}  <p />}      end      def seg_head_navigation_band(type='')        firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="->"> -      #{@vz.png_nav_nxt} +      #{png_nav.nxt}      </a>} if @md.firstseg =~/\S+/        %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}>  <tr><td width="20%"> @@ -319,7 +374,7 @@ WOK          @tocband_segtoc=make_scroll_seg_pdf        end        firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="->"> -      #{@vz.png_nav_nxt} +      #{png_nav.nxt}      </a>} if @md.firstseg =~/\S+/        %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}>  <tr><td width="20%"> @@ -394,7 +449,7 @@ WOK    </title>  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />  #{rdf.metatag_html} -#{@css.html}#{@css.html_seg} +#{@stylesheet.css_head}  </head>  #{@vz.color_body}  <a name="top" id="top"></a> @@ -529,12 +584,15 @@ WOK  #{@vz.table_close}}      end      def manifest #check structure -      manifest=manifest_link(@vz.nav_txt_manifest) -      %{#{@vz.margin_txt_3} +      if not @o_str.dump_or_redirect? +        manifest=manifest_link(@vz.nav_txt_manifest) +        %{#{@vz.margin_txt_3}    #{@vz.paragraph_font_small}     #{manifest}      </font>  #{@vz.table_close}} +      else '' +      end      end      def concordance #check structure        concord=concordance_link(@vz.nav_txt_concordance) @@ -618,14 +676,14 @@ WOK      end    end    class HeadSeg < HeadInformation -    def initialize(md) #(md='') +    def initialize(md)        super(md)      end      def title_banner(title,subtitle,creator)      end      def dot_control_pre_next        pre="#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.lang_code_insert}#{Sfx[:html]}" -      up="#{@toc}#{@md.lang_code_insert}#{Sfx[:html]}" +      up=@toc        nxt="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}"        if nxt=~/sisu_manifest\.html/          @file=SiSU_Env::FileOp.new(@md) if @md @@ -637,56 +695,56 @@ WOK        %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center">  <tr><td align="left">    <a href="#{pre}" target="_top" #{@vz.js_prev}> -    #{@vz.png_nav_dot_pre} +    #{png_nav.dot_pre}    </a>  </td>  <td align="center">    <a href="#{up}" target="_top" #{@vz.js_toc}> -    #{@vz.png_nav_dot_toc} +    #{png_nav.dot_toc}    </a>  </td>  <td align="right">    <a href="#{nxt}" target="_top" #{@vz.js_next}> -    #{@vz.png_nav_dot_nxt} +    #{png_nav.dot_nxt}    </a>  #{@vz.table_close}}      end      def dot_control_pre        pre="#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.lang_code_insert}#{Sfx[:html]}" -      up="#{@toc}#{@md.lang_code_insert}#{Sfx[:html]}" +      up=@toc        nxt="#{@md.file.base_filename.html_segtoc}"        %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center">  <tr><td align="left">    <a href="#{pre}" target="_top" #{@vz.js_prev}> -    #{@vz.png_nav_dot_pre} +    #{png_nav.dot_pre}    </a>  </td>  <td align="center">    <a href="#{up}" target="_top" #{@vz.js_toc}> -    #{@vz.png_nav_dot_toc} +    #{png_nav.dot_toc}    </a>  </td>  <td align="right">    <a href="#{nxt}" target="_top" #{@vz.js_next}> -    #{@vz.png_nav_dot_nxt} +    #{png_nav.dot_nxt}    </a>  #{@vz.table_close}}      end      def toc_nav(f_pre=false,f_nxt=false,use=1)        pre=nxt=''        toc=%{<td align="center" bgcolor=#{@vz.color_band1}> -  <a href="#{@toc}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" #{@vz.js_toc}> -    #{@vz.png_nav_toc} +  <a href="#{@toc}" target="_top" #{@vz.js_toc}> +    #{png_nav.toc}    </a>  </td>}        pre=%{<td align="center" bgcolor=#{@vz.color_band1}>    <a href="#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" #{@vz.js_prev}> -    #{@vz.png_nav_pre} +    #{png_nav.pre}    </a>  </td>} if f_pre==true        nxt=%{<td align="center" bgcolor=#{@vz.color_band1}>    <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" #{@vz.js_next}> -    #{@vz.png_nav_nxt} +    #{png_nav.nxt}    </a>  </td>} if f_nxt==true        if nxt =~/sisu_manifest.html/ @@ -853,7 +911,7 @@ WOK    </title>  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />  #{rdf.metatag_html} -#{@css.html_seg} +#{@stylesheet.css_head_seg}  </head>  #{@vz.color_body}  <a name="top" id="top"></a> diff --git a/lib/sisu/v3dv/hub.rb b/lib/sisu/v3dv/hub.rb index 4924297a..fd7909ec 100644 --- a/lib/sisu/v3dv/hub.rb +++ b/lib/sisu/v3dv/hub.rb @@ -202,7 +202,7 @@ module SiSU                    when /^share_src$/;       SiSU_Markup::Source.new(@opt).read           # -s     share_src.rb                    when /^sisupod_make$/;    SiSU_Doc::Source.new(@opt).read              # -S     sisupod_make.rb  #                 when /^source_kdissert$/; SiSU_KdiSource::Source.new(@opt).read       # -S     share_src_kdissert.rb -                  when /^digests$/;         SiSU_DigestView::Source.new(@opt).read      # -N     digests.rb +                  when /^digests$/;         SiSU_DigestView::Source.new(@opt).read       # -N     digests.rb                    when /^plaintext$/;       SiSU_Plaintext::Source.new(@opt).read        # -t -a  plaintext.rb                    when /^po4a$/;            SiSU_Po4a::Source.new(@opt).read             # -P     po4a.rb                   #when /^wikispeak$/;       SiSU_Wikispeak::Source.new(@opt).read        # -g @@ -216,6 +216,7 @@ module SiSU                    when /^xhtml$/;           SiSU_XHTML::Source.new(@opt).read            # -b     xhtml.rb                    when /^xml$/;             SiSU_XML_SAX::Source.new(@opt).read          # -x     xml.rb                    when /^xml_dom$/;         SiSU_XML_DOM::Source.new(@opt).read          # -X     xml_dom.rb +                  when /^shared_images$/;   SiSU_Images::Source.new(@opt).read            # -j     shared_images.rb                   #when /^xml_fictionbook$/; SiSU_XML_Fictionbook::Source.new(@opt).read  # -f                    when /^xml_scaffold$/;    SiSU_XML_Scaffold::Source.new(@opt).read     # -k     xml_scaffold.rb                    when /^embedded$/;        SiSU_Embedded::Source.new(@opt).read         # -m     embedded.rb (image and other content) #check @@ -357,7 +358,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/          SiSU_Harvest::Source.new(@opt).read                                    # -h -H  html.rb        elsif @opt.mod.inspect =~/--convert|--to|--from/          require_relative 'sst_convert_markup'                                  # sst_convert_markup.rb -      elsif @opt.cmd =~/([abCcDdeFGgHhIikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \ +      elsif @opt.cmd =~/([abCcDdeFGgHhIjikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \        and @opt.cmd =~/^-/ \        and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \        or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ @@ -518,6 +519,9 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/          if @opt.act[:xhtml][:bool]                                             #% --xhtml, -b xhtml            op('xhtml','xhtml sax')          end +        if @opt.act[:images][:bool]                                            #% --images, -j +          op('shared_images','images') +        end          if @opt.act[:concordance][:bool]                                       #% --concordance, -w            op('concordance','Concordance')          end diff --git a/lib/sisu/v3dv/manifest.rb b/lib/sisu/v3dv/manifest.rb index 3310fa98..19fdc65c 100644 --- a/lib/sisu/v3dv/manifest.rb +++ b/lib/sisu/v3dv/manifest.rb @@ -106,6 +106,12 @@ module SiSU_Manifest          @fnb=@md.fnb          @base_url="#{@env.url.root}/#{@fnb}"          @f=SiSU_Env::FileOp.new(@md) +        @o_str=SiSU_Env::OutputStructure.new(md).output_dir_structure +        @image_path=if @o_str.dump_or_redirect? +          %{./image} +        else +          %{#{@f.path_rel_links.html_scroll_2}_sisu/image_sys} +        end          @base_path=@f.output_path.manifest.dir          @@dg ||=SiSU_Env::InfoEnv.new.digest.type          @dg=@@dg @@ -113,6 +119,7 @@ module SiSU_Manifest          @language=l[:n]          @translate=SiSU_Translate::Source.new(@md,@language)          @brace_url=SiSU_Viz::Skin.new.url_decoration +        @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet        end        def output          manifest=@f.write_file.manifest @@ -122,17 +129,26 @@ module SiSU_Manifest            manifest << x          end        end +      def url_make(url,file,src=nil) +        if @o_str.dump_or_redirect? +          '' +        elsif :src +          %{<br />#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}} +        else +          %{<p class="tiny">#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}</p>} +        end +      end        def summarize(id,file,pth='',rel='',url='',img='● ')          size=(File.size("#{pth}/#{file}")/1024.00).to_s          kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]          @manifest[:txt] << "#{file} #{id} #{kb}\n" -        @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{id}</a></p></th><td><p class="small"><a href="#{rel}/#{file}">#{file}</a></p><p class="tiny">#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">#{kb}</p></td></tr>\n} +        @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{id}</a></p></th><td><p class="small"><a href="#{rel}/#{file}">#{file}</a></p>#{url_make(url,file)}</td><td class="right"><p class="right">#{kb}</p></td></tr>\n}        end        def summarize_html_seg(id,file,pth='',rel='',url='',img='● ')          size=(File.size("#{pth}/#{file}")/1024.00).to_s          kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]          @manifest[:txt] << "#{file} #{id} #{kb}\n" -        @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{id}</a></p></th><td><p class="small"><a href="#{rel}/#{file}">#{file}</a></p><p class="tiny">#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">#{kb}</p></td></tr>\n} +        @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{id}</a></p></th><td><p class="small"><a href="#{rel}/#{file}">#{file}</a></p>#{url_make(url,file)}</td><td class="right"><p class="right">#{kb}</p></td></tr>\n}        end        def summarize_sources(id,file,pth,rel,url)          sys=SiSU_Env::SystemCall.new @@ -143,7 +159,7 @@ module SiSU_Manifest          size=(File.size("#{pth}/#{file}")/1024.00).to_s          kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]          @manifest[:txt] << "#{file} #{id} #{kb}\n" -        @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{id}</a></p></th><td class="right"><p class="tiny"><a href="#{rel}/#{file}">#{file}</a>   #{dgst[1]}<br />#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">#{kb}</p></td></tr>\n} if kb and kb =~/\d+/ +        @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{id}</a></p></th><td class="right"><p class="tiny"><a href="#{rel}/#{file}">#{file}</a>   #{dgst[1]}#{url_make(url,file,:src)}</p></td><td class="right"><p class="right">#{kb}</p></td></tr>\n} if kb and kb =~/\d+/        end        def published_manifests?          @f=SiSU_Env::FileOp.new(@md) #.base_filename @@ -153,7 +169,13 @@ module SiSU_Manifest          mp,mn,mt,mr=nil,nil,nil,nil          ln=SiSU_i18n::Languages.new.language.list          Px[:lng_lst].each do |lc| -          if @env.output_dir_structure.by_language_code? +          if @o_str.dump_or_redirect? #does not work for --redirect or --dump +            mp="#{@f.output_path.base.dir}" +            mn="#{@md.fnb}.html" +            mt="#{mp}/#{mn}" +            mr="../../#{lc}/manifest/#{mn}" +            mu="#{url}/#{mn}" +          elsif @env.output_dir_structure.by_language_code?              mp="#{@f.output_path.base.dir}/#{lc}/manifest"              mn="#{@md.fnb}.html"              mt="#{mp}/#{mn}" @@ -212,7 +234,7 @@ module SiSU_Manifest        end        def output_tests          if FileTest.file?(@f.place_file.html_segtoc.dir)==true -          img=%{<img border="0" height="18" width="15" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_toc.png" alt="TOC linked" /> } +          img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_toc.png" alt="TOC linked" /> }            pth=@f.output_path.html_seg.dir            rel=@f.output_path.html_seg.rel_sm            url=@f.output_path.html_seg.url @@ -220,7 +242,7 @@ module SiSU_Manifest            summarize_html_seg(id,file,pth,rel,url,img)          end          if FileTest.file?(@f.place_file.html_scroll.dir)==true -          img=%{<img border="0" height="15" width="15" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_doc.png" alt="Full Text" /> } +          img=%{<img border="0" height="15" width="15" src="#{@image_path}/b_doc.png" alt="Full Text" /> }            pth=@f.output_path.html_scroll.dir            rel=@f.output_path.html_scroll.rel_sm            url=@f.output_path.html_scroll.url @@ -242,7 +264,7 @@ module SiSU_Manifest            summarize(id,file,pth,rel,url)          end          if FileTest.file?(@f.place_file.epub.dir)==true -          img=%{<img border="0" height="18" width="18" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_epub.png" alt="EPUB" /> } +          img=%{<img border="0" height="18" width="18" src="#{@image_path}/b_epub.png" alt="EPUB" /> }            id,file='EPUB (Electronic Publication, e-book standard)',@f.base_filename.epub            pth=@f.output_path.epub.dir            rel=@f.output_path.epub.rel_sm @@ -250,7 +272,7 @@ module SiSU_Manifest            summarize(id,file,pth,rel,url,img)          end          if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_letter}")==true -          img=%{<img border="0" height="18" width="15" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> } +          img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }            pth=@f.output_path.pdf.dir            rel=@f.output_path.pdf.rel_sm            url=@f.output_path.pdf.url @@ -258,7 +280,7 @@ module SiSU_Manifest            summarize(id,file,pth,rel,url,img)          end          if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_letter}")==true -          img=%{<img border="0" height="15" width="18" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> } +          img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }            pth=@f.output_path.pdf.dir            rel=@f.output_path.pdf.rel_sm            url=@f.output_path.pdf.url @@ -266,7 +288,7 @@ module SiSU_Manifest            summarize(id,file,pth,rel,url,img)          end          if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a4}")==true -          img=%{<img border="0" height="18" width="15" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> } +          img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }            pth=@f.output_path.pdf.dir            rel=@f.output_path.pdf.rel_sm            url=@f.output_path.pdf.url @@ -274,7 +296,7 @@ module SiSU_Manifest            summarize(id,file,pth,rel,url,img)          end          if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a4}")==true -          img=%{<img border="0" height="15" width="18" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> } +          img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }            pth=@f.output_path.pdf.dir            rel=@f.output_path.pdf.rel_sm            url=@f.output_path.pdf.url @@ -282,7 +304,7 @@ module SiSU_Manifest            summarize(id,file,pth,rel,url,img)          end          if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a5}")==true -          img=%{<img border="0" height="18" width="15" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> } +          img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }            pth=@f.output_path.pdf.dir            rel=@f.output_path.pdf.rel_sm            url=@f.output_path.pdf.url @@ -290,7 +312,7 @@ module SiSU_Manifest            summarize(id,file,pth,rel,url,img)          end          if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a5}")==true -          img=%{<img border="0" height="15" width="18" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> } +          img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }            pth=@f.output_path.pdf.dir            rel=@f.output_path.pdf.rel_sm            url=@f.output_path.pdf.url @@ -298,7 +320,7 @@ module SiSU_Manifest            summarize(id,file,pth,rel,url,img)          end          if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_b5}")==true -          img=%{<img border="0" height="18" width="15" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> } +          img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }            pth=@f.output_path.pdf.dir            rel=@f.output_path.pdf.rel_sm            url=@f.output_path.pdf.url @@ -306,7 +328,7 @@ module SiSU_Manifest            summarize(id,file,pth,rel,url,img)          end          if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_b5}")==true -          img=%{<img border="0" height="15" width="18" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> } +          img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }            pth=@f.output_path.pdf.dir            rel=@f.output_path.pdf.rel_sm            url=@f.output_path.pdf.url @@ -314,7 +336,7 @@ module SiSU_Manifest            summarize(id,file,pth,rel,url,img)          end          if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_legal}")==true -          img=%{<img border="0" height="18" width="15" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> } +          img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }            pth=@f.output_path.pdf.dir            rel=@f.output_path.pdf.rel_sm            url=@f.output_path.pdf.url @@ -322,7 +344,7 @@ module SiSU_Manifest            summarize(id,file,pth,rel,url,img)          end          if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_legal}")==true -          img=%{<img border="0" height="15" width="18" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> } +          img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }            pth=@f.output_path.pdf.dir            rel=@f.output_path.pdf.rel_sm            url=@f.output_path.pdf.url @@ -330,7 +352,7 @@ module SiSU_Manifest            summarize(id,file,pth,rel,url,img)          end          if FileTest.file?(@f.place_file.odt.dir)==true -          img=%{<img border="0" height="18" width="18" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_odf.png" alt="ODF/ODT" /> } +          img=%{<img border="0" height="18" width="18" src="#{@image_path}/b_odf.png" alt="ODF/ODT" /> }            pth=@f.output_path.odt.dir            rel=@f.output_path.odt.rel_sm            url=@f.output_path.odt.url @@ -416,8 +438,11 @@ module SiSU_Manifest        end        def qrc_image          fn=@md.fnb -        img_md="qrcode/#{fn}.md.png" -        img_title="qrcode/#{fn}.title.png" +        pth=(@o_str.dump_or_redirect?) \ +        ? '.' \ +        : 'qrcode' +        img_md="#{pth}/#{fn}.md.png" +        img_title="#{pth}/#{fn}.title.png"          if FileTest.file?(@f.place_file.qrcode_md.dir)==true            @manifest[:html] <<<<WOK  <tr><td class="left"> @@ -763,13 +788,14 @@ SiSU manifest: #{@md.title.full}  <meta name="sourcefile" content="#{@md.fns}" />  <link rel="generator" href="http://www.jus.uio.no/sisu" />  <link rel="shortcut icon" href="#{@f.path_rel_links.html_scroll_css}_sisu/image_sys/rb7.ico" /> -<link rel="stylesheet" href="#{@f.path_rel_links.html_scroll_css}_sisu/css/html.css" type="text/css" /> +#{@stylesheet.css_head}  </head>  <body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">  #{banner_table}  WOK            if @env.manifest_minitoc? -            if @env.output_dir_structure.by_language_code? \ +            if @o_str.dump_or_redirect? +            elsif @env.output_dir_structure.by_language_code? \              or @env.output_dir_structure.by_filetype?                minitoc=minitoc.gsub(/<a href="(\S+?)"/m,%{<a href="../html/#{@md.fnb}/\\1"}).                  gsub(/<a href="\.\.\/html\/#{@md.fnb}\/(?:sisu_manifest\.html|#{@f.base_filename.manifest})"/m, diff --git a/lib/sisu/v3dv/options.rb b/lib/sisu/v3dv/options.rb index 4cd071ac..fbb3261e 100644 --- a/lib/sisu/v3dv/options.rb +++ b/lib/sisu/v3dv/options.rb @@ -362,6 +362,7 @@ module SiSU_Commandline            when /^--(?:xhtml)$/;                              c=c+'b'            when /^--(?:xml-sax)$/;                            c=c+'x'            when /^--(?:xml-dom)$/;                            c=c+'X' +          when /^--(?:images)$/;                             c=c+'j'            when /^--(?:hash-digests)$/;                       c=c+'N'            when /^--(?:po4a|pot?)$/;                          c=c+'P'            when /^--(?:termsheet)$/;                          c=c+'T' @@ -406,6 +407,13 @@ module SiSU_Commandline          else ''          end        end +      if cmd !~/j/ +        extra+=if cmd =~/[bHhwXxyz]/ \ +        and cmd !~/[j]/ +          'j'                        #% copy images +        else '' +        end +      end        if cmd !~/y/          extra+=if cmd =~/[abeHhIiNopsSstwXxz]/ \          and cmd !~/y/ @@ -435,10 +443,26 @@ module SiSU_Commandline        : { bool: false }        act[:rc]=if mod.inspect =~/"--rc=/          x=Dir.pwd + '/' + mod.join.gsub(/--rc=/,'') -        { bool: true, inst: x  } +        { bool: true, inst: x }        else          { bool: false, inst: '' }        end +      act[:dump]=if mod.inspect =~/"--dump=/ +        base_pth=mod.join(';').gsub(/^.*--dump=['"]?(.+?)(?:['"]?;.+)?$/,'\1') +        { bool: true, inst: base_pth } +      elsif mod.inspect =~/"--dump/ +        { bool: true, inst: @base_path } +      else +        { bool: false, inst: nil } +      end +      act[:redirect]=if mod.inspect =~/"--redirect=/ +        base_pth=mod.join(';').gsub(/^.*--redirect=['"]?(.+?)(?:['"]?;.+)?$/,'\1') +        { bool: true, inst: base_pth } +      elsif mod.inspect =~/"--redirect/ +        { bool: true, inst: @base_path } +      else +        { bool: false, inst: nil } +      end        act[:verbose]=(cmd =~/v/ \        || mod.inspect =~/"--verbose"/) \        ? { bool: true } @@ -478,6 +502,10 @@ module SiSU_Commandline        || mod.inspect =~/"--concordance"/) \        ? { bool: true }        : { bool: false } +      act[:images]=(cmd =~/j/ \ +      || mod.inspect =~/"--images"/) \ +      ? { bool: true } +      : { bool: false }        act[:pdf]=(cmd =~/p/ \        || mod.inspect =~/"--pdf"/) \        ? { bool: true } diff --git a/lib/sisu/v3dv/param.rb b/lib/sisu/v3dv/param.rb index f9734da3..fac9ad76 100644 --- a/lib/sisu/v3dv/param.rb +++ b/lib/sisu/v3dv/param.rb @@ -783,7 +783,6 @@ module SiSU_Param              { str: '\b(?:' + x + ')\b', regx: y, i: i }            else nil            end -          z          end          def italics            m=@h['italics'] @@ -796,7 +795,6 @@ module SiSU_Param              { str: '\b(?:' + x + ')\b', regx: y, i: i }            else nil            end -          z          end          def emphasis            if @h['emphasis'] =~/bold/;                   'bold' diff --git a/lib/sisu/v3dv/shared_images.rb b/lib/sisu/v3dv/shared_images.rb new file mode 100644 index 00000000..a61fdd38 --- /dev/null +++ b/lib/sisu/v3dv/shared_images.rb @@ -0,0 +1,125 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997 - 2012, Ralph Amissah, All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.jus.uio.no/sisu/gpl.fsf/toc.html> +   <http://www.jus.uio.no/sisu/gpl.fsf/doc.html> +   <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.jus.uio.no/sisu/SiSU/download.html> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: common file for xml generation +=end +module SiSU_Images +  class Source +    def initialize(opt) +      @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) +    end +    def read +      SiSU_Images::Source::Place.new(@particulars).songsheet +    end +    class Place +      def initialize(particulars) +        @particulars=particulars +        @md=@particulars.md +        @env=@particulars.env +        @o_str ||=SiSU_Env::OutputStructure.new(@md).output_dir_structure +      end +      def songsheet +        images_set.select_sisu_base +        images_set.select_with_document +      end +      def images_set +        @pwd=ENV['PWD'] +        def copy(src_path,dest_path,images=nil) +        if FileTest.directory?(src_path) +          FileUtils::cd(src_path) +          unless images +            images=Dir.glob("*.{png,jpg,gif,ico}") +          end +          FileUtils::mkdir_p(dest_path) unless FileTest.directory?(dest_path) +          FileUtils::chmod(0755,dest_path) +          if images.length > 0 +            images.each do |i| +              FileUtils::cp_r(i,"#{dest_path}/#{i}") +              FileUtils::chmod(0644,"#{dest_path}/#{i}") +            end +          end +          FileUtils::cd(@pwd) +        else puts "\tWARN, did not find - #{src_path}" +        end +        end +        def dest_path(image_type) +          pth=if image_type==:image_sys +            pth=(@o_str.dump_or_redirect?) \ +            ? "#{@md.file.output_path.html.dir}/image" \ +            : "#{@env.path.webserv}/_sisu/image_sys" +          elsif image_type==:image +            pth=(@o_str.dump_or_redirect?) \ +            ? "#{@md.file.output_path.html.dir}/image" \ +            : "#{@env.path.webserv}/_sisu/image" +          end +        end +        def select_with_document +          images=@md.ec[:image] +          src_path="#{@pwd}/_sisu/image" +          dest=dest_path(:image) +          copy(src_path,dest,images) +        end +        def select_sisu_base +          images=%w[arrow_next_red.png arrow_prev_red.png arrow_up_red.png dot_clear.png dot_white.png b_doc.png b_epub.png b_odf.png b_pdf.png b_toc.png] +          src_path="#{@env.path.share}/image" +          dest=dest_path(:image_sys) +          copy(src_path,dest,images) +        end +        self +      end +    end +  end +end +__END__ diff --git a/lib/sisu/v3dv/sisupod_make.rb b/lib/sisu/v3dv/sisupod_make.rb index 4b1a5ef9..ac584925 100644 --- a/lib/sisu/v3dv/sisupod_make.rb +++ b/lib/sisu/v3dv/sisupod_make.rb @@ -293,7 +293,7 @@ module SiSU_Doc            tar -cJf #{@zipfile}.txz sisupod            #echo "#{@file.place_file.sisupod.dir}"          }) -        FileUtils::mv("#{@zipfile}.txz", @file.place_file.sisupod.dir) +        FileUtils::mv("#{@zipfile}.txz",@file.place_file.sisupod.dir)          FileUtils::rm_r(Dir.glob("sisupod/*"))          Dir.chdir(@env.path.pwd)          SiSU_Screen::Ansi.new('',"#{@opt.fns}.txz").blue_tab unless @opt.cmd =~/q/ diff --git a/lib/sisu/v3dv/sysenv.rb b/lib/sisu/v3dv/sysenv.rb index 7374d88f..b305dfb7 100644 --- a/lib/sisu/v3dv/sysenv.rb +++ b/lib/sisu/v3dv/sysenv.rb @@ -408,7 +408,15 @@ module SiSU_Env        def by?          output_structure=:filename #set default output structure          output_structure=if defined? @rc['output_dir_structure_by'] -          output_structure=if (@rc['output_dir_structure_by'] =~/language/) \ +          output_structure=if (@rc['output_dir_structure_by'] =~/dump/) \ +          or ((defined? @rc['output_structure']['dump']) \ +          && @rc['output_structure']['dump'] ==true) +            :dump +          elsif (@rc['output_dir_structure_by'] =~/redirect/) \ +          or ((defined? @rc['output_structure']['redirect']) \ +          && @rc['output_structure']['redirect'] ==true) +            :redirect +          elsif (@rc['output_dir_structure_by'] =~/language/) \            or ((defined? @rc['output_structure']['by_language']) \            && @rc['output_structure']['by_language'] ==true)              :language @@ -420,9 +428,21 @@ module SiSU_Env            or ((defined? @rc['output_structure']['by_filename']) \            && @rc['output_structure']['by_filename'] ==true)              :filename +          else #recheck current default +            :language            end          end        end +      def dump? +        ((by?) ==:dump) \ +        ? true \ +        : false +      end +      def redirect? +        ((by?) ==:redirect) \ +        ? true \ +        : false +      end        def by_language_code?          ((by?) ==:language) \          ? true \ @@ -1568,7 +1588,12 @@ WOK          end        end        def default_output_css -        if @env.output_dir_structure.by_language_code? +        if (@md.opt.opt_act[:dump][:bool] \ +        &&  @md.opt.opt_act[:dump][:inst]) \ +        || (@md.opt.opt_act[:redirect][:bool] \ +        &&  @md.opt.opt_act[:redirect][:inst]) +          './' +        elsif @env.output_dir_structure.by_language_code?            '../../'          elsif @env.output_dir_structure.by_filetype?            '../' @@ -1664,7 +1689,14 @@ WOK          defaults[:sisu_share]        end        def style -        defaults[:stylesheet_stub] +        if (@md.opt.opt_act[:dump][:bool] \ +        &&  @md.opt.opt_act[:dump][:inst]) \ +        || (@md.opt.opt_act[:redirect][:bool] \ +        &&  @md.opt.opt_act[:redirect][:inst]) +          'css' +        else +         defaults[:stylesheet_stub] +        end        end        def sample_data                                                          #sample data repository source directory          defaults[:sample_data_path] @@ -3312,14 +3344,10 @@ WOK        end      end    end -  class FileOp <InfoFile                                                    #todo unify with CreateFile -    def initialize(md,fno='') -      begin -        @md,@fno=md,fno -        @env=SiSU_Env::InfoEnv.new(@md.fns) -      rescue; STDERR.puts SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue -      ensure -      end +  class OutputStructure +    def initialize(md) +      @md=md +      @env=SiSU_Env::InfoEnv.new(@md.fns)      end      def output_dir_structure        def by_language_code? @@ -3332,11 +3360,57 @@ WOK          @env.output_dir_structure.by_filename?        end        def multilingual? -        @env.output_dir_structure.by_language_code? -        #by_language_code? +        by_language_code? +      end +      def dump? +        ((@md.opt.opt_act[:dump][:bool] \ +        &&  @md.opt.opt_act[:dump][:inst]) \ +        || (@env.output_dir_structure.dump?)) \ +        ? true \ +        : false +      end +      def redirect? +        ((@md.opt.opt_act[:redirect][:bool] \ +        &&  @md.opt.opt_act[:redirect][:inst]) \ +        || (@env.output_dir_structure.redirect?)) \ +        ? true \ +        : false +      end +      def dump_or_redirect? +        ((dump?) || (redirect?)) \ +        ? true \ +        : false +      end +      def by? +        if dump? +          :dump +        elsif redirect? +          :redirect +        elsif by_language_code? +          :language +        elsif by_filetype? +          :filetype +        elsif by_filename? +          :filename +        else #recheck current default +          :language +        end        end        self      end +  end +  class FileOp <InfoFile                                                    #todo unify with CreateFile +    def initialize(md,fno='') +      begin +        @md,@fno=md,fno +        @env=SiSU_Env::InfoEnv.new(@md.fns) +      rescue; STDERR.puts SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue +      ensure +      end +    end +    def output_dir_structure +      OutputStructure.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}") @@ -3386,8 +3460,9 @@ WOK          @@filename_html_scroll=File.new(p_fn,'w+')        end        def html_seg_index -        pth=(by_filename?) \ -        ? "#{output_path.html.dir}" +        pth=((by_filename?) \ +          || (output_dir_structure.dump?)) \ +        ? "#{output_path.html.dir}" \          : "#{output_path.html.dir}/#{@md.fnb}"          fn=base_filename.html_seg_index          make_path(pth) @@ -3395,8 +3470,9 @@ WOK          @@filename_html_index=File.new(p_fn,'w+')        end        def html_segtoc -        pth=(by_filename?) \ -        ? "#{output_path.html.dir}" +        pth=((by_filename?) \ +          || (output_dir_structure.dump?)) \ +        ? "#{output_path.html.dir}" \          : "#{output_path.html.dir}/#{@md.fnb}"          fn=base_filename.html_segtoc          make_path(pth) @@ -3705,9 +3781,9 @@ WOK      def base_filename        def txt          ft='.txt' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + ft -        elsif @env.output_dir_structure.by_filetype? +        elsif output_dir_structure.by_filetype?            @md.fnb + @md.lang_code_insert + ft          else            'plain' + @md.lang_code_insert + ft @@ -3715,9 +3791,9 @@ WOK        end        def html_scroll          ft='.html' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + ft -        elsif @env.output_dir_structure.by_filetype? +        elsif output_dir_structure.by_filetype?            @md.fnb + @md.lang_code_insert + ft          else            'scroll' + @md.lang_code_insert + ft @@ -3725,7 +3801,7 @@ WOK        end        def html_seg_index          ft='.html' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            'index' + ft          else            'index' + @md.lang_code_insert + ft @@ -3733,7 +3809,9 @@ WOK        end        def html_segtoc          ft='.html' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.dump_or_redirect? +          @md.fnb + '.toc' + ft +        elsif output_dir_structure.by_language_code?            'toc' + ft          else            'toc' + @md.lang_code_insert + ft @@ -3741,7 +3819,7 @@ WOK        end        def html_book_index          ft='.html' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            'book_index' + ft          else            'book_index' + @md.lang_code_insert + ft @@ -3749,7 +3827,9 @@ WOK        end        def html_concordance          ft='.html' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.dump_or_redirect? +          @md.fnb + '.concordance' + ft +        elsif output_dir_structure.by_language_code?            'concordance' + ft          else            'concordance' + @md.lang_code_insert + ft @@ -3757,9 +3837,9 @@ WOK        end        def xhtml          ft= '.xhtml' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + ft -        elsif @env.output_dir_structure.by_filetype? +        elsif output_dir_structure.by_filetype?            @md.fnb + @md.lang_code_insert + ft          else            'scroll' + @md.lang_code_insert + ft @@ -3767,7 +3847,7 @@ WOK        end        def epub          ft='.epub' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + ft          else            @md.fnb + @md.lang_code_insert + ft @@ -3775,9 +3855,9 @@ WOK        end        def odt          ft='.odt' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + ft -        elsif @env.output_dir_structure.by_filetype? +        elsif output_dir_structure.by_filetype?            @md.fnb + @md.lang_code_insert + ft          else            'opendocument' + @md.lang_code_insert + ft @@ -3785,9 +3865,9 @@ WOK        end        def xml_sax          ft='.sax.xml' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + ft -        elsif @env.output_dir_structure.by_filetype? +        elsif output_dir_structure.by_filetype?            @md.fnb + @md.lang_code_insert + ft          else            'scroll' + @md.lang_code_insert + ft @@ -3795,22 +3875,22 @@ WOK        end        def xml_dom          ft='.dom.xml' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + ft -        elsif @env.output_dir_structure.by_filetype? +        elsif output_dir_structure.by_filetype?            @md.fnb + @md.lang_code_insert + ft          else            'scroll' + @md.lang_code_insert + ft          end        end        def pdf_p -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + '.portrait.'          else 'portrait' + @md.lang_code_insert + '.'          end        end        def pdf_l -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + '.landscape.'          else 'landscape' + @md.lang_code_insert + '.'          end @@ -3847,7 +3927,7 @@ WOK        end        def manpage          ft='1' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + '.' + ft          else            @md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft @@ -3855,7 +3935,7 @@ WOK        end        def info          ft='info' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + '.' + ft          else            @md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft @@ -3863,7 +3943,7 @@ WOK        end        def texinfo          ft='texinfo' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + '.' + ft          else            @md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft @@ -3871,9 +3951,9 @@ WOK        end        def hash_digest          ft='.txt' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + '.hash_digest' + ft -        elsif @env.output_dir_structure.by_filetype? +        elsif output_dir_structure.by_filetype?            @md.fnb + @md.lang_code_insert + ft          else            'digest' + @md.lang_code_insert + ft @@ -3881,9 +3961,9 @@ WOK        end        def sitemap          ft='.xml' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + '.sitemap' + ft -        elsif @env.output_dir_structure.by_filetype? +        elsif output_dir_structure.by_filetype?            @md.fnb + @md.lang_code_insert + ft          else            'sitemap' + @md.lang_code_insert + ft @@ -3891,9 +3971,9 @@ WOK        end        def qrcode_title          ft='.title.png' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + ft -        elsif @env.output_dir_structure.by_filetype? +        elsif output_dir_structure.by_filetype?            @md.fnb + @md.lang_code_insert + ft          else #fix            'sisu_manifest' + @md.lang_code_insert + ft @@ -3901,9 +3981,9 @@ WOK        end        def qrcode_md          ft='.md.png' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + ft -        elsif @env.output_dir_structure.by_filetype? +        elsif output_dir_structure.by_filetype?            @md.fnb + @md.lang_code_insert + ft          else #fix            'sisu_manifest' + @md.lang_code_insert + ft @@ -3911,9 +3991,9 @@ WOK        end        def manifest_txt          ft='.txt' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.by_language_code?            @md.fnb + ft -        elsif @env.output_dir_structure.by_filetype? +        elsif output_dir_structure.by_filetype?            @md.fnb + @md.lang_code_insert + ft          else #fix            'sisu_manifest' + @md.lang_code_insert + ft @@ -3921,9 +4001,11 @@ WOK        end        def manifest          ft='.html' -        if @env.output_dir_structure.by_language_code? +        if output_dir_structure.dump_or_redirect? +          @md.fnb + '.manifest' + ft +        elsif output_dir_structure.by_language_code?            @md.fnb + ft -        elsif @env.output_dir_structure.by_filetype? +        elsif output_dir_structure.by_filetype?            @md.fnb + @md.lang_code_insert + ft          else #fix            'sisu_manifest' + @md.lang_code_insert + ft @@ -3953,52 +4035,70 @@ WOK        @ft=ft        def dir          def abc -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.redirect? +            "#{@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}" -          elsif @env.output_dir_structure.by_filetype? +          elsif output_dir_structure.by_filetype?              "#{output_path.base.dir}/#{@ft}"            else              "#{output_path.base.dir}/#{@md.fnb}"            end          end          def ab -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.redirect? +            "#{@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}"            else              "#{output_path.base.dir}/#{@ft}"            end          end          def ab_src -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.redirect? +            "#{@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}/#{@ft}/#{@md.opt.lng}"            else              "#{output_path.base.dir}/#{@ft}"            end          end          def ab_pod -          "#{output_path.base.dir}/#{@ft}" +          if output_dir_structure.redirect? +            "#{@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}" +          end          end          self        end        def url          def abc -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.by_language_code?              "#{output_path.base.url}/#{@md.opt.lng}/#{@ft}" -          elsif @env.output_dir_structure.by_filetype? +          elsif output_dir_structure.by_filetype?              "#{output_path.base.url}/#{@ft}"            else              "#{output_path.base.url}/#{@md.fnb}"            end          end          def ab -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.by_language_code?              "#{output_path.base.url}/#{@md.opt.lng}/#{@ft}"            else              "#{output_path.base.url}/#{@ft}"            end          end          def ab_src -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.by_language_code?              "#{output_path.base.url}/#{@ft}/#{@md.opt.lng}"            else              "#{output_path.base.url}/#{@ft}" @@ -4011,30 +4111,32 @@ WOK        end        def rel          def abc -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.by_language_code?              "#{@md.opt.lng}/#{@ft}" -          elsif @env.output_dir_structure.by_filetype? +          elsif output_dir_structure.by_filetype?              "#{@ft}"            else              "#{@md.fnb}"            end          end          def ab -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.by_language_code?              "#{@md.opt.lng}/#{@ft}"            else              "#{@ft}"            end          end          def ab_src -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.dump_or_redirect? +            "." +          elsif output_dir_structure.by_language_code?              "#{@ft}/#{@md.opt.lng}"            else              "#{@ft}"            end          end          def ab_pod -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.by_language_code?              "#{@ft}"            else              "#{@ft}" @@ -4044,30 +4146,36 @@ WOK        end        def rel_sm          def abc -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.by_language_code?              "#{@md.opt.lng}/#{@ft}" -          elsif @env.output_dir_structure.by_filetype? +          elsif output_dir_structure.by_filetype?              "#{@ft}"            else              "#{@md.fnb}"            end          end          def ab -          if @env.output_dir_structure.by_language_code? -            "#{@md.opt.lng}/#{@ft}" -          else -            "#{@ft}" +          if output_dir_structure.dump_or_redirect? +            '.' +          elsif output_dir_structure.by_language_code? \ +          or output_dir_structure.by_filetype? +            '../' + @ft +          else '.'            end          end          def ab_src -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.dump_or_redirect? +            '.' +          elsif output_dir_structure.by_language_code?              "#{@ft}/#{@md.opt.lng}"            else              "#{@ft}"            end          end          def ab_pod -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.dump_or_redirect? +            '.' +          elsif output_dir_structure.by_language_code?              "../../#{@ft}/#{@md.opt.lng}"            else              "../#{@ft}" @@ -4077,16 +4185,16 @@ WOK        end        def rcp          def abc -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.by_language_code?              "#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}" -          elsif @env.output_dir_structure.by_filetype? +          elsif output_dir_structure.by_filetype?              "#{output_path.stub.rcp}/#{@ft}"            else              "#{output_path.stub.rcp}/#{@md.fnb}"            end          end          def ab -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.by_language_code?              "#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}"            else              "#{output_path.stub.rcp}/#{@ft}" @@ -4094,16 +4202,6 @@ WOK          end          self        end -      def rel_sm -        def ab -          if @env.output_dir_structure.by_language_code? \ -          or @env.output_dir_structure.by_filetype? -            '../' + @ft -          else '.' -          end -        end -        self -      end        self      end      def output_path @@ -4137,9 +4235,18 @@ WOK          end          self        end +      def webserver_path +        if output_dir_structure.dump? +          @md.opt.opt_act[:dump][:inst] +        elsif output_dir_structure.redirect? +          @md.opt.opt_act[:redirect][:inst] +        else +          "#{@env.path.webserv}" +        end +      end        def base          def dir -          "#{@env.path.webserv}/#{@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]}" @@ -4299,9 +4406,11 @@ WOK            set_path(ft).rel_sm.ab          end          def rel_image -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.dump_or_redirect? +            './image' +          elsif output_dir_structure.by_language_code?              '../../_sisu/image' -          elsif @env.output_dir_structure.by_filetype? +          elsif output_dir_structure.by_filetype?              '../_sisu/image'            else              '../_sisu/image' @@ -4329,9 +4438,11 @@ WOK            set_path(ft).rel_sm.ab          end          def rel_image -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.dump_or_redirect? +            './image' +          elsif output_dir_structure.by_language_code?              '../../../_sisu/image' -          elsif @env.output_dir_structure.by_filetype? +          elsif output_dir_structure.by_filetype?              '../../_sisu/image'            else              '../_sisu/image' @@ -4363,9 +4474,9 @@ WOK            set_path(ft).rel_sm.ab          end          def rel_image -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.by_language_code?              '../../_sisu/image' -          elsif @env.output_dir_structure.by_filetype? +          elsif output_dir_structure.by_filetype?              '../_sisu/image'            else              '../_sisu/image' @@ -4550,6 +4661,9 @@ WOK          def rcp            set_path(ft).rcp.abc          end +        def rel_sm +          set_path(ft).rel_sm.ab +        end          self        end        def harvest @@ -4569,9 +4683,9 @@ WOK            set_path(ft).rcp.ab          end          def rel_sm -          if @env.output_dir_structure.by_language_code? +          if output_dir_structure.by_language_code?              '' -          elsif @env.output_dir_structure.by_filetype? +          elsif output_dir_structure.by_filetype?              ''            else              '' @@ -5031,7 +5145,7 @@ WOK    class CSS_Select < InfoEnv      def initialize(md)        @md=md -      @env=SiSU_Env::InfoEnv.new +      @env=SiSU_Env::InfoEnv.new('',@md)      end      def html        css=if @md.doc_css \ @@ -5101,7 +5215,7 @@ WOK      def initialize(md)        @md=md        @css=SiSU_Env::CSS_Select.new(@md) -      @env=SiSU_Env::InfoEnv.new +      @env=SiSU_Env::InfoEnv.new('',@md)        @file=SiSU_Env::FileOp.new(@md)      end      def html @@ -5189,7 +5303,7 @@ WOK      def cp_external_images        src="#{@env.processing_path.processing}/external_document/image"        dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" -      if FileTest.directory?(src)  +      if FileTest.directory?(src)          cp_images(src,dest)        end      end diff --git a/lib/sisu/v3dv/xhtml.rb b/lib/sisu/v3dv/xhtml.rb index 5d17128c..c537275c 100644 --- a/lib/sisu/v3dv/xhtml.rb +++ b/lib/sisu/v3dv/xhtml.rb @@ -359,11 +359,11 @@ WOK          rdf=SiSU_XML_Tags::RDF.new(@md)          dir=SiSU_Env::InfoEnv.new          @@xml[:head],@@xml[:body]=[],[] -        css=SiSU_Env::CSS_Stylesheet.new(@md) +        stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xhtml').stylesheet          encoding=(@sys.locale =~/utf-?8/i) ? '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' : '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'          @@xml[:open] =<<WOK  #{encoding} -#{css.xhtml} +#{stylesheet.css_head_xml}  #{rdf.comment_xml}  <document>  WOK diff --git a/lib/sisu/v3dv/xml.rb b/lib/sisu/v3dv/xml.rb index 1187e02e..aa75e139 100644 --- a/lib/sisu/v3dv/xml.rb +++ b/lib/sisu/v3dv/xml.rb @@ -396,13 +396,13 @@ WOK          rdf=SiSU_XML_Tags::RDF.new(@md)          dir=SiSU_Env::InfoEnv.new          @@xml[:head],@@xml[:body]=[],[] -        css=SiSU_Env::CSS_Stylesheet.new(@md) +        stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xml_sax').stylesheet          encoding=if @sys.locale =~/utf-?8/i; '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'          else                                 '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'          end          @@xml[:open] =<<WOK  #{encoding} -#{css.xml_sax} +#{stylesheet.css_head_xml}  #{rdf.comment_xml}  <document>  WOK diff --git a/lib/sisu/v3dv/xml_dom.rb b/lib/sisu/v3dv/xml_dom.rb index e63f7ad7..6b8c4e5c 100644 --- a/lib/sisu/v3dv/xml_dom.rb +++ b/lib/sisu/v3dv/xml_dom.rb @@ -470,13 +470,13 @@ WOK        def pre          rdf=SiSU_XML_Tags::RDF.new(@md)          dir=SiSU_Env::InfoEnv.new -        css=SiSU_Env::CSS_Stylesheet.new(@md) +        stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xml_dom').stylesheet          encoding=if @sys.locale =~/utf-?8/i; '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'          else                                 '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'          end          @@xml[:open] =<<WOK  #{encoding} -#{css.xml_dom} +#{stylesheet.css_head_xml}  #{rdf.comment_xml}  <document>  WOK diff --git a/lib/sisu/v3dv/xml_format.rb b/lib/sisu/v3dv/xml_format.rb index 50a9f5ac..0b1e9eef 100644 --- a/lib/sisu/v3dv/xml_format.rb +++ b/lib/sisu/v3dv/xml_format.rb @@ -374,7 +374,7 @@ WOK        @rdf=SiSU_XML_Tags::RDF.new(md)        # DublinCore 1 - title        @vz=SiSU_Env::GetInit.instance.skin -      @css=SiSU_Env::CSS_Stylesheet.new(md) +      @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet        @seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || [])        @seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || [])        @index='index' @@ -544,7 +544,7 @@ WOK  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />  #{@rdf.rdftoc}  #{@rdf.metatag_html} -#{@css.html} +#{@stylesheet.css_head}  </head>  #{@vz.color_body}  <a name="top" id="top"></a> @@ -938,7 +938,7 @@ WOK  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />  #{@rdf.rdfseg}  #{@rdf.metatag_html} -#{@css.html} +#{@stylesheet.css_head}  </head>  #{@vz.color_body}  <a name="top" id="top"></a> | 
