aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/param.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/param.rb')
-rw-r--r--lib/sisu/v0/param.rb357
1 files changed, 198 insertions, 159 deletions
diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb
index 2829abe1..c78a56b7 100644
--- a/lib/sisu/v0/param.rb
+++ b/lib/sisu/v0/param.rb
@@ -118,9 +118,9 @@ module SiSU_Param
@doc={ :lv=>[] }
@doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','',''
@@publisher='SiSU scribe'
- attr_accessor :cmd,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:sfx,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:dc_title,:html_title,:subtitle,:subtitle_tex,:creator_home,:dc_creator,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:dc_subject,:dc_description,:dc_publisher,:dc_contributor,:dc_date,:dc_date_created,:dc_date_issued,:dc_date_available,:dc_date_valid,:dc_date_modified,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:dc_type,:dc_format,:dc_identifier,:dc_source,:dc_language,:language_original,:dc_relation,:dc_coverage,:dc_rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:flag_auto_heading_num,:markup,:markup_instruction,:markup_version,:markup_declared,:make_bold,:make_italic,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,: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,:file_size,:user,:home,:hostname,:pwd,:firstseg,:programs,:creator_copymark,:lang,:en,: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,:man_section,:man_name,:man_synopsis,:ec,:opt,:sem_tag,:book_idx,:topic_register,:original_publication_details
+ attr_accessor :cmd,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:sfx,: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,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,: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,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:flag_auto_heading_num,:markup,:markup_instruction,:markup_version,:markup_declared,:make_bold,:make_italic,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,: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,:file_size,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:lang,:en,: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,:man_section,:man_name,:man_synopsis,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original_publication,:original_publication_date,:original_publication_nationality,:original_publication_institution,:writing_focus
def initialize(fns_array,opt)
- @env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@sfx=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@dc_title=@html_title=@subtitle=@subtitle_tex=@creator_home=@dc_creator=@translator=@illustrator=@prepared_by=@digitized_by=@dc_subject=@dc_description=@dc_publisher=@dc_contributor=@dc_date=@dc_date_created=@dc_date_issued=@dc_date_available=@dc_date_valid=@dc_date_modified=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@dc_type=@dc_format=@dc_identifier=@dc_source=@dc_language=@language_original=@dc_relation=@dc_coverage=@dc_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_auto_heading_num=@make_bold=@make_italic=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@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=@file_size=@firstseg=@programs=@creator_copymark=@lang=@en=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@man_synopsis=@topic_register=@original_publication_details=nil
+ @env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@sfx=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@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=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@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_auto_heading_num=@make_bold=@make_italic=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@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=@file_size=@firstseg=@programs=@author_copymark=@lang=@en=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@man_synopsis=@topic_register=@original_publication_details=@original_publication=@original_publication_date=@original_publication_nationality=@original_publication_institution=@writing_focus=nil
@man_section=1
@man_name='man page "name/whatis" information not provided, set in header @man: name=[whatis information]'
@data,@fns,@cmd,@mod,@opt=fns_array,opt.fns,opt.cmd,opt.mod,opt #@data used as data
@@ -131,8 +131,7 @@ module SiSU_Param
@markup=@markup_instruction #use @markup_instruction
@doc,@fn,@make_italic,@make_bold,@tag_hash,@ec={},{},{},{},{},{},{}
@flv,@lang,@seg_names,@tags,@tag_array,@tag_a,@ec[:image],@ec[:audio],@ec[:multimedia]=Array.new(9){[]}
- @authors=[]
- @papersize_array=[]
+ @authors,@topic_register_array,@papersize_array=[],[],[]
@rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
@rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/
@rgx_mm=/\{\s*(\S+?\.(?:ogg|mpeg))/ #expand and distinguish ogg
@@ -152,9 +151,45 @@ module SiSU_Param
else 'A4'
end
end
+ def name_format(name)
+ name.strip!
+ @name_a_h=[]
+ authors=name.scan(/[^;]+/)
+ authors.each do |a|
+ if a =~/"(.+?)"/
+ @name_a_h << { :the => $1 }
+ else #if a =~/,/
+ x=a.scan(/[^,]+/)
+ if x.length == 1
+ @name_a_h << { :the => x[0].strip }
+ elsif x.length == 2
+ @name_a_h << { :the => x[0].strip, :others => x[1].strip }
+ else #p x.length
+ end
+ end
+ end
+ l = @name_a_h.length
+ name_str=''
+ @name_a_h.each_with_index do |a,i|
+ name_str += if a[:others]
+ if (l - i) > 1
+ "#{a[:others].strip} #{a[:the].strip}, "
+ else
+ "#{a[:others].strip} #{a[:the].strip}"
+ end
+ else
+ if (l - i) > 2
+ "#{a[:the].strip}, "
+ else
+ "#{a[:the].strip}"
+ end
+ end
+ end
+ {:name_a_h =>@name_a_h,:name_str =>name_str}
+ end
def extract
@user,@home,@hostname,@pwd=ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD']
- @programs,@wc,@dc_language,@language_original={},{},{},{}
+ @programs,@wc,@language,@language_original={},{},{},{}
@en={ :sum=>0,:mark=>0,:note=>0,:mismatch=>0 }
@prog=SiSU_Env::Info_settings.new
@sys=SiSU_Env::System_call.new
@@ -257,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 =~/<![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"
@@ -267,165 +302,159 @@ module SiSU_Param
when /^\}code\s*$/; false
else @code_flag
end
- regx_header=/^(?:0~|@\S+?:[+-]?\s)/
+ regx_header=/^(?:@\S+?:[+-]?\s|0~\S+)/
if para =~regx_header \
and not @code_flag #or para=~/^(?:1|:?A)~/
case para
- when /^(?:0~ocn|@ocn:)\s+(.+?)$/m; @ocn=$1 #% processing
- when /^(?:0~title|@title:)\s+(.+?)$/m #% metainfo DC
+ when /^(?:@ocn:|0~ocn)\s+(.+?)$/m; @ocn=$1 #% processing
+ when /^(?:@title:|0~title)\s+(.+?)$/m #% metainfo DC
@title=$1.strip
- @dc_title=@title.dup
+ @full_title=@title.dup
@html_title=@title.gsub(/(<p>|<p \/>|<br>|<br \/>)/,'')
@set_header_title=true
@title.chomp!(' ')
@html_title.chomp!(' ')
tell=SiSU_Screen::Ansi.new(@cmd,'Parameters',@html_title)
tell.txt_grey unless @cmd =~/q/
- when /^(?:0~subtitle|@subtitle:)\s+(.+?)$/m #% metainfo
+ when /^(?:@subtitle:|0~subtitle)\s+(.+?)$/m #% metainfo
@subtitle=$1.strip
- @dc_title="#{@title} - #{@subtitle}"
+ @full_title="#{@title} - #{@subtitle}"
@subtitle_tex=@subtitle
- when /^(?:0~(creator|author)-?|@(creator|author)-?:)\s+/ #% metainfo DC
- if para[/(?:0~|@)(?:creator|author):?\s+((?:https?|ftp)\S+)\s+(.+?)$/m]
- @creator_home, @dc_creator=$1,$2
- else @dc_creator=/(?:0~|@)(?:creator|author)-?:?\s+(.+?)$/m.match(para)[1]
- end
- @dc_creator.strip!
- authors=@dc_creator.scan(/[^;]+/)
- authors.each do |a|
- if a =~/"(.+?)"/
- @authors << { :the => $1 }
- else #if a =~/,/
- x=a.scan(/[^,]+/)
- if x.length == 1
- @authors << { :the => x[0].strip }
- elsif x.length == 2
- @authors << { :the => x[0].strip, :others => x[1].strip }
- else #p x.length
- end
- end
- end
- l = @authors.length
- authorship=''
- @authors.each_with_index do |a,i|
- authorship += if a[:others]
- if (l - i) > 1
- "#{a[:others].strip} #{a[:the].strip}, "
- else
- "#{a[:others].strip} #{a[:the].strip}"
- end
- else
- if (l - i) > 2
- "#{a[:the].strip}, "
- else
- "#{a[:the].strip}"
- end
+ 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)\.nationality:\s+(.+?)$/; @author_nationality=$1
+ 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
+ names=name_format($1)
+ @illustrator=names[:name_str]
+ 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
+ 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
+ names=name_format($1)
+ @contributor=names[:name_str]
+ 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
+ if para =~/(?:@date:|0~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?
+ tell=SiSU_Screen::Ansi.new(@cmd,'Date Format should be','YYYY-MM-DD','please correct document','Date','field, current value:',@date)
+ tell.instruct if @cmd =~/v/
end
+ @date_scheme='scheme="ISO-8601"' if @date =~/\d{4}-\d{2}-\d{2}/
end
- @authorship=@dc_creator=authorship
- when /^(?:0~(?:translator|translated_by)|@(?:translator|translated_by):)\s+(.+?)$/m #% metainfo
- @translator=$1
- when /^(?:0~(?:illustrator|illustrated_by)|@(?:illustrator|illustrated_by):)\s+(.+?)$/m #% metainfo
- @illustrator=$1
- when /^(?:0~prepared_by|@prepared_by:)\s+(.+?)$/m #% metainfo
- @prepared_by=$1
- when /^(?:0~digitized_by|@digitized_by:)\s+(.+?)$/m #% metainfo DC
- @digitized_by=$1
- when /^(?:0~subject|@subject:)\s+(.+?)$/m #% metainfo DC
- @dc_subject=$1
- when /^(?:0~description|@description:)\s+(.+?)$/m #% metainfo DC & rss feed
- @dc_description=$1
- when /^(?:0~contributor|@contributor:)\s+(.+?)$/m #% metainfo DC
- @dc_contributor=$1
- when /^(?:0~publisher|@publisher:)\s+(.+?)$/m #% metainfo DC
- @dc_publisher=$1
- when /^(?:0~|@)date.+?$/m #% metainfo DC
- if para =~/(?:0~date|@date:)\s+(.+?)$/m
- @dc_date=$1.strip
- if @dc_date !~regx_date \
- and not @dc_date.empty?
- tell=SiSU_Screen::Ansi.new(@cmd,'Date Format should be','YYYY-MM-DD','please correct document','Date','field, current value:',@dc_date)
+ if para =~/(?:@date\.added_to_site:|0~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?
+ tell=SiSU_Screen::Ansi.new(@cmd,'Date Format should be','YYYY-MM-DD','please correct document','Date','field, current value:',@date_added_to_site)
tell.instruct if @cmd =~/v/
end
- @date_scheme='scheme="ISO-8601"' if @dc_date =~/\d{4}-\d{2}-\d{2}/
+ @date_scheme='scheme="ISO-8601"' if @date_added_to_site =~/\d{4}-\d{2}-\d{2}/
end
- if para =~/(?:0~date\.created|@date\.created:)\s*(.+?)$/m
+ if para =~/(?:@date\.created:|0~date\.created)\s*(.+?)$/m
date=$1.strip
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)
tell.instruct if @cmd =~/v/
end
- @dc_date_created=date
+ @date_created=date
@date_created_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/
end
- if para =~/(?:0~date\.issued|@date\.issued:)\s*(.+?)$/m
+ if para =~/(?:@date\.issued:|0~date\.issued)\s*(.+?)$/m
date=$1.strip
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)
tell.instruct if @cmd =~/v/
end
- @dc_date_issued=date
+ @date_issued=date
@date_issued_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/
end
- if para =~/(?:0~date\.available|@date\.available:)\s*(.+?)$/m
+ if para =~/(?:@date\.available:|0~date\.available)\s*(.+?)$/m
date=$1.strip
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)
tell.instruct if @cmd =~/v/
end
- @dc_date_available=date
+ @date_available=date
@date_available_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/
end
- if para =~/^(?:0~date\.valid|@date\.valid:)\s*(.+?)$/m
+ if para =~/^(?:@date\.valid:|0~date\.valid)\s*(.+?)$/m
date=$1.strip
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)
tell.instruct if @cmd =~/v/
end
- @dc_date_valid=date
+ @date_valid=date
@date_valid_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/
end
- if para =~/^(?:0~date\.modified|@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?
tell=SiSU_Screen::Ansi.new(@cmd,'Date Format should be','YYYY-MM-DD','please correct document','Date','field, current value:',date)
tell.instruct if @cmd =~/v/
end
- @dc_date_modified=date
+ @date_modified=date
@date_modified_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/
end
- when /^(?:0~type|@type:)\s+(.+?)$/m; @dc_type=$1 #% metainfo DC
- when /^(?:0~format|@format:)\s+(.+?)$/m; @dc_format=$1 #% metainfo DC
- #when /^(?:0~identifier|@identifier:)\s+(.+?)$/m; @dc_identifier=$1 #% metainfo DC
- when /^(?:0~source|@source:)\s+(.+?)$/m; @dc_source=$1 #% metainfo DC
- when /^(?:0~language(?:\.document)?|@language(?:\.document)?:)\s+(.+?)$/m #% metainfo DC
+ if para =~/^(?:@date\.translated:|0~date\.translated)\s*(.+?)$/m
+ date=$1.strip
+ 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)
+ tell.instruct if @cmd =~/v/
+ end
+ @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
x=$1.strip
lang=SiSU_Env::Standardise_language.new(x.dup)
- @dc_language[:code]=lang.code
- @dc_language[:name]=lang.title
- when /^(?:0~language\.original|@language\.original:)\s+(.+?)$/m #% metainfo DC
+ @language[:code]=lang.code
+ @language[:name]=lang.title
+ 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 /^(?:0~relation|@relation:)\s+(.+?)$/m; @dc_relation=$1 #% metainfo DC
- when /^(?:0~coverage|@coverage:)\s+(.+?)$/m; @dc_coverage=$1 #% metainfo DC
- when /^(?:0~rights|@rights:)\s+(.+?)$/m; @dc_rights=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC copyright, public domain, copyleft, creative commons, etc.
- when /^(?:0~papersize|@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 /^(?:0~keywords?|@keywords?:?)\s+(.+?)$/m; @keywords=$1 #% metainfo DC
- when /^(?:0~comments?|@comments?:?)\s+(.+?)$/m; @comments=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC
- when /^(?:0~abstract|@abstract)\s+(.+?)$/m; @abstract=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC
- when /^(?:0~tags?|@tags?:)\s+\S/m #% metainfo
- tags=para.match(/^(?:0~tags?|@tags?:)\s+(.+)\Z/m)[1]
+ 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!
@tags << tag
@@ -434,23 +463,23 @@ module SiSU_Param
tag_a=tag_a.split(/:/).join('][')
@tag_a << tag_a
end
- when /^(?:0~catalogue|@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 /^(?:0~class(?:ify)?_loc|@class(?:ify)?_loc:)\s+(.+?)$/m; @cls_loc=$1 #% metainfo
- when /^(?:0~class(?:ify)?_dewey|@class(?:ify)?_dewey:)\s+(.+?)$/m; @cls_dewey=$1 #% metainfo
- when /^(?:0~class(?:ify)?_pg|@class(?:ify)?_pg)\s+(.+?)$/m; @cls_pg=$1 #% metainfo
- when /^(?:0~(?:class(?:ify)?_)?isbn|@(?:class(?:ify)?_)?isbn)\s+(\S+?)$/m; @cls_isbn=$1 #% metainfo
- when /^(?:0~images?|@images?:)\s+(.+?)$/m; @image=$1 #% processing
- when /^(?:0~(?:toc|structure)|@(?: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}/
@@ -462,8 +491,8 @@ module SiSU_Param
@lv5=/^#{lv5}/
lv6=@toc[5] ||='6~ '
@lv6=/^#{lv6}/
- when /^(?:0~(?:level|page|markup)|@(?: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):|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*/)
#pagebreaks=[ pagebreaks ] if pagebreaks == String
@@ -480,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 =~/^(?:0~markup|@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 /^(?:0~bold|@bold:)\s+(.+?)$/m #% processing
+ when /^(?:@bold:|0~bold)\s+(.+?)$/m #% processing
m=$1.strip
x=case m
when /\/i$/; 'i'
@@ -498,7 +527,7 @@ module SiSU_Param
else /#{rgx}/
end
@make_bold
- when /^(?:0~(?:italics?|itali[sz]e)|@(?: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'
@@ -512,11 +541,11 @@ module SiSU_Param
else /#{rgx}/
end
@make_italic
- when /^(?:0~(?:vocabulary|wordlist)|@(?:vocabulary|wordlist):)\s+(.+?)$/m #% processing
- @vocabulary=$1 #not actually used by concordance
- when /^(?:0~skin|@skin:)\s+(.+?)$/; @doc_skin=$1.strip #% processing
- when /^(?:0~(?:css|stylesheet)|@(?:css|stylesheet):)\s+(.+?)$/; @doc_css=$1.strip #% processing
- when /^(?:0~links|@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|$)/
@@ -540,40 +569,50 @@ module SiSU_Param
end
end
end
- when /^(?:0~prefix(?:_[ab])?|@prefix(?:_[ab])?:)\s/ #% metainfo
+ when /^(?:@prefix(?:_[ab])?:|0~prefix(?:_[ab])?)\s/ #% metainfo
if para =~/prefix_a:?\s+/
- @prefix_a=para[/(?:0~prefix_a|@prefix_a:)\s+(.+?)$/im,1]
+ @prefix_a=para[/(?:@prefix_a:|0~prefix_a)\s+(.+?)$/im,1]
end
if para =~/prefix(?:_b)?:?\s+/
- @prefix_b=para[/(?:0~prefix(?:_b)?|@prefix(?:_b)?:)\s+(.+?)$/im,1]
+ @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 ={(.+?)}
+ u=@topic_register.scan(/[^;]+/)
+ v=[]
+ u.each do |l|
+ v << l.scan(/[^:]+/)
+ end
+ v.each do |m|
+ m[-1]=m[-1].scan(/[^|]+/) if m[-1] =~/[|]/
+ @topic_register_array << m
end
- when /^(?:0~suffix|@suffix:)\s+(.+?)$/m; @suffix=$1 #% metainfo
- when /^(?:0~information|@information:)\s+(.+?)$/m; @information=$1 #% metainfo
- when /^(?:0~topic_register|@topic_register:)\s+(.+?)$/m; @topic_register=$1 #% metainfo, similar syntax to book index, leave out the ={} i.e. use equivalent of ={(.+?)}
- when /^(?:0~contact|@contact:)\s+(.+?)$/m; @contact=$1 #% metainfo
- when /^(?:0~original_publication|@original_publication:)\s+(.+?)$/m; @original_publication=$1 #% details of original publication
- when /^(?:0~icon|@icon:)\s+(.+?)$/m; @icon=$1 #% processing
- when /^(?:0~promo|@promo:)\s+(.+?)$/m
+ @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
@flag_promo=true
@promo=$1.split(/[,;]\s*/)
- when /^(?:0~ad|@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 /^(?:0~sta?mp(?:ed)?|@sta?mp(?:ed)?:)\s+(.+?)$/m; @stmp= $1.downcase! #% processing
- when /^(?:0~(?:rcs|cvs)|@(?:rcs|cvs):)\+?\s+/ #% processing
- m=/(?:0~(?:rcs|cvs)|@(?:rcs|cvs):)\+?\s+/ #note the + sign to turn on use of rcs or cvs id
+ 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!
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[/(?:0~(?:rcs|cvs)|@(?:rcs|cvs):)\+/]
- when /^@base_program:\s+(.+?)$/; @base_program=$1 #% processing
+ @sc_info=true if para[/(?:@(?:rcs|cvs):|0~(?: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 /^(?:0~man|@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|
@@ -588,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?
@@ -614,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
@@ -658,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}/ \
@@ -680,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!
@@ -697,11 +736,11 @@ module SiSU_Param
@man_synopsis.gsub!(/\n/,"\n.BR\n")
@man_synopsis.gsub!(/\A/,"\n.SH SYNOPSIS\n")
end
- unless @dc_rights
- if @dc_creator
- @dc_rights ||=if @dc_date =~/([12][890]\d{2})/ #matches years 1800 through 20\d\d 2004w19
- "Copyright (C) #{$1} #@dc_creator"
- else 'Copyright (C)' + @dc_creator
+ unless @rights
+ if @author
+ @rights ||=if @date =~/([12][890]\d{2})/ #matches years 1800 through 20\d\d 2004w19
+ "Copyright (C) #{$1} #@author"
+ else 'Copyright (C)' + @author
end
end
end
@@ -754,17 +793,17 @@ module SiSU_Param
end
end
end
- @dc_publisher ||= "#@@publisher (this copy)"
+ @publisher ||= "#@@publisher (this copy)"
fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(@fns)
- unless @dc_language[:code] \
- and @dc_language[:name]
+ unless @language[:code] \
+ and @language[:name]
lang=@env.i18n.language #default language settings for directory by name, or in sysrc.yml
- @dc_language[:code] ||= lang.code
- @dc_language[:name] ||= lang.title
+ @language[:code] ||= lang.code
+ @language[:name] ||= lang.title
end
unless fn_set_lang[:d]==true #decide, naming convention overrides other settings, within document, etc.
- @dc_language[:code]=fn_set_lang[:c]
- @dc_language[:name]=fn_set_lang[:l]
+ @language[:code]=fn_set_lang[:c]
+ @language[:name]=fn_set_lang[:l]
end
@fnl=@env.i18n.lang_filename(fn_set_lang[:c])
@flv.each do |l|
@@ -778,7 +817,7 @@ module SiSU_Param
end if @flv
@lang.uniq!
@fn=SiSU_Env::Env_call.new(@fns).lang(fn_set_lang[:c])
- @dc_identifier="#{@env.url.root}/#@fnb/#{@fn[:toc]}" #DC note constructed dc identifier
+ @identifier="#{@env.url.root}/#@fnb/#{@fn[:toc]}" #DC note constructed dc identifier
if @en[:note] > 0 \
and @en[:sum] > 0
if @en[:sum] > 0
@@ -797,8 +836,8 @@ module SiSU_Param
tell=SiSU_Screen::Ansi.new(@cmd,'Document Title Missing','please provide it')
tell.warn if @cmd =~/v/
end
- if @dc_creator !~/[\S]/
- tell=SiSU_Screen::Ansi.new(@cmd,'Document Creator/Author Missing','please provide it')
+ if @author !~/[\S]/
+ tell=SiSU_Screen::Ansi.new(@cmd,'Document Author/Creator Missing','please provide it')
tell.warn if @cmd =~/v/
end
# Elementary Document Structure Analysis - adds complexity may remove - need to develop - appears to work, proof of concept
@@ -887,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