From d3a09245ec7eab26b8fc8197cdb0f71f29bc85dd Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 11 Mar 2011 00:29:15 -0500 Subject: param: tidy, remove redundant document header tags --- lib/sisu/v3/param.rb | 81 ++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 44 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 8ae87010..9a11da8c 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -958,7 +958,7 @@ module SiSU_Param SiSU_Screen::Ansi.new(@cmd,'SiSU filetype indicator not provided',mv).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 =~//,Mx[:br_line]) #% metainfo DC copyright, public domain, copyleft, creative commons, etc. - @rights=Md.new($1.strip,@opt,@env).rights - when /^@papersize:\s+(.+?)$/m #% metainfo DC - l=$1 - if @mod.inspect !~/--papersize[=-]\S+/ - l=determine_papersize(l.dup) - @papersize=l + when /^@notes?:\s(.+)\Z/m #% * header metadata - notes + @notes=Md.new($1.strip,@opt,@env).notes + when /^@links:\s+(.+?)\Z/m #% * header metadata - links + doc_links=Md.new($1.strip,@opt,@env).links + count=1 + @links=[] + doc_links.each do |doc_link| + if doc_link=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/ + @links[count]={} + @links[count][:say],@links[count][:url]=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(doc_link)[1,2] + count +=1 + end end - when /^@make:(.+)/m #% metainfo DC + @lnk=@links + when /^@make:(.+)/m #% * header processing - make @make=Md.new($1.strip,@opt,@env).make if defined? @make.breaks \ - and @make.breaks[:page_new] #clearpage + and @make.breaks[:page_new] #clearpage @pagenew=@make.breaks[:page_new] end if defined? @make.breaks \ - and @make.breaks[:page_break] #newpage + and @make.breaks[:page_break] #newpage @pagebreak=@make.breaks[:page_break] end if defined? @make.headings \ @@ -1032,23 +1038,10 @@ module SiSU_Param end if defined? @make.manpage \ and @make.manpage - @man_section=(defined? @make.manpage.section) ? @make.manpage.section : 1 - end - when /^@links:\s+(.+?)\Z/m #% processing - doc_links=Md.new($1.strip,@opt,@env).links - count=1 - @links=[] - doc_links.each do |doc_link| - if doc_link=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/ - @links[count]={} - @links[count][:say],@links[count][:url]=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(doc_link)[1,2] - count +=1 - end + @man_section=(defined? @make.manpage.section) \ + ? @make.manpage.section \ + : 1 end - @lnk=@links - when /^@notes?:\s(.+)\Z/m #% metainfo - @notes=Md.new($1.strip,@opt,@env).notes - when /^@base_program:\s+(.+?)$/; @base_program=$1 #% processing end @lv1 ||=/^1~/ @lv2 ||=/^2~/ @@ -1056,7 +1049,7 @@ module SiSU_Param @lv4 ||=/^4~/ @lv5 ||=/^5~/ @lv6 ||=/^6~/ - else #% + else #% * case para when /^:?A~/ @lvs[1]=1 @@ -1071,7 +1064,7 @@ module SiSU_Param when /^3~/ @lvs[6]=1 end - if para =~ /^:A~/ #% processing + if para =~ /^:A~/ #% processing if @markup.nil? \ or @markup.empty? @markup=@markup_version.determined.to_s @@ -1091,13 +1084,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 @@ -1147,7 +1140,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! @@ -1360,7 +1353,7 @@ module SiSU_Param 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 - Store.new(self,@env).store #% pstore + Store.new(self,@env).store #% pstore self end private -- cgit v1.2.3