aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/param.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2011-04-19 21:37:52 -0400
committerRalph Amissah <ralph@amissah.com>2011-04-19 21:37:52 -0400
commit44464e284ee840ee0ef7eae2d3f8d589680b18ca (patch)
tree7967e499e253737a4d8573e9c903ee714be1e762 /lib/sisu/v3/param.rb
parentv3: options, hub, introduce opt.act booleans, more setting in options (diff)
v3: param, md remove md.cmd and md.mod shortcut methods, use use md.opt
* affects many files that now use @md.opt.cmd & @md.opt.mod (instead of @md.cmd & @md.mod)
Diffstat (limited to 'lib/sisu/v3/param.rb')
-rw-r--r--lib/sisu/v3/param.rb52
1 files changed, 26 insertions, 26 deletions
diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb
index 9a11da8c..c2968564 100644
--- a/lib/sisu/v3/param.rb
+++ b/lib/sisu/v3/param.rb
@@ -101,7 +101,7 @@ module SiSU_Param
@@md=nil
end
if @@md.nil? \
- or @cmd =~/M/ #not particularly helpful, as current cycle is through output types, with files changing, only helpful if deal with a file all output types before going to next file
+ or @opt.cmd =~/M/ #not particularly helpful, as current cycle is through output types, with files changing, only helpful if deal with a file all output types before going to next file
if File.exist?(@pstorefile)
param_msg='Parameters from pstore'
store=PStore.new(@pstorefile)
@@ -117,12 +117,12 @@ module SiSU_Param
@md
end
if defined? @md.title.main # on removal check problems with -U
- SiSU_Screen::Ansi.new(@cmd,param_msg,@md.title.main).txt_grey if @cmd =~/[MVv]/
+ SiSU_Screen::Ansi.new(@opt.cmd,param_msg,@md.title.main).txt_grey if @opt.cmd =~/[MVv]/
end
@@md=@md
else @@md
end
- @@md.cmd=@cmd
+ @@md.opt=@opt
@@md
end
class Md_default
@@ -400,7 +400,7 @@ module SiSU_Param
elsif @h['main']
@h['main']
else
- SiSU_Screen::Ansi.new(@cmd,'WARNING Document Copyright missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/
+ SiSU_Screen::Ansi.new(@opt.cmd,'WARNING Document Copyright missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/
''
end
l,n=Db[:col_info_note],'rights.copyright.text'
@@ -487,7 +487,7 @@ module SiSU_Param
s +='<br> License: ' + copyright.license
end
if s.empty?
- SiSU_Screen::Ansi.new(@cmd,'WARNING Document Rights information missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/
+ SiSU_Screen::Ansi.new(@opt.cmd,'WARNING Document Rights information missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/
else
l,n=Db[:col_info_note],'rights.all'
validate_length(s,l,n)
@@ -828,10 +828,10 @@ module SiSU_Param
@doc={ lv: [] }
@doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','',''
@@publisher='SiSU scribe'
- attr_accessor :cmd,:make,:mod,:env,:path,:file,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:markup_version,:markup_declared,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:en,:notes,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy
+ attr_accessor :make,:env,:path,:file,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:markup_version,:markup_declared,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:en,:notes,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy
def initialize(fns_array,opt)
@env=@path,@file=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@links=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@filesize=@firstseg=@programs=@author_copymark=@i18n=@lang=@en=@notes=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=nil
- @data,@path,@fns,@cmd,@mod,@opt=fns_array,opt.pth,opt.fns,opt.cmd,opt.mod,opt #@data used as data
+ @data,@path,@fns,@opt=fns_array,opt.pth,opt.fns,opt #@data used as data
@flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_idx=false,false,false,false,false,false,false
@seg_autoname_safe=true
@daisy,@sem_tag=false,false
@@ -845,7 +845,7 @@ module SiSU_Param
@rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/
@rgx_mm=/\{\s*(\S+?\.(?:ogg|mpeg))/ #expand and distinguish ogg
begin
- rescue; SiSU_Errors::Info_error.new($!,$@,@cmd,@fns).error
+ rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@fns).error
ensure
end
end
@@ -882,7 +882,7 @@ module SiSU_Param
end
@concord_make=(@wc_words > @env.concord_max) ? false : true
@locale=@sys.locale
- @file_encoding=@sys.file_encoding(fns,@cmd)
+ @file_encoding=@sys.file_encoding(fns,@opt.cmd)
# programs set here for things that affect output appearance only
@programs[:pdf]=SiSU_Env::System_call.new.program_found?('pdflatex')
if @opt.cmd =~/P/ #if @env.multilingual?
@@ -925,11 +925,11 @@ module SiSU_Param
@markup_version_declared=fns_array[0].match(/^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)([\d.]+)$/)[1]
sm_a,sm_b,sm_c=fns_array[0].match(/^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?$/)[1..3]
sm_c ||=0
- sv=(@cmd =~/[VMv]/) ? ("SiSU version (#{@sisu_version[:version]})") : ''
+ sv=(@opt.cmd =~/[VMv]/) ? ("SiSU version (#{@sisu_version[:version]})") : ''
s_a,s_b,s_c=@sisu_version[:version].match(/^([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\-\S+)?$/)[1..3]
tell=(@markup_version_declared.to_f==@markup_version.determined) \
- ? SiSU_Screen::Ansi.new(@cmd,"Markup version (#{@markup_version.series} version #{@markup_version.determined})",sv) \
- : SiSU_Screen::Ansi.new(@cmd,"Markup version declared (#{@markup_version_declared}), determined (#{@markup_version.series} version #{@markup_version.determined})",sv)
+ ? SiSU_Screen::Ansi.new(@opt.cmd,"Markup version (#{@markup_version.series} version #{@markup_version.determined})",sv) \
+ : SiSU_Screen::Ansi.new(@opt.cmd,"Markup version declared (#{@markup_version_declared}), determined (#{@markup_version.series} version #{@markup_version.determined})",sv)
ok=if s_a.to_i > sm_a.to_i
true
elsif s_a.to_i == sm_a.to_i \
@@ -942,12 +942,12 @@ module SiSU_Param
else false
end
if ok
- tell.txt_green if @cmd =~/[vVM]/
+ tell.txt_green if @opt.cmd =~/[vVM]/
else
- SiSU_Screen::Ansi.new(@cmd,"Warning: markup version determined (#{@markup_version.determined}) or markup version declared (#{@markup_version_declared}) is newer than SiSU version (#{@sisu_version[:version]})").warn unless @cmd =~/q/
+ SiSU_Screen::Ansi.new(@opt.cmd,"Warning: markup version determined (#{@markup_version.determined}) or markup version declared (#{@markup_version_declared}) is newer than SiSU version (#{@sisu_version[:version]})").warn unless @opt.cmd =~/q/
end
else
- SiSU_Screen::Ansi.new(@cmd,'No SiSU markup version provided').warn if @cmd =~/[VM]/
+ SiSU_Screen::Ansi.new(@opt.cmd,'No SiSU markup version provided').warn if @opt.cmd =~/[VM]/
end
else
mv=if defined? @markup_version.determined and not @markup_version.determined.nil?
@@ -955,7 +955,7 @@ module SiSU_Param
"markup version determined #{x}"
else ''
end
- SiSU_Screen::Ansi.new(@cmd,'SiSU filetype indicator not provided',mv).warn unless @cmd =~/q/
+ SiSU_Screen::Ansi.new(@opt.cmd,'SiSU filetype indicator not provided',mv).warn unless @opt.cmd =~/q/
end
@code_flag=false
fns_array.each do |para| #% scan document
@@ -1076,7 +1076,7 @@ module SiSU_Param
@title=Md.new(tf.strip,@opt,@env).title
end
@html_title=@title.full.gsub(/(<p>|<p \/>|<br>|<br \/>)/,'')
- SiSU_Screen::Ansi.new(@cmd,'Parameters',@html_title).txt_grey if @cmd =~/v/
+ SiSU_Screen::Ansi.new(@opt.cmd,'Parameters',@html_title).txt_grey if @opt.cmd =~/v/
end
if not @book_idx \
and para =~/^=\{(.+?)\}\s*$/
@@ -1205,9 +1205,9 @@ module SiSU_Param
@markup.gsub!(/num_top\s*=\s*([\dA-C])/,"num_top=#{@num_top}")
@markup.gsub!(/toc_lev_limit\s*=\s*([\dA-C])/,"toc_lev_limit=#{@toc_lev_limit}")
end
- if @mod.inspect =~/--papersize[=-]\S+|--pdf[=-]\S+/ \
- or @mod.inspect =~/--(?:a4|letter|legal|book|a5|b5)\b/i #command line config/header override
- @papersize=determine_papersize(@mod.inspect)
+ if @opt.mod.inspect =~/--papersize[=-]\S+|--pdf[=-]\S+/ \
+ or @opt.mod.inspect =~/--(?:a4|letter|legal|book|a5|b5)\b/i #command line config/header override
+ @papersize=determine_papersize(@opt.mod.inspect)
end
@papersize_array=@papersize.scan(/(?:a4|letter|legal|book|a5|b5)/i)
fn=@fns=~/\.ssm\.sst$/ ? @fns.gsub(/.sst/,'') : @fns #decide what to do a filesize on .ssm tells very little about actual document size
@@ -1257,13 +1257,13 @@ module SiSU_Param
if @en[:note] > 0 \
and @en[:sum] > 0
if @en[:sum] > 0
- else SiSU_Screen::Ansi.new(@cmd,'both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}").warn if @cmd !~/q/
+ else SiSU_Screen::Ansi.new(@opt.cmd,'both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}").warn if @opt.cmd !~/q/
end
end
if @en[:mark] != @en[:note] \
and @en[:note] > 0
@en[:mismatch]=@en[:note] - @en[:mark]
- SiSU_Screen::Ansi.new(@cmd,'endnote number mismatch',"endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})").warn if @cmd !~/q/
+ SiSU_Screen::Ansi.new(@opt.cmd,'endnote number mismatch',"endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})").warn if @opt.cmd !~/q/
footnote_conversion_errors=File.new("#{Dir.pwd}/footnote_conversion_errors.txt",'a')
footnote_conversion_errors << "#{@fns}:\n\tendnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})\n"
end
@@ -1274,7 +1274,7 @@ module SiSU_Param
and @opt.inspect =~/P/
#@title=Md.new('Text Insert',@opt,@env).title
else
- SiSU_Screen::Ansi.new(@cmd,'WARNING Document Title missing','please provide @title:').warn unless @cmd =~/q/
+ SiSU_Screen::Ansi.new(@opt.cmd,'WARNING Document Title missing','please provide @title:').warn unless @opt.cmd =~/q/
end
end
if @author !~/[\S]/
@@ -1282,7 +1282,7 @@ module SiSU_Param
and @opt.inspect =~/P/
#@creator=Md.new('Text Insert',@opt,@env).creator
else
- SiSU_Screen::Ansi.new(@cmd,'Warning Document Author missing','please provide @creator: :author:').warn unless @cmd =~/q/
+ SiSU_Screen::Ansi.new(@opt.cmd,'Warning Document Author missing','please provide @creator: :author:').warn unless @opt.cmd =~/q/
end
end
@struct={}
@@ -1349,7 +1349,7 @@ module SiSU_Param
@lv5 ||=/^5~/
@lv6 ||=/^6~/
if @doc_skin
- SiSU_Screen::Ansi.new(@cmd,"doc_skin <- #{@doc_skin}").txt_grey if @cmd =~/v/
+ SiSU_Screen::Ansi.new(@opt.cmd,"doc_skin <- #{@doc_skin}").txt_grey if @opt.cmd =~/v/
end
@data=nil #else whole file's contents are stored in md pstore & is not required to be... big waste actually
@file=SiSU_Env::SiSU_file.new(self) #watch
@@ -1364,7 +1364,7 @@ module SiSU_Param
end
def store
File.unlink(@pstorefile) if FileTest.file?(@pstorefile)
- SiSU_Screen::Ansi.new(@md.cmd,"PStore -> #{@pstorefile}").txt_grey if @md.cmd =~/[MV]/
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"PStore -> #{@pstorefile}").txt_grey if @md.opt.cmd =~/[MV]/
store=PStore.new(@pstorefile)
store.transaction do
store['md']=@md