aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2011-02-15 13:19:16 -0500
committerRalph Amissah <ralph@amissah.com>2011-02-15 13:26:03 -0500
commit3a263de6877c27071c2a6f3389b6eaf5c2455ede (patch)
treeaa2531d8c62acbf6af6ac56405f174b7c570033e /lib
parentconsole feedback on selected files being processed, updates & fixes (diff)
sysenv, sisurc.yml & elsewhere as affected, output_dir_structure (conf & tests)
* (by_language_code; by_filetype; by_filename)
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v3/git.rb2
-rw-r--r--lib/sisu/v3/html.rb4
-rw-r--r--lib/sisu/v3/html_format.rb12
-rw-r--r--lib/sisu/v3/manifest.rb4
-rw-r--r--lib/sisu/v3/sysenv.rb185
-rw-r--r--lib/sisu/v3/texpdf.rb12
6 files changed, 126 insertions, 93 deletions
diff --git a/lib/sisu/v3/git.rb b/lib/sisu/v3/git.rb
index 00cd1e67..b14645c9 100644
--- a/lib/sisu/v3/git.rb
+++ b/lib/sisu/v3/git.rb
@@ -71,7 +71,7 @@ module SiSU_Git
unless @md.i18n[0]==l[:c]
p "using: #{@md.i18n[0]} (@make: :language:); filename #{@md.fns} filename language: #{l[:c]}, mismatch"
end
- if @env.multilingual?
+ if @env.output_dir_structure.multilingual?
m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst|ssm)$/ #watch added match for sss
fnn,fnb,fnt=@opt.fns[m,1],@opt.fns[m,2],@opt.fns[m,3]
else m=/(.+?)\.((?:-|ssm\.)?sst|ssm)$/
diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v3/html.rb
index 4fc657e8..bad68cde 100644
--- a/lib/sisu/v3/html.rb
+++ b/lib/sisu/v3/html.rb
@@ -421,8 +421,8 @@ WOK
p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn
@file=SiSU_Env::SiSU_file.new(@md) if @md
txt_obj=if seg_link=~/sisu_manifest\.html/
- man_link=if @file.by_language? \
- or @file.by_filetype?
+ man_link=if @file.output_dir_structure.by_language_code? \
+ or @file.output_dir_structure.by_filetype?
seg_link.gsub(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}")
else seg_link
end
diff --git a/lib/sisu/v3/html_format.rb b/lib/sisu/v3/html_format.rb
index 15345ca0..76805234 100644
--- a/lib/sisu/v3/html_format.rb
+++ b/lib/sisu/v3/html_format.rb
@@ -187,8 +187,8 @@ module SiSU_HTML_Format
env.widget.search_form('sisusearch',nil,nil,true)
end
def manifest
- manifest_lnk=if @file.by_language? \
- or @file.by_filetype?
+ 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
@@ -651,8 +651,8 @@ WOK
nxt="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}"
if nxt=~/sisu_manifest\.html/
@file=SiSU_Env::SiSU_file.new(@md) if @md
- if @file.by_language? \
- or @file.by_filetype?
+ if @file.output_dir_structure.by_language_code? \
+ or @file.output_dir_structure.by_filetype?
nxt.gsub!(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}")
end
end
@@ -713,8 +713,8 @@ WOK
</td>} if f_nxt==true
if nxt =~/sisu_manifest.html/
@file=SiSU_Env::SiSU_file.new(@md) if @md
- if @file.by_language? \
- or @file.by_filetype?
+ if @file.output_dir_structure.by_language_code? \
+ or @file.output_dir_structure.by_filetype?
nxt.gsub!(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}")
end
end
diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb
index e7fbcfa9..58b78c76 100644
--- a/lib/sisu/v3/manifest.rb
+++ b/lib/sisu/v3/manifest.rb
@@ -646,8 +646,8 @@ SiSU manifest: #{@md.title.full}
#{banner_table}
WOK
if @env.manifest_minitoc?
- if @env.by_language? \
- or @env.by_filetype?
+ if @env.output_dir_structure.by_language_code? \
+ or @env.output_dir_structure.by_filetype?
minitoc.gsub!(/<a href="(\S+?)"/m,%{<a href="../html/#{@md.fnb}/\\1"})
minitoc.gsub!(/<a href="\.\.\/html\/#{@md.fnb}\/(?:sisu_manifest\.html|#{@md.file.base_filename.manifest})"/m,
%{<a href="#{@md.file.base_filename.manifest}"})
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index ff10849c..c3d16778 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -399,30 +399,56 @@ module SiSU_Env
end
@fnn,@fnb,@fnt,@flv,@fnz=@@fnn,@@fnb,@@fnt,@@flv,@@fnz
end
- def by_language?
- x=(defined? @rc['output_structure']['by_language'] \
- && @rc['output_structure']['by_language'] ==true) \
- ? @rc['output_structure']['by_language'] \
- : false
- end
- def by_filetype?
- x=if by_language?
- true
- else
- x=(defined? @rc['output_structure']['by_filetype'] \
- && @rc['output_structure']['by_filetype'] ==true) \
- ? @rc['output_structure']['by_filetype'] \
- : false
+ def output_dir_structure
+ def by_language_code?
+ x=if defined? @rc['output_dir_structure_by'] \
+ and @rc['output_dir_structure_by'] =~/language/
+ true
+ else defined? @rc['output_structure']['by_language']
+ (defined? @rc['output_structure']['by_language'] \
+ && @rc['output_structure']['by_language'] ==true) \
+ ? true \
+ : false
+ end
end
- end
- def multilingual?
- by_language?
+ def by_filetype?
+ x=if by_language_code?
+ false
+ elsif defined? @rc['output_dir_structure_by'] \
+ and @rc['output_dir_structure_by'] =~/filetype/
+ true
+ else
+ x=(defined? @rc['output_structure']['by_filetype'] \
+ && @rc['output_structure']['by_filetype'] ==true) \
+ ? true \
+ : false
+ end
+ end
+ def by_filename?
+ x=if by_language_code?
+ false
+ elsif by_filetype?
+ false
+ elsif defined? @rc['output_dir_structure_by'] \
+ and @rc['output_dir_structure_by'] =~/filename/
+ true
+ elsif defined? @rc['output_structure']['by_filename'] \
+ and @rc['output_structure']['by_filename'] ==true
+ true
+ else
+ true
+ end
+ end
+ def multilingual?
+ by_language_code?
+ end
+ self
end
def document_language_versions_found
@fn={}
unless (@fns.nil? \
or @fns.empty?)
- if multilingual?
+ if output_dir_structure.by_language_code?
m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/
@fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3]
else m=/(.+?)\.((?:-|ssm\.)?sst$)/
@@ -453,7 +479,7 @@ module SiSU_Env
@m=[]
unless (@fns.nil? \
or @fns.empty?)
- if multilingual?
+ if output_dir_structure.by_language_code?
m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/
@fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3]
else m=/(.+?)\.((?:-|ssm\.)?sst$)/
@@ -1909,7 +1935,7 @@ WOK
else %{(SiSU (generated sample) search form}
end
end
- def output_tell
+ 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)/
@rc['show_output_on']
@@ -2136,7 +2162,7 @@ WOK
#end
def lang_filename(l)
@lang={}
- x=if multilingual?
+ x=if output_dir_structure.by_language_code?
(( defined? @rc['default']['language_file']) \
&& @rc['default']['language_file'] != nil) \
? @rc['default']['language_file'] \
@@ -2270,7 +2296,7 @@ WOK
ft=[]
if @md \
and defined? @md.fn \
- and @md.fn # used for multilingual?
+ and @md.fn # used for by_language_code?
if @md.cmd =~ /[hH]/
ft << @md.fn[:html]
end
@@ -2850,63 +2876,63 @@ WOK
end
def path_rel_links
def html_scroll_2
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
'../../'
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
'../'
else
'../'
end
end
def html_seg_2
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
'../../../'
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
'../../'
else
'../../'
end
end
def html_scroll_1
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
'../'
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
'../'
else
'/'
end
end
def html_seg_1
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
'../../'
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
'../../'
else
'/'
end
end
def html_scroll_css
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
'../../'
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
'../'
else
'../'
end
end
def html_seg_css
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
'../../../'
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
'../../'
else
'../'
end
end
def manifest_css
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
'../../_sisu/css'
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
''
else
'../'
@@ -2935,14 +2961,21 @@ WOK
ensure
end
end
- def by_language?
- @env.by_language?
- end
- def by_filetype?
- @env.by_filetype?
- end
- def multilingual?
- by_language?
+ def output_dir_structure
+ def by_language_code?
+ @env.output_dir_structure.by_language_code?
+ end
+ def by_filetype?
+ @env.output_dir_structure.by_filetype?
+ end
+ def by_filename?
+ @env.output_dir_structure.by_filename?
+ end
+ def multilingual?
+ @env.output_dir_structure.by_language_code?
+ #by_language_code?
+ end
+ self
end
def mkdir_initialize # not used but consider using
mkdir_p(output_path.base) unless FileTest.directory?(output_path.base)
@@ -3122,9 +3155,9 @@ WOK
end
def base_filename
def txt
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
@md.fnb + '.txt'
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
@md.fnb + @md.fn[:plain]
else
'plain' + @md.fn[:plain]
@@ -3132,9 +3165,9 @@ WOK
end
def html_scroll
#"#{@md.fnl[:pre]}scroll#{@md.fnl[:mid]}.html#{@md.fnl[:post]}"
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
@md.fnb + '.html'
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
@md.fnb + @md.fn[:html]
else
'scroll' + @md.fn[:html]
@@ -3142,7 +3175,7 @@ WOK
end
def html_seg_index
#"#{@md.fnl[:pre]}index#{@md.fnl[:mid]}.html#{@md.fnl[:post]}"
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
'toc.html'
else
'index' + @md.fn[:html]
@@ -3150,37 +3183,37 @@ WOK
end
def html_segtoc
#"#{@md.fnl[:pre]}toc#{@md.fnl[:mid]}.html#{@md.fnl[:post]}"
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
'toc.html'
else
'toc' + @md.fn[:html]
end
end
def html_book_index
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
'book_index.html'
else
'book_index.' + @md.fn[:html]
end
end
def html_concordance
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
'concordance.html'
else
'concordance' + @md.fn[:html]
end
end
def xhtml
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
@md.fnb + '.xhtml'
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
@md.fnb + '.' + @md.fn[:xhtml]
else
'scroll.' + @md.fn[:xhtml]
end
end
def epub
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
@md.fnb + '.epub'
else
@md.fnb + @md.fn[:epub]
@@ -3188,42 +3221,42 @@ WOK
end
def odt
#"#{@md.fnl[:pre]}#{@md.fnb}#{@md.fnl[:mid]}.odt#{@md.fnl[:post]}"
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
@md.fnb + '.odt'
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
@md.fnb + @md.fn[:odf]
else
'opendocument' + @md.fn[:odf]
end
end
def xml_sax
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
@md.fnb + '.sax.xml'
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
@md.fnb + '.' + @md.fn[:sax]
else
'scroll.' + @md.fn[:sax]
end
end
def xml_dom
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
@md.fnb + '.dom.xml'
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
@md.fnb + '.' + @md.fn[:dom]
else
'scroll.' + @md.fn[:dom]
end
end
def pdf_p
- if @env.multilingual? \
- or @env.by_filetype?
+ if @env.output_dir_structure.by_language_code? \
+ or @env.output_dir_structure.by_filetype?
@md.fnb + '.portrait.'
else 'portrait.'
end
end
def pdf_l
- if @env.multilingual? \
- or @env.by_filetype?
+ if @env.output_dir_structure.by_language_code? \
+ or @env.output_dir_structure.by_filetype?
@md.fnb + '.landscape.'
else 'landscape.'
end
@@ -3259,34 +3292,34 @@ WOK
pdf_l + @md.fn[:pdf_l_legal]
end
def manpage
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
@md.fnb + '.1'
else
@md.fnb + '.' + @md.fn[:manpage]
end
end
def hash_digest
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
@md.fnb + '.hash_digest.txt'
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
@md.fnb + '.' + @md.fn[:digest]
else
'digest.' + @md.fn[:digest]
end
end
def sitemap
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
@md.fnb + '.sitemap.xml'
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
@md.fnb + '.' + @md.fn[:sitemap]
else
'sitemap.' + @md.fn[:sitemap]
end
end
def manifest
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
@md.fnb + '.manifest.html'
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
@md.fnb + '.' + @md.fn[:manifest]
else
'sisu_' + @md.fn[:manifest]
@@ -3319,23 +3352,23 @@ WOK
: @md.i18n[0]
end
def set_path_abc(ft)
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
"#{output_path.base}/#{lang_part}/#{ft}"
- elsif @env.by_filetype?
+ elsif @env.output_dir_structure.by_filetype?
"#{output_path.base}/#{ft}"
else
"#{output_path.base}/#{@md.fnb}"
end
end
def set_path_ab(ft)
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
"#{output_path.base}/#{lang_part}/#{ft}"
else
"#{output_path.base}/#{ft}"
end
end
def set_path_ab_src(ft)
- if @env.multilingual?
+ if @env.output_dir_structure.by_language_code?
"#{output_path.base}/#{ft}/#{lang_part}"
else
"#{output_path.base}/#{ft}"
diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb
index df03647c..e0646603 100644
--- a/lib/sisu/v3/texpdf.rb
+++ b/lib/sisu/v3/texpdf.rb
@@ -110,9 +110,9 @@ module SiSU_TeX
SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{@md.file.output_path.pdf}/#{@md.file.base_filename.pdf_p}pdf").flow
end
@md=@particulars.md
- $flag=@md.cmd #introduced to pass 0 for no object citation numbers... to texpdf_format
+ $flag=@md.cmd #introduced to pass 0 for no object citation numbers... to texpdf_format
directories
- #% needed needs to be reprogrammed !!!
+ #% needed needs to be reprogrammed !!!
SiSU_Env::Info_skin.new(@md).select
dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
SiSU_TeX::Source::LaTeX_create.new(@particulars).songsheet
@@ -231,8 +231,8 @@ module SiSU_TeX
else pdf_p=@md.file.base_filename.pdf_p_a4; pdf_l=@md.file.base_filename.pdf_l_a4
end
if FileTest.file?("#{@md.file.output_path.pdf}/#{pdf_p}")
- mklnk=if @md.file.by_language? \
- or @md.file.by_filetype?
+ mklnk=if @md.file.output_dir_structure.by_language_code? \
+ or @md.file.output_dir_structure.by_filetype?
"#{@md.fnb}.portrait.pdf"
else 'portrait.pdf'
end
@@ -243,8 +243,8 @@ module SiSU_TeX
")
end
if FileTest.file?("#{@md.file.output_path.pdf}/#{pdf_l}")
- mklnk=if @md.file.by_language? \
- or @md.file.by_filetype?
+ mklnk=if @md.file.output_dir_structure.by_language_code? \
+ or @md.file.output_dir_structure.by_filetype?
"#{@md.fnb}.landscape.pdf"
else 'landscape.pdf'
end