From c27f4dff2362e31dc23da5eaf5dc8747028e7c72 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 14 Dec 2008 00:12:31 -0500 Subject: param & dal, cosmetic, text placement --- lib/sisu/v0/dal.rb | 4 +- lib/sisu/v0/param.rb | 142 +++++++++++++++++++++++++-------------------------- 2 files changed, 73 insertions(+), 73 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index fbc5de7b..10fb192a 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -149,8 +149,8 @@ module SiSU_DAL end end meta=file_array.dup - meta=meta.join.split("\n\n") #check whether can be eliminated, some of these are large objects to have twice - @md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract + meta=meta.join.split("\n\n") #check whether can be eliminated, some of these are large objects to have twice + @md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract meta=nil dal=SiSU_DAL::Make.new(@md,file_array).song SiSU_Screen::Ansi.new(@md.cmd,@md.fns,"~meta/#{@md.fns}.meta").output if @md.cmd =~/v/ diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb index bcf6f97b..c78a56b7 100644 --- a/lib/sisu/v0/param.rb +++ b/lib/sisu/v0/param.rb @@ -292,7 +292,7 @@ module SiSU_Param tell.warn unless @cmd =~/q/ end @code_flag=false - fns_array.each do |para| #% Scan document + fns_array.each do |para| #% Scan document if para !~/^%+\s/ \ and para =~/|

|
|
)/,'') @@ -316,42 +316,42 @@ module SiSU_Param @html_title.chomp!(' ') tell=SiSU_Screen::Ansi.new(@cmd,'Parameters',@html_title) tell.txt_grey unless @cmd =~/q/ - when /^(?:@subtitle:|0~subtitle)\s+(.+?)$/m #% metainfo + when /^(?:@subtitle:|0~subtitle)\s+(.+?)$/m #% metainfo @subtitle=$1.strip @full_title="#{@title} - #{@subtitle}" @subtitle_tex=@subtitle - when /^(?:@(?:creator|author)-?:|0~(?:creator|author)-?)\s+(.+?)$/ #% metainfo DC + when /^(?:@(?:creator|author)-?:|0~(?:creator|author)-?)\s+(.+?)$/ #% metainfo DC names=name_format($1) @authorship=@author=names[:name_str] @authors=names[:name_a_h] - when /^@(?:creator|author)\.title:\s+(.+?)$/; @author_title=$1 # Prof. Dr. etc. + when /^@(?:creator|author)\.title:\s+(.+?)$/; @author_title=$1 # Prof. Dr. etc. when /^@(?:creator|author)\.nationality:\s+(.+?)$/; @author_nationality=$1 - when /^(?:@(?:translator|translated_by):|0~(?:translator|translated_by))\s+(.+?)$/m #% metainfo + when /^(?:@(?:translator|translated_by):|0~(?:translator|translated_by))\s+(.+?)$/m #% metainfo names=name_format($1) @translator=names[:name_str] - when /^(?:@(?:illustrator|illustrated_by):|0~(?:illustrator|illustrated_by))\s+(.+?)$/m #% metainfo + when /^(?:@(?:illustrator|illustrated_by):|0~(?:illustrator|illustrated_by))\s+(.+?)$/m #% metainfo names=name_format($1) @illustrator=names[:name_str] - when /^(?:@prepared_by:|0~prepared_by)\s+(.+?)$/m #% metainfo + when /^(?:@prepared_by:|0~prepared_by)\s+(.+?)$/m #% metainfo names=name_format($1) @prepared_by=names[:name_str] - when /^(?:@digitized_by:|0~digitized_by)\s+(.+?)$/m #% metainfo DC + when /^(?:@digitized_by:|0~digitized_by)\s+(.+?)$/m #% metainfo DC names=name_format($1) @digitized_by=names[:name_str] - when /^(?:@subject:|0~subject)\s+(.+?)$/m; @subject=$1 #% metainfo DC - when /^(?:@description:|0~description)\s+(.+?)$/m; @description=$1 #% metainfo DC & rss feed - when /^(?:@contributor:|0~contributor)\s+(.+?)$/m #% metainfo DC + when /^(?:@subject:|0~subject)\s+(.+?)$/m; @subject=$1 #% metainfo DC + when /^(?:@description:|0~description)\s+(.+?)$/m; @description=$1 #% metainfo DC & rss feed + when /^(?:@contributor:|0~contributor)\s+(.+?)$/m #% metainfo DC names=name_format($1) @contributor=names[:name_str] - when /^(?:@publisher:|0~publisher)\s+(.+?)$/m; @publisher=$1 #% metainfo DC + when /^(?:@publisher:|0~publisher)\s+(.+?)$/m; @publisher=$1 #% metainfo DC when /^@original_publication:\s+(.+?)$/m; @original_publication=$1 when /^@original_publication\.date:\s+(.+?)$/; @original_publication_date=$1 when /^@original_publication\.nationality:\s+(.+?)$/; @original_publication_nationality=$1 when /^@original_publication\.institution:\s+(.+?)$/; @original_publication_institution=$1 - when /^@writing_focus\.nationality:\s+(.+?)$/; @writing_focus=$1 # e.g. Finland (where and article on Finnish law) - when /^(?:@|0~)date.+?$/m #% metainfo DC + when /^@writing_focus\.nationality:\s+(.+?)$/; @writing_focus=$1 # e.g. Finland (where and article on Finnish law) + when /^(?:@|0~)date.+?$/m #% metainfo DC if para =~/(?:@date:|0~date)\s+(.+?)$/m - @date=$1.strip #% original publication date unless the substantive text is updated/modified, then date of update + @date=$1.strip #% original publication date unless the substantive text is updated/modified, then date of update if @date !~regx_date \ and not @date.empty? tell=SiSU_Screen::Ansi.new(@cmd,'Date Format should be','YYYY-MM-DD','please correct document','Date','field, current value:',@date) @@ -408,7 +408,7 @@ module SiSU_Param @date_valid=date @date_valid_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/ end - if para =~/^(?:@date\.modified:|0~date\.modified)\s*(.+?)$/m #% of interest rss feed & sitemap + if para =~/^(?:@date\.modified:|0~date\.modified)\s*(.+?)$/m #% of interest rss feed & sitemap date=$1.strip if date !~regx_date \ and not date.empty? @@ -428,32 +428,32 @@ module SiSU_Param @date_translated=date @date_translated_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/ end - when /^(?:@type:|0~type)\s+(.+?)$/m; @type=$1 #% metainfo DC - when /^(?:@format:|0~format)\s+(.+?)$/m; @format=$1 #% metainfo DC + when /^(?:@type:|0~type)\s+(.+?)$/m; @type=$1 #% metainfo DC + when /^(?:@format:|0~format)\s+(.+?)$/m; @format=$1 #% metainfo DC #when /^(?:@identifier:|0~identifier)\s+(.+?)$/m; @identifier=$1 #% metainfo DC - when /^(?:@source:|0~source)\s+(.+?)$/m; @source=$1 #% metainfo DC - when /^(?:@language(?:\.document)?:|0~language(?:\.document)?)\s+(.+?)$/m #% metainfo DC + when /^(?:@source:|0~source)\s+(.+?)$/m; @source=$1 #% metainfo DC + when /^(?:@language(?:\.document)?:|0~language(?:\.document)?)\s+(.+?)$/m #% metainfo DC x=$1.strip lang=SiSU_Env::Standardise_language.new(x.dup) @language[:code]=lang.code @language[:name]=lang.title - when /^(?:@language\.original:|0~language\.original)\s+(.+?)$/m #% metainfo DC + when /^(?:@language\.original:|0~language\.original)\s+(.+?)$/m #% metainfo DC x=$1.strip lang=SiSU_Env::Standardise_language.new(x.dup) @language_original[:name]=lang.title - when /^(?:@relation:|0~relation)\s+(.+?)$/m; @relation=$1 #% metainfo DC - when /^(?:@coverage:|0~coverage)\s+(.+?)$/m; @coverage=$1 #% metainfo DC - when /^(?:@rights:|0~rights)\s+(.+?)$/m; @rights=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC copyright, public domain, copyleft, creative commons, etc. - when /^(?:@papersize:|0~papersize)\s+(.+?)$/m #% metainfo DC + when /^(?:@relation:|0~relation)\s+(.+?)$/m; @relation=$1 #% metainfo DC + when /^(?:@coverage:|0~coverage)\s+(.+?)$/m; @coverage=$1 #% metainfo DC + when /^(?:@rights:|0~rights)\s+(.+?)$/m; @rights=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC copyright, public domain, copyleft, creative commons, etc. + when /^(?:@papersize:|0~papersize)\s+(.+?)$/m #% metainfo DC l=$1 if @mod.inspect !~/--papersize[=-]\S+/ l=determine_papersize(l.dup) @papersize=l end - when /^(?:@keywords?:|0~keywords?)\s+(.+?)$/m; @keywords=$1 #% metainfo DC - when /^(?:@comments?:|0~comments?)\s+(.+?)$/m; @comments=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC - when /^(?:@abstract:|0~abstract)\s+(.+?)$/m; @abstract=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC - when /^(?:@tags?:|0~tags?)\s+\S/m #% metainfo + when /^(?:@keywords?:|0~keywords?)\s+(.+?)$/m; @keywords=$1 #% metainfo DC + when /^(?:@comments?:|0~comments?)\s+(.+?)$/m; @comments=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC + when /^(?:@abstract:|0~abstract)\s+(.+?)$/m; @abstract=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC + when /^(?:@tags?:|0~tags?)\s+\S/m #% metainfo tags=para.match(/^(?:@tags?:|0~tags?)\s+(.+)\Z/m)[1] tags.split(/,|$/).each do |tag| tag.strip! @@ -463,23 +463,23 @@ module SiSU_Param tag_a=tag_a.split(/:/).join('][') @tag_a << tag_a end - when /^(?:@catalogue:|0~catalogue)\s+(.+)?$/m #% metainfo + when /^(?:@catalogue:|0~catalogue)\s+(.+)?$/m #% metainfo m=$1 @cls_pg=m.match(/pg=(\S+)/)[1] if m =~/pg=/ @cls_isbn=m.match(/isbn=(\S+)/)[1] if m =~/isbn=/ @cls_dewey=m.match(/dewey=(\S+)/)[1] if m =~/dewey=/ @cls_loc=m.match(/loc=(\S+)/)[1] if m =~/loc=/ - when /^(?:@class(?:ify)?_loc:|0~class(?:ify)?_loc)\s+(.+?)$/m; @cls_loc=$1 #% metainfo - when /^(?:@class(?:ify)?_dewey:|0~class(?:ify)?_dewey)\s+(.+?)$/m; @cls_dewey=$1 #% metainfo - when /^(?:@class(?:ify)?_pg:|0~class(?:ify)?_pg)\s+(.+?)$/m; @cls_pg=$1 #% metainfo - when /^(?:@(?:class(?:ify)?_)?isbn:|0~(?:class(?:ify)?_)?isbn)\s+(\S+?)$/m; @cls_isbn=$1 #% metainfo - when /^(?:@images?:|0~images?)\s+(.+?)$/m; @image=$1 #% processing - when /^(?:@(?:toc|structure):|0~(?:toc|structure))\s+(.+?)\Z/m #% processing + when /^(?:@class(?:ify)?_loc:|0~class(?:ify)?_loc)\s+(.+?)$/m; @cls_loc=$1 #% metainfo + when /^(?:@class(?:ify)?_dewey:|0~class(?:ify)?_dewey)\s+(.+?)$/m; @cls_dewey=$1 #% metainfo + when /^(?:@class(?:ify)?_pg:|0~class(?:ify)?_pg)\s+(.+?)$/m; @cls_pg=$1 #% metainfo + when /^(?:@(?:class(?:ify)?_)?isbn:|0~(?:class(?:ify)?_)?isbn)\s+(\S+?)$/m; @cls_isbn=$1 #% metainfo + when /^(?:@images?:|0~images?)\s+(.+?)$/m; @image=$1 #% processing + when /^(?:@(?:toc|structure):|0~(?:toc|structure))\s+(.+?)\Z/m #% processing doc_toc_str=$1 @toc=doc_toc_str.split(/;\s*/) @toc=[ @toc ] if @toc == String #@toc.each {|x| x.gsub!(/\{/,'\{') } #FIX~ - lv1=@toc[0] ||='1~ ' #some arbitrary changes made + lv1=@toc[0] ||='1~ ' #some arbitrary changes made @lv1=/^#{lv1}/ lv2=@toc[1] ||='2~ ' @lv2=/^#{lv2}/ @@ -491,7 +491,7 @@ module SiSU_Param @lv5=/^#{lv5}/ lv6=@toc[5] ||='6~ ' @lv6=/^#{lv6}/ - when /^(?:@(?:level|page|markup):|0~(?:level|page|markup))\s+(.+?)$/m #% processing revisit..., use syntax 0~level new=1,2,3; break=4 + when /^(?:@(?:level|page|markup):|0~(?:level|page|markup))\s+(.+?)$/m #% processing revisit..., use syntax 0~level new=1,2,3; break=4 if para =~/(?:@|0~)(?:markup|level|page):?\s+(.+?)\Z/m page_break_str=$1 pagebreaks=page_break_str.split(/;\s*/) @@ -509,11 +509,11 @@ module SiSU_Param @toc_lev_limit=toc_lev_limit if toc_lev_limit @flag_auto_heading_num=true if para =~/num_top/ end - if para =~/^(?:@markup:|0~markup)\s+(.+?)$/m #%use of markup depreciated for num_top + if para =~/^(?:@markup:|0~markup)\s+(.+?)$/m #%use of markup depreciated for num_top @markup=$1 @flag_auto_heading_num=true if para =~/num_top/ end - when /^(?:@bold:|0~bold)\s+(.+?)$/m #% processing + when /^(?:@bold:|0~bold)\s+(.+?)$/m #% processing m=$1.strip x=case m when /\/i$/; 'i' @@ -527,7 +527,7 @@ module SiSU_Param else /#{rgx}/ end @make_bold - when /^(?:@(?:italics?|itali[sz]e):|0~(?:italics?|itali[sz]e))\s+(.+?)$/m #% processing Dublin Core - dublin core within + when /^(?:@(?:italics?|itali[sz]e):|0~(?:italics?|itali[sz]e))\s+(.+?)$/m #% processing Dublin Core - dublin core within m=$1.strip x=case m when /\/i$/; 'i' @@ -541,11 +541,11 @@ module SiSU_Param else /#{rgx}/ end @make_italic - when /^(?:@(?:vocabulary|wordlist):|0~(?:vocabulary|wordlist))\s+(.+?)$/m #% processing - @vocabulary=$1 #not actually used by concordance - when /^(?:@skin:|0~skin)\s+(.+?)$/; @doc_skin=$1.strip #% processing - when /^(?:@(?:css|stylesheet):|0~(?:css|stylesheet))\s+(.+?)$/; @doc_css=$1.strip #% processing - when /^(?:@links:|0~links)\s+(.+?)\Z/m #% processing + when /^(?:@(?:vocabulary|wordlist):|0~(?:vocabulary|wordlist))\s+(.+?)$/m #% processing + @vocabulary=$1 #not actually used by concordance + when /^(?:@skin:|0~skin)\s+(.+?)$/; @doc_skin=$1.strip #% processing + when /^(?:@(?:css|stylesheet):|0~(?:css|stylesheet))\s+(.+?)$/; @doc_css=$1.strip #% processing + when /^(?:@links:|0~links)\s+(.+?)\Z/m #% processing doc_links_str=$1 @lnk=[] if doc_links_str=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/ @@ -569,16 +569,16 @@ module SiSU_Param end end end - when /^(?:@prefix(?:_[ab])?:|0~prefix(?:_[ab])?)\s/ #% metainfo + when /^(?:@prefix(?:_[ab])?:|0~prefix(?:_[ab])?)\s/ #% metainfo if para =~/prefix_a:?\s+/ @prefix_a=para[/(?:@prefix_a:|0~prefix_a)\s+(.+?)$/im,1] end if para =~/prefix(?:_b)?:?\s+/ @prefix_b=para[/(?:@prefix(?:_b)?:|0~prefix(?:_b)?)\s+(.+?)$/im,1] end - when /^(?:@suffix:|0~suffix)\s+(.+?)$/m; @suffix=$1 #% metainfo - when /^(?:@information:|0~information)\s+(.+?)$/m; @information=$1 #% metainfo - when /^(?:@topic_register:|0~topic_register)\s+(.+?)$/m; @topic_register=$1 #% metainfo, similar syntax to book index, leave out the ={} i.e. use equivalent of ={(.+?)} + when /^(?:@suffix:|0~suffix)\s+(.+?)$/m; @suffix=$1 #% metainfo + when /^(?:@information:|0~information)\s+(.+?)$/m; @information=$1 #% metainfo + when /^(?:@topic_register:|0~topic_register)\s+(.+?)$/m; @topic_register=$1 #% metainfo, similar syntax to book index, leave out the ={} i.e. use equivalent of ={(.+?)} u=@topic_register.scan(/[^;]+/) v=[] u.each do |l| @@ -589,19 +589,19 @@ module SiSU_Param @topic_register_array << m end @topic_register_array.sort! - when /^(?:@contact:|0~contact)\s+(.+?)$/m; @contact=$1 #% metainfo - when /^(?:@original_publication:|0~original_publication)\s+(.+?)$/m; @original_publication=$1 #% details of original publication - when /^(?:@icon:|0~icon)\s+(.+?)$/m; @icon=$1 #% processing + when /^(?:@contact:|0~contact)\s+(.+?)$/m; @contact=$1 #% metainfo + when /^(?:@original_publication:|0~original_publication)\s+(.+?)$/m; @original_publication=$1 #% details of original publication + when /^(?:@icon:|0~icon)\s+(.+?)$/m; @icon=$1 #% processing when /^(?:@promo:|0~promo)\s+(.+?)$/m @flag_promo=true @promo=$1.split(/[,;]\s*/) - when /^(?:@ad:|0~ad)\s+(\S+)?\s+(\S+\.png)?\s+(.+?!)\s+(\d+)\s*$/m #% processing + when /^(?:@ad:|0~ad)\s+(\S+)?\s+(\S+\.png)?\s+(.+?!)\s+(\d+)\s*$/m #% processing @ad_url,@ad_png,@ad_alt,@ad_began=$1,$2,$3,$4 - when /0~ad\.home\s+(.+)?\s*$/m #% processing + when /0~ad\.home\s+(.+)?\s*$/m #% processing ad_home_str=$1 @ad_home=ad_home_str.split(/\s+!/) - when /^(?:@sta?mp(?:ed)?:|0~sta?mp(?:ed)?)\s+(.+?)$/m; @stmp= $1.downcase! #% processing - when /^(?:@(?:rcs|cvs):|0~(?:rcs|cvs))\+?\s+/ #% processing + when /^(?:@sta?mp(?:ed)?:|0~sta?mp(?:ed)?)\s+(.+?)$/m; @stmp= $1.downcase! #% processing + when /^(?:@(?:rcs|cvs):|0~(?:rcs|cvs))\+?\s+/ #% processing m=/(?:@(?:rcs|cvs):|0~(?:rcs|cvs))\+?\s+/ #note the + sign to turn on use of rcs or cvs id ver=para[/#{m}(.+)/,1] #RCS or CVS ID tag # eg. # $Id$ contains=/[\$]Id:\s+(\S+),v\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+Exp\s+(?:\S+\s+)?[\$]/ # reason for [$] which is apparently unnecessary is that rcs or cvs will otherwise expand id! @@ -610,9 +610,9 @@ module SiSU_Param @sc_filename,@sc_number,@sc_date,@sc_time=filename,vnumber,date,time end @sc_info=true if para[/(?:@(?:rcs|cvs):|0~(?:rcs|cvs))\+/] - when /^@base_program:\s+(.+?)$/; @base_program=$1 #% processing + when /^@base_program:\s+(.+?)$/; @base_program=$1 #% processing #% break - break, not necessary to process headers further :-) but necessary to extract endnotes etc. ;-( - when /^(?:@man:|0~man)\s+(.+?)\Z/m #% man pages + when /^(?:@man:|0~man)\s+(.+?)\Z/m #% man pages maninfo_str=$1 maninfo=maninfo_str.split(/;\s*/m) maninfo.each do |x| @@ -627,8 +627,8 @@ module SiSU_Param @lv4 ||=/^#{Mx[:lv_o]}4:/ @lv5 ||=/^#{Mx[:lv_o]}5:/ @lv6 ||=/^#{Mx[:lv_o]}6:/ - else #% - if para =~ /^(?:1|:?A)~/ #% processing + else #% + if para =~ /^(?:1|:?A)~/ #% processing if para=~/^:?A~/ if @markup.nil? \ or @markup.empty? @@ -653,13 +653,13 @@ module SiSU_Param end unless @code_flag case para - when /~\{\s+.+?\}~/m #% processing + when /~\{\s+.+?\}~/m #% processing en=para.scan(/~\{.+?\}~/m) en.each { |e| @en[:sum] +=1 } - when /~\^(?:\s|$)/m #% processing + when /~\^(?:\s|$)/m #% processing mk=para.scan(/~\^(?:\s|$)/) mk.each { |e| @en[:mark] +=1 } - when /^\^~\s+\S/; @en[:note] +=1 #% processing + when /^\^~\s+\S/; @en[:note] +=1 #% processing end end if para =~/~\{|\^~ |~\^|<:ee>|\{.+?\[[1-6]\]\}\S+?\.ss[tm]/m; @flag_auto_endnotes,@flag_endnotes=true,true @@ -697,11 +697,11 @@ module SiSU_Param and para =~/^4~\s+(.+)$/ t=$1 end - unless @heading_seg_first_flag # extract first segment name + unless @heading_seg_first_flag # extract first segment name @heading_seg_first=t @heading_seg_first_flag=true end - if m # list all segment names + if m # list all segment names @seg_names << m @set_heading_seg=true if m=~/^\d{1,3}/ \ @@ -719,7 +719,7 @@ module SiSU_Param unless @sem_tag @sem_tag=true if para=~/[:;]\{.+?\}[:;][a-z+]/ #refix later end - end #% here endeth the document loop + end #% here endeth the document loop if @ec[:image].length > 0 @ec[:image].flatten! @ec[:image].uniq! @@ -926,8 +926,8 @@ module SiSU_Param tell=SiSU_Screen::Ansi.new(@cmd,"doc_skin <- #@doc_skin") tell.txt_grey if @cmd =~/v/ end - @data=nil #else whole file's contents are stored in md pstore & is not required to be... big waste actually - Store.new(self,@env).store #% pstore + @data=nil #else whole file's contents are stored in md pstore & is not required to be... big waste actually + Store.new(self,@env).store #% pstore self end private -- cgit v1.2.3