diff options
-rw-r--r-- | lib/sisu/v1/dal_doc_str.rb | 1 | ||||
-rw-r--r-- | lib/sisu/v1/dal_substitutions_and_insertions.rb | 73 | ||||
-rw-r--r-- | lib/sisu/v1/dal_syntax.rb | 16 | ||||
-rw-r--r-- | lib/sisu/v1/param.rb | 199 |
4 files changed, 174 insertions, 115 deletions
diff --git a/lib/sisu/v1/dal_doc_str.rb b/lib/sisu/v1/dal_doc_str.rb index 2e135243..bed3115c 100644 --- a/lib/sisu/v1/dal_doc_str.rb +++ b/lib/sisu/v1/dal_doc_str.rb @@ -101,6 +101,7 @@ module SiSU_document_structure @para.gsub!(/^:?B~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}") @para.gsub!(/^:?A~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}") @para.gsub!(/^:?A~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}") + @para.gsub!(/^:?A~\s*$/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]} @title @author") @para=if @para =~/^@(?:level|markup):\s/ @para.gsub!(/3/,'6') @para.gsub!(/2/,'5') diff --git a/lib/sisu/v1/dal_substitutions_and_insertions.rb b/lib/sisu/v1/dal_substitutions_and_insertions.rb index cadae8a7..1ffb22d4 100644 --- a/lib/sisu/v1/dal_substitutions_and_insertions.rb +++ b/lib/sisu/v1/dal_substitutions_and_insertions.rb @@ -79,29 +79,55 @@ module SiSU_substitute_and_insert @skin.select ins=SiSU_Viz::Inserts.new case para - when /^\s*<:insert1>\s*$/ - para=[] - ins.insert1.split(/\n\n/).each{|x| para << x } - when /^\s*<:insert2>\s*$/ - para=[] - ins.insert2.split(/\n\n/).each{|x| para << x } - when /^\s*<:insert3>\s*$/ - para=[] - ins.insert3.split(/\n\n/).each{|x| para << x << "\n"} - para=ins.insert3 - when /^\s*<:insert4>\s*$/ - para=[] - ins.insert4.split(/\n\n/).each{|x| para << x << "\n"} - para=ins.insert4 - when /^\s*<:insert5>\s*$/ - para=[] - ins.insert5.split(/\n\n/).each{|x| para << x << "\n"} - when /^\s*<:insert6>\s*$/ - para=[] - ins.insert6.split(/\n\n/).each{|x| para << x << "\n"} - when /^\s*<:insert7>\s*$/ - para=[] - ins.insert7.split(/\n\n/).each{|x| para << x << "\n"} + when /^\s*<:(insert1)>\s*$/ + i=$1 + if defined? ins.insert1 + para=[] + ins.insert1.split(/\n\n/).each{|x| para << x } + else p "skin #{i} not found in #{@skin.select}" + end + when /^\s*<:(insert2)>\s*$/ + i=$1 + if defined? ins.insert2 + para=[] + ins.insert2.split(/\n\n/).each{|x| para << x } + else p "skin #{i} not found in #{@skin.select}" + end + when /^\s*<:(insert3)>\s*$/ + i=$1 + if defined? ins.insert3 + para=[] + ins.insert3.split(/\n\n/).each{|x| para << x << "\n"} + else p "skin #{i} not found in #{@skin.select}" + end + when /^\s*<:(insert4)>\s*$/ + i=$1 + if defined? ins.insert4 + para=[] + ins.insert4.split(/\n\n/).each{|x| para << x << "\n"} + else p "skin #{i} not found in #{@skin.select}" + end + when /^\s*<:(insert5)>\s*$/ + i=$1 + if defined? ins.insert5 + para=[] + ins.insert5.split(/\n\n/).each{|x| para << x << "\n"} + else p "skin #{i} not found in #{@skin.select}" + end + when /^\s*<:(insert6)>\s*$/ + i=$1 + if defined? ins.insert6 + para=[] + ins.insert6.split(/\n\n/).each{|x| para << x << "\n"} + else p "skin #{i} not found in #{@skin.select}" + end + when /^\s*<:(insert7)>\s*$/ + i=$1 + if defined? ins.insert7 + para=[] + ins.insert7.split(/\n\n/).each{|x| para << x << "\n"} + else p "skin #{i} not found in #{@skin.select}" + end end para.each{|x| data_expand << x } else data_expand << para @@ -126,4 +152,3 @@ module SiSU_substitute_and_insert end end __END__ - diff --git a/lib/sisu/v1/dal_syntax.rb b/lib/sisu/v1/dal_syntax.rb index e917621a..c6bab08f 100644 --- a/lib/sisu/v1/dal_syntax.rb +++ b/lib/sisu/v1/dal_syntax.rb @@ -252,18 +252,12 @@ module SiSU_Syntax line.gsub!(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c]) line.gsub!(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]) #default if markup does not specify line.gsub!(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c]) - if @md.subtitle and not @md.subtitle.empty? - if line =~/(?:by\s+)?(?:@creator|@author)/ - line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s+(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.title} - #{@md.subtitle},<br />\\2#{@md.author}") - else - line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s*$/,"\\1 #{@md.title} - #{@md.subtitle}") - end - else - if line =~/(?:by\s+)?(?:@creator|@author)/ - line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s+(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.title},<br />\\2#{@md.author}") - else - line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s*$/,"\\1 #{@md.title}") + if line =~/^#{Mx[:lv_o]}1:\S*?#{Mx[:lv_c]}/ + if @md.subtitle and not @md.subtitle.empty? + line.gsub!(/\s*@title\b/," #{@md.title} - #{@md.subtitle}") + else line.gsub!(/\s*@title\b/," #{@md.title}") end + line.gsub!(/\s+(?:@creator|@author)/,",<br />#{@md.author}") end line.gsub!(/^(1~\??) @title\s*$/,"\\1 #{@md.title} - #{@md.subtitle}") # line.gsub!(/^(#{Mx[:lv_o]}[23]:\??#{Mx[:lv_c]}) (?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 \\2#{@md.author}") # diff --git a/lib/sisu/v1/param.rb b/lib/sisu/v1/param.rb index 4efdebb5..72593207 100644 --- a/lib/sisu/v1/param.rb +++ b/lib/sisu/v1/param.rb @@ -82,7 +82,7 @@ module SiSU_Param @fns=opt.fns.gsub(/\.ssm$/,'.ssm.sst') #revisit CHECK Instantiate.new.param_instantiate @env=SiSU_Env::Info_env.new(@fns) - @pstorefile="#{@env.path.dal}/#@fns.pstore" + @pstorefile="#{@env.path.dal}/#{@fns}.pstore" end def get unless @@fns==@fns @@ -233,13 +233,13 @@ module SiSU_Param @flag_auto_heading_num=false if @fns =~ /(?:-|ssm\.)?sst$/ #watch @env_out_root=@env.path.output - @dir_out="#{@env.path.output}/#@fnb" + @dir_out="#{@env.path.output}/#{@fnb}" @dir_tex=@env.path.tex @dir_lout=@env.path.lout @@publisher='SiSU http://www.jus.uio.no/sisu' end @txt_path=@txt_path ||= @env.path.output - @stmp=%{#@fns}[/^(.+?)\..*/m,1] + @stmp=%{#{@fns}}[/^(.+?)\..*/m,1] @fnstex=@fns.gsub(/_/,'\_') @flag_separate_endnotes=false @flag_separate_endnotes_make=true @@ -260,10 +260,10 @@ module SiSU_Param else '' end s_a,s_b,s_c=@sisu_version[:version].match(/^([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\-\S+)?$/)[1..3] - tell=if @markup_version_declared.to_f == @markup_version.to_f - SiSU_Screen::Ansi.new(@cmd,"Markup version (#@markup_version)",sv) + tell=if @markup_version_declared.to_f==@markup_version.to_f + SiSU_Screen::Ansi.new(@cmd,"Markup version (#{@markup_version})",sv) else - SiSU_Screen::Ansi.new(@cmd,"Markup version declared (#@markup_version_declared), determined (#@markup_version)",sv) + SiSU_Screen::Ansi.new(@cmd,"Markup version declared (#{@markup_version_declared}), determined (#{@markup_version})",sv) end ok=if s_a.to_i > sm_a.to_i true @@ -279,7 +279,7 @@ module SiSU_Param if ok tell.txt_green if @cmd =~/[vVM]/ else - tell=SiSU_Screen::Ansi.new(@cmd,"Warning: markup version determined (#@markup_version) or markup version declared (#@markup_version_declared) is newer than SiSU version (#{@sisu_version[:version]})") + tell=SiSU_Screen::Ansi.new(@cmd,"Warning: markup version determined (#{@markup_version}) or markup version declared (#{@markup_version_declared}) is newer than SiSU version (#{@sisu_version[:version]})") tell.warn unless @cmd =~/q/ end else @@ -294,19 +294,19 @@ module SiSU_Param fns_array.each do |para| #% Scan document if para !~/^%+\s/ \ and para =~/<![abcdeghijklmnopqrstuvwxyz]/i # <!f not included - raise "Old markup style in file #@fns, current version #{@sisu_version[:project]} #{@sisu_version[:version]} #{@sisu_version[:date_stamp]} #{@sisu_version[:date]}:\n\t\t#{para}\n\n" + raise "Old markup style in file #{@fns}, current version #{@sisu_version[:project]} #{@sisu_version[:version]} #{@sisu_version[:date_stamp]} #{@sisu_version[:date]}:\n\t\t#{para}\n\n" end @code_flag=case para when /^code\{\s*$/; true when /^\}code\s*$/; false else @code_flag end - regx_header=/^(?:@\S+?:[+-]?\s|0~\S+)/ + regx_header=/^@\S+?:[+-]?\s/ if para =~regx_header \ and not @code_flag #or para=~/^(?:1|:?A)~/ case para - when /^(?:@ocn:|0~ocn)\s+(.+?)$/m; @ocn=$1 #% processing - when /^(?:@title:|0~title)\s+(.+?)$/m #% metainfo DC + when /^@ocn:\s+(.+?)$/m; @ocn=$1 #% processing + when /^@title:\s+(.+?)$/m #% metainfo DC @title=$1.strip @full_title=@title.dup @html_title=@title.gsub(/(<p>|<p \/>|<br>|<br \/>)/,'') @@ -315,41 +315,46 @@ 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:\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:[ ]+)(.+?)(?:[|]|$)/m #when /^@(?:creator|author):(?:[ ]+|.+?:author:[ ]+)(.+?)(?:[|]|$)/m + names=name_format($1) + @authorship=@author=names[:name_str] + @authors=names[:name_a_h] + when /^@author:\s+(.+?)$/ 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)\.nationality:\s+(.+?)$/; @author_nationality=$1 - when /^(?:@(?:translator|translated_by):|0~(?:translator|translated_by))\s+(.+?)$/m #% metainfo + when /^@(?: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):\s+(.+?)$/m #% metainfo names=name_format($1) @illustrator=names[:name_str] - when /^(?:@prepared_by:|0~prepared_by)\s+(.+?)$/m #% metainfo + when /^@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:\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:\s+(.+?)$/m; @subject=$1 #% metainfo DC + when /^@description:\s+(.+?)$/m; @description=$1 #% metainfo DC & rss feed + when /^@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:\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 - if para =~/(?:@date:|0~date)\s+(.+?)$/m + when /^@date:(?:[ ]+|.+?:published:[ ]+)(\d{4})/m #% metainfo DC + #when /^@date.+?$/m #% metainfo DC + if para =~/@date:\s+(.+?)$/m @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? @@ -358,7 +363,7 @@ module SiSU_Param end @date_scheme='scheme="ISO-8601"' if @date =~/\d{4}-\d{2}-\d{2}/ end - if para =~/(?:@date\.added_to_site:|0~date\.added_to_site)\s+(.+?)$/m + if para =~/@date\.added_to_site:\s+(.+?)$/m @date_added_to_site=$1.strip if @date_added_to_site !~regx_date \ and not @date_added_to_site.empty? @@ -367,7 +372,7 @@ module SiSU_Param end @date_scheme='scheme="ISO-8601"' if @date_added_to_site =~/\d{4}-\d{2}-\d{2}/ end - if para =~/(?:@date\.created:|0~date\.created)\s*(.+?)$/m + if para =~/@date\.created:\s*(.+?)$/m date=$1.strip if date !~regx_date \ and not date.empty? @@ -377,7 +382,7 @@ module SiSU_Param @date_created=date @date_created_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/ end - if para =~/(?:@date\.issued:|0~date\.issued)\s*(.+?)$/m + if para =~/@date\.issued:\s*(.+?)$/m date=$1.strip if date !~regx_date \ and not date.empty? @@ -387,7 +392,7 @@ module SiSU_Param @date_issued=date @date_issued_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/ end - if para =~/(?:@date\.available:|0~date\.available)\s*(.+?)$/m + if para =~/@date\.available:\s*(.+?)$/m date=$1.strip if date !~regx_date \ and not date.empty? @@ -397,7 +402,7 @@ module SiSU_Param @date_available=date @date_available_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/ end - if para =~/^(?:@date\.valid:|0~date\.valid)\s*(.+?)$/m + if para =~/^@date\.valid:\s*(.+?)$/m date=$1.strip if date !~regx_date \ and not date.empty? @@ -407,7 +412,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:\s*(.+?)$/m #% of interest rss feed & sitemap date=$1.strip if date !~regx_date \ and not date.empty? @@ -417,7 +422,7 @@ module SiSU_Param @date_modified=date @date_modified_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/ end - if para =~/^(?:@date\.translated:|0~date\.translated)\s*(.+?)$/m + if para =~/^@date\.translated:\s*(.+?)$/m date=$1.strip if date !~regx_date \ and not date.empty? @@ -427,33 +432,33 @@ 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 /^(?:@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 /^@type:\s+(.+?)$/m; @type=$1 #% metainfo DC + when /^@format:\s+(.+?)$/m; @format=$1 #% metainfo DC + #when /^@identifier:\s+(.+?)$/m; @identifier=$1 #% metainfo DC + when /^@source:\s+(.+?)$/m; @source=$1 #% metainfo DC + when /^@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:\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:\s+(.+?)$/m; @relation=$1 #% metainfo DC + when /^@coverage:\s+(.+?)$/m; @coverage=$1 #% metainfo DC + when /^@rights:\s+(.+?)$/m; @rights=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC copyright, public domain, copyleft, creative commons, etc. + when /^@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 - tags=para.match(/^(?:@tags?:|0~tags?)\s+(.+)\Z/m)[1] + when /^@keywords?:\s+(.+?)$/m; @keywords=$1 #% metainfo DC + when /^@comments?:\s+(.+?)$/m; @comments=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC + when /^@abstract:\s+(.+?)$/m; @abstract=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC + when /^@tags?:\s+\S/m #% metainfo + tags=para.match(/^@tags?:\s+(.+)\Z/m)[1] tags.split(/,|$/).each do |tag| tag.strip! @tags << tag @@ -462,18 +467,50 @@ module SiSU_Param tag_a=tag_a.split(/:/).join('][') @tag_a << tag_a end - when /^(?:@catalogue:|0~catalogue)\s+(.+)?$/m #% metainfo + when /^@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:\s+(.+?)$/m; @cls_loc=$1 #% metainfo + when /^@class(?:ify)?_dewey:\s+(.+?)$/m; @cls_dewey=$1 #% metainfo + when /^@class(?:ify)?_pg:\s+(.+?)$/m; @cls_pg=$1 #% metainfo + when /^@(?:class(?:ify)?_)?isbn:\s+(\S+?)$/m; @cls_isbn=$1 #% metainfo + when /^@images?:\s+(.+?)$/m; @image=$1 #% processing + + when /^@make:/m #% metainfo DC + + if para=~ /^@make:.+?:breaks:[ ]+(.+?)\n/m + #p $1 #FIX + #@pagenew= + #@pagebreak= + end + if para=~ /^@make:.+?:headings:[ ]+(.+?)\n/m + s=$1 + lv=[] + s=(s =~/;/) ? (s.split(/;\s*/)) : [ s ] + @toc=s + lv1=s[0] ||='1~ ' + @lv1=/^#{lv1}/ + lv2=s[1] ||='2~ ' + @lv2=/^#{lv2}/ + lv3=s[2] ||='3~ ' + @lv3=/^#{lv3}/ + lv4=s[3] ||='4~ ' + @lv4=/^#{lv4}/ + lv5=s[4] ||='5~ ' + @lv5=/^#{lv5}/ + lv6=s[5] ||='6~ ' + @lv6=/^#{lv6}/ + end + if para=~ /^@make:.+?:num_top:[ ]+(.+?)\n/m + @num_top=$1 + end + if para=~ /^@make:.+?:skin:[ ]+(.+?)\n/m + @doc_skin=$1 + end + when /^@(?:toc|structure):\s+(.+?)\Z/m #% processing doc_toc_str=$1 @toc=doc_toc_str.split(/;\s*/) @toc=[ @toc ] if @toc == String @@ -490,8 +527,8 @@ 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 - if para =~/(?:@|0~)(?:markup|level|page):?\s+(.+?)\Z/m + when /^@(?:level|page|markup):\s+(.+?)$/m #% processing revisit..., use syntax 0~level new=1,2,3; break=4 + if para =~/@(?:markup|level|page):?\s+(.+?)\Z/m page_break_str=$1 pagebreaks=page_break_str.split(/;\s*/) #pagebreaks=[ pagebreaks ] if pagebreaks == String @@ -508,11 +545,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:\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:\s+(.+?)$/m #% processing m=$1.strip x=case m when /\/i$/; 'i' @@ -526,7 +563,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):\s+(.+?)$/m #% processing Dublin Core - dublin core within m=$1.strip x=case m when /\/i$/; 'i' @@ -540,11 +577,11 @@ module SiSU_Param else /#{rgx}/ end @make_italic - when /^(?:@(?:vocabulary|wordlist):|0~(?:vocabulary|wordlist))\s+(.+?)$/m #% processing + when /^@(?: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 /^@skin:\s+(.+?)$/; @doc_skin=$1.strip #% processing + when /^@(?:css|stylesheet):\s+(.+?)$/; @doc_css=$1.strip #% processing + when /^@links:\s+(.+?)\Z/m #% processing doc_links_str=$1 @lnk=[] if doc_links_str=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/ @@ -568,16 +605,18 @@ module SiSU_Param end end end - when /^(?:@prefix(?:_[ab])?:|0~prefix(?:_[ab])?)\s/ #% metainfo + when /^@prefix(?:_[ab])?:\s/ #% metainfo if para =~/prefix_a:?\s+/ - @prefix_a=para[/(?:@prefix_a:|0~prefix_a)\s+(.+?)$/im,1] + @prefix_a=para[/@prefix_a:\s+(.+?)$/im,1] end if para =~/prefix(?:_b)?:?\s+/ - @prefix_b=para[/(?:@prefix(?:_b)?:|0~prefix(?:_b)?)\s+(.+?)$/im,1] + @prefix_b=para[/@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:\s+(.+?)$/m; @suffix=$1 #% metainfo + when /^@information:\s+(.+?)$/m; @information=$1 #% metainfo + when /^(?:@topic_register:[ ]+|@classify:.+?:topic_register:[ ]+)(.+?)\n/m #% metainfo, similar syntax to book index, leave out the ={} i.e. use equivalent of ={(.+?)} + #when /^@topic_register:\s+(.+?)$/m; @topic_register=$1 #% metainfo, similar syntax to book index, leave out the ={} i.e. use equivalent of ={(.+?)} + @topic_register=$1 u=@topic_register.scan(/[^;]+/) v=[] u.each do |l| @@ -588,30 +627,30 @@ 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 /^(?:@promo:|0~promo)\s+(.+?)$/m + when /^@contact:\s+(.+?)$/m; @contact=$1 #% metainfo + when /^@original_publication:\s+(.+?)$/m; @original_publication=$1 #% details of original publication + when /^@icon:\s+(.+?)$/m; @icon=$1 #% processing + when /^@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:\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 - 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 - m=/(?:@(?:rcs|cvs):|0~(?:rcs|cvs))\+?\s+/ #note the + sign to turn on use of rcs or cvs id +# when /0~ad\.home\s+(.+)?\s*$/m #% processing +# ad_home_str=$1 +# @ad_home=ad_home_str.split(/\s+!/) + when /^@sta?mp(?:ed)?:\s+(.+?)$/m; @stmp= $1.downcase! #% processing + when /^@(?:rcs|cvs):\+?\s+/ #% processing + m=/@(?: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! if contains.match(ver) filename,vnumber,date,time,operator=contains.match(ver).captures @sc_filename,@sc_number,@sc_date,@sc_time=filename,vnumber,date,time end - @sc_info=true if para[/(?:@(?:rcs|cvs):|0~(?:rcs|cvs))\+/] + @sc_info=true if para[/@(?:rcs|cvs):\+/] 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:\s+(.+?)\Z/m #% man pages maninfo_str=$1 maninfo=maninfo_str.split(/;\s*/m) maninfo.each do |x| |