class SiSU_Param::Parameters::Md
Public Class Methods
new(str,opt,env)
click to toggle source
# File lib/sisu/dp.rb, line 194 def initialize(str,opt,env) @s,@opt,@env=str,opt,env end
Public Instance Methods
abstract()
click to toggle source
# File lib/sisu/dp.rb, line 851 def abstract s=@h['abstract'] l,n=Db[:col_info_note],'notes.abstract' validate_length(s,l,n) end
added_to_site()
click to toggle source
# File lib/sisu/dp.rb, line 743 def added_to_site s=@h['added_to_site'] l,n=Db[:col_date_text],'date.added_to_site' validate_length(s,l,n) end
all()
click to toggle source
# File lib/sisu/dp.rb, line 621 def all s=if @h['all'] then @h['all'] else s='' if defined? copyright.text \ and copyright.text \ and not copyright.text.empty? v=sep(copyright.text) s +='Copyright: ' + copyright.text + v end if defined? copyright.translation \ and copyright.translation \ and not copyright.translation.empty? v=sep(copyright.translation) s +='translation: ' + copyright.translation + v end if defined? copyright.illustrations \ and copyright.illustrations \ and not copyright.illustrations.empty? v=sep(copyright.illustrations) s +='illustrations: ' + copyright.illustrations + v end if defined? copyright.photographs \ and copyright.photographs \ and not copyright.photographs.empty? v=sep(copyright.photographs) s +='photographs: ' + copyright.photographs + v end if defined? copyright.digitization \ and copyright.digitization \ and not copyright.digitization.empty? v=sep(copyright.digitization) s +='digitization: ' + copyright.digitization + v end if defined? copyright.audio \ and copyright.audio \ and not copyright.audio.empty? v=sep(copyright.audio) s +='audio: ' + copyright.audio + v end if defined? copyright.license \ and copyright.license \ and not copyright.license.empty? s +='License: ' + copyright.license end if s.empty? SiSU_Screen::Ansi.new( @opt.act[:color_state][:set], 'WARNING Document Rights information missing; provide @rights: :copyright:' ).warn if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) else l,n=Db[:col_info_note],'rights.all' validate_length(s,l,n) end s=s.gsub(/ [\\]+\s+$/,'') end s end
audio()
click to toggle source
# File lib/sisu/dp.rb, line 458 def audio names=@h['audio'] \ ? name_format(@h['audio']) : nil s=(names.is_a?(Hash)) \ ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.audio' validate_length(s,l,n) else nil end end
audio_detail()
click to toggle source
# File lib/sisu/dp.rb, line 471 def audio_detail names=@h['audio'] \ ? name_format(@h['audio']) : nil (names.is_a?(Hash)) \ ? names[:name_a_h] : nil end
available()
click to toggle source
# File lib/sisu/dp.rb, line 748 def available s=@h['available'] l,n=Db[:col_date_text],'date.available' validate_length(s,l,n) end
build_hash(arr)
click to toggle source
# File lib/sisu/dp.rb, line 258 def build_hash(arr) @h={} arr.each_with_index do |x,i| a,b=nil,nil if x =~/^%\s/ #ignore comment elsif x =~/:(\S+?):\s+(.+)/ a,b=/:(\S+?):\s+(.+)\Z/m.match(x)[1,2] b=b.gsub(/\s*<br(?: \/)?>\s*/,' \\\\\\ ') b=if b =~/\n/m (b =~/;\n/m) \ ? (b.split(/;\s*\n\s*/).join(';')) : (b.split(/\s*\n\s*/).join(' ')) else b end elsif i == 0 a='main' b=x else end @h[a]=b end @h end
classify()
click to toggle source
# File lib/sisu/dp.rb, line 703 def classify a=@s.split(/(\n%\s.+?$|[ ]*)(?:\n[ ]*(?=:)|\Z)/m) @h=build_hash(a) def topic_register s=@h['topic_register'] l,n=Db[:col_info_note],'classify.topic_register' validate_length(s,l,n) end def subject s=@h['subject'] l,n=Db[:col_txt_long],'classify.subject' validate_length(s,l,n) end def keywords s=@h['keywords'] l,n=Db[:col_txt_long],'classify.keywords' validate_length(s,l,n) end def loc s=@h['loc'] l,n=Db[:col_library],'classify.loc' validate_length(s,l,n) end def dewey s=@h['dewey'] l,n=Db[:col_library],'classify.dewey' validate_length(s,l,n) end self end
comment()
click to toggle source
# File lib/sisu/dp.rb, line 856 def comment s=@h['comment'] l,n=Db[:col_info_note],'notes.comment' validate_length(s,l,n) end
contributor()
click to toggle source
# File lib/sisu/dp.rb, line 374 def contributor names=@h['contributor'] \ ? name_format(@h['contributor']) : nil s=(names.is_a?(Hash)) \ ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.author' validate_length(s,l,n) else nil end end
contributor_detail()
click to toggle source
# File lib/sisu/dp.rb, line 387 def contributor_detail names=@h['contributor'] \ ? name_format(@h['contributor']) : nil (names.is_a?(Hash)) \ ? names[:name_a_h] : nil end
copyright()
click to toggle source
# File lib/sisu/dp.rb, line 527 def copyright def text #you may wish to expand to take from all s=if @h['copyright'] then @h['copyright'] elsif @h['text'] then @h['text'] elsif @h['main'] then @h['main'] else SiSU_Screen::Ansi.new( @opt.act[:color_state][:set], 'WARNING Document Copyright missing; provide @rights: :copyright:' ).warn if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) '' end l,n=Db[:col_info_note],'rights.copyright.text' validate_length(s,l,n) end def translation s=@h['translation'] \ ? @h['translation'] : nil l,n=Db[:col_info_note],'rights.copyright.translation' validate_length(s,l,n) end def illustrations s=@h['illustrations'] \ ? @h['illustrations'] : nil l,n=Db[:col_info_note],'rights.copyright.illustrations' validate_length(s,l,n) end def photographs s=@h['photographs'] \ ? @h['photographs'] : nil l,n=Db[:col_info_note],'rights.copyright.photographs' validate_length(s,l,n) end def digitization s=@h['digitization'] \ ? @h['digitization'] : nil l,n=Db[:col_info_note],'rights.copyright.digitization' validate_length(s,l,n) end def audio s=@h['audio'] \ ? @h['audio'] : nil l,n=Db[:col_info_note],'rights.copyright.audio' validate_length(s,l,n) end self end
copyright_and_license()
click to toggle source
# File lib/sisu/dp.rb, line 591 def copyright_and_license s=if @h['copyright_and_license'] then @h['copyright_and_license'] else s='' if defined? copyright.text \ and copyright.text \ and not copyright.text.empty? v=sep(copyright.text) s +=copyright.text + v end if defined? copyright.license \ and copyright.license \ and not copyright.license.empty? s +=copyright.license end if s.empty? SiSU_Screen::Ansi.new( @opt.act[:color_state][:set], 'WARNING Document Rights information missing; provide @rights: :copyright:' ).warn if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) else l,n=Db[:col_info_note],'rights.all' validate_length(s,l,n) end s=s.gsub(/ [\\]+\s+$/,'') end s end
coverage()
click to toggle source
# File lib/sisu/dp.rb, line 861 def coverage s=@h['coverage'] l,n=Db[:col_info_note],'notes.coverage' validate_length(s,l,n) end
created()
click to toggle source
# File lib/sisu/dp.rb, line 753 def created s=@h['created'] l,n=Db[:col_date_text],'date.created' validate_length(s,l,n) end
creator()
click to toggle source
# File lib/sisu/dp.rb, line 331 def creator #there are sub categories that need to be catered for and sometimes more than one author etc.; implement array.to_s.length validation test later, current test on string approximate as string is not used a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) @h=build_hash(a) def author @h['author']=(@h['author'] \ ? @h['author'] : @h['main']) names=name_format(@h['author']) s=names[:name_str] l,n=Db[:col_name],'creator.author' validate_length(s,l,n) end def author_detail s=@h['author'] \ ? @h['author'] : @h['main'] names=name_format(s) names[:name_a_h] end def email #revisit s=@h['email'] end def editor names=@h['editor'] \ ? name_format(@h['editor']) : nil s=(names.is_a?(Hash)) \ ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.editor' validate_length(s,l,n) else nil end end def editor_detail names=@h['editor'] \ ? name_format(@h['editor']) : nil (names.is_a?(Hash)) \ ? names[:name_a_h] : nil end def contributor names=@h['contributor'] \ ? name_format(@h['contributor']) : nil s=(names.is_a?(Hash)) \ ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.author' validate_length(s,l,n) else nil end end def contributor_detail names=@h['contributor'] \ ? name_format(@h['contributor']) : nil (names.is_a?(Hash)) \ ? names[:name_a_h] : nil end def illustrator names=@h['illustrator'] \ ? name_format(@h['illustrator']) : nil s=(names.is_a?(Hash)) \ ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.illustrator' validate_length(s,l,n) else nil end end def illustrator_detail names=@h['illustrator'] \ ? name_format(@h['illustrator']) : nil (names.is_a?(Hash)) \ ? names[:name_a_h] : nil end def photographer names=@h['photographer'] \ ? name_format(@h['photographer']) : nil s=(names.is_a?(Hash)) \ ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.photographer' validate_length(s,l,n) else nil end end def photographer_detail names=@h['photographer'] \ ? name_format(@h['photographer']) : nil (names.is_a?(Hash)) \ ? names[:name_a_h] : nil end def translator names=@h['translator'] \ ? name_format(@h['translator']) : nil s=(names.is_a?(Hash)) \ ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.translator' validate_length(s,l,n) else nil end end def translator_detail names=@h['translator'] \ ? name_format(@h['translator']) : nil (names.is_a?(Hash)) \ ? names[:name_a_h] : nil end def audio names=@h['audio'] \ ? name_format(@h['audio']) : nil s=(names.is_a?(Hash)) \ ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.audio' validate_length(s,l,n) else nil end end def audio_detail names=@h['audio'] \ ? name_format(@h['audio']) : nil (names.is_a?(Hash)) \ ? names[:name_a_h] : nil end def digitized_by names=@h['digitized_by'] \ ? name_format(@h['digitized_by']) : nil s=(names.is_a?(Hash)) \ ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.digitized_by' validate_length(s,l,n) else nil end end def digitized_by_detail names=@h['digitized_by'] \ ? name_format(@h['digitized_by']) : nil (names.is_a?(Hash)) \ ? names[:name_a_h] : nil end def prepared_by names=@h['prepared_by'] \ ? name_format(@h['prepared_by']) : nil s=(names.is_a?(Hash)) \ ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.prepared_by' validate_length(s,l,n) else nil end end def prepared_by_detail names=@h['prepared_by'] \ ? name_format(@h['prepared_by']) : nil names=name_format(@h['prepared_by']) (names.is_a?(Hash)) \ ? names[:name_a_h] : nil end self end
current_publisher()
click to toggle source
def language # as things stand this should really be populated from title.language and original.language, resolve
a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) @h=build_hash(a) def document s=@h['document']=(@h['document'] ? @h['document'] : @h['main']) l,n=Db[:col_language],'language.document' validate_length(s,l,n) end def document_char s=@h['document_char']=(@h['document_char'] ? @h['document_char'] : nil) l,n=Db[:col_language_char],'language.document_char' validate_length(s,l,n) end def original s=@h['original'] l,n=Db[:col_language],'language.original' validate_length(s,l,n) end def original_char s=@h['original_char'] l,n=Db[:col_language_char],'language.original_char' validate_length(s,l,n) end self
end
# File lib/sisu/dp.rb, line 805 def current_publisher @s end
date()
click to toggle source
# File lib/sisu/dp.rb, line 740 def date a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) @h=build_hash(a) def added_to_site s=@h['added_to_site'] l,n=Db[:col_date_text],'date.added_to_site' validate_length(s,l,n) end def available s=@h['available'] l,n=Db[:col_date_text],'date.available' validate_length(s,l,n) end def created s=@h['created'] l,n=Db[:col_date_text],'date.created' validate_length(s,l,n) end def issued s=@h['issued'] l,n=Db[:col_date_text],'date.issued' validate_length(s,l,n) end def modified s=@h['modified'] l,n=Db[:col_date_text],'date.modified' validate_length(s,l,n) end def published s=@h['published']=(@h['published'] ? @h['published'] : @h['main']) l,n=Db[:col_date_text],'date.published' validate_length(s,l,n) end def valid s=@h['valid'] l,n=Db[:col_date_text],'date.valid' validate_length(s,l,n) end self end
description()
click to toggle source
# File lib/sisu/dp.rb, line 846 def description s=@h['description'] l,n=Db[:col_info_note],'notes.description' validate_length(s,l,n) end
dewey()
click to toggle source
# File lib/sisu/dp.rb, line 726 def dewey s=@h['dewey'] l,n=Db[:col_library],'classify.dewey' validate_length(s,l,n) end
digitization()
click to toggle source
# File lib/sisu/dp.rb, line 565 def digitization s=@h['digitization'] \ ? @h['digitization'] : nil l,n=Db[:col_info_note],'rights.copyright.digitization' validate_length(s,l,n) end
digitized_by()
click to toggle source
# File lib/sisu/dp.rb, line 479 def digitized_by names=@h['digitized_by'] \ ? name_format(@h['digitized_by']) : nil s=(names.is_a?(Hash)) \ ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.digitized_by' validate_length(s,l,n) else nil end end
digitized_by_detail()
click to toggle source
# File lib/sisu/dp.rb, line 492 def digitized_by_detail names=@h['digitized_by'] \ ? name_format(@h['digitized_by']) : nil (names.is_a?(Hash)) \ ? names[:name_a_h] : nil end
edition()
click to toggle source
# File lib/sisu/dp.rb, line 295 def edition s=@h['edition'] l,n=Db[:col_title_edition],'title.edition' validate_length(s,l,n) end
editor()
click to toggle source
# File lib/sisu/dp.rb, line 353 def editor names=@h['editor'] \ ? name_format(@h['editor']) : nil s=(names.is_a?(Hash)) \ ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.editor' validate_length(s,l,n) else nil end end
editor_detail()
click to toggle source
# File lib/sisu/dp.rb, line 366 def editor_detail names=@h['editor'] \ ? name_format(@h['editor']) : nil (names.is_a?(Hash)) \ ? names[:name_a_h] : nil end
email()
click to toggle source
# File lib/sisu/dp.rb, line 350 def email #revisit s=@h['email'] end
format()
click to toggle source
# File lib/sisu/dp.rb, line 886 def format s=@h['format'] l,n=Db[:col_txt_short],'notes.format' validate_length(s,l,n) end
full()
click to toggle source
# File lib/sisu/dp.rb, line 312 def full s=@h['subtitle'] \ ? (@h['main'] + ' - ' + @h['subtitle']) : @h['main'] l,n=Db[:col_title],'title.full' validate_length(s,l,n) end
history()
click to toggle source
# File lib/sisu/dp.rb, line 876 def history s=@h['history'] l,n=Db[:col_txt_long],'notes.history' validate_length(s,l,n) end
identifier()
click to toggle source
# File lib/sisu/dp.rb, line 683 def identifier a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) @h=build_hash(a) def oclc s=@h['oclc'] l,n=Db[:col_library],'identifier.oclc' validate_length(s,l,n) end def isbn s=@h['isbn'] l,n=Db[:col_small],'identifier.isbn' validate_length(s,l,n) end def pg s=@h['pg'] l,n=Db[:col_small],'identifier.pg' validate_length(s,l,n) end self end
illustrations()
click to toggle source
# File lib/sisu/dp.rb, line 551 def illustrations s=@h['illustrations'] \ ? @h['illustrations'] : nil l,n=Db[:col_info_note],'rights.copyright.illustrations' validate_length(s,l,n) end
illustrator()
click to toggle source
# File lib/sisu/dp.rb, line 395 def illustrator names=@h['illustrator'] \ ? name_format(@h['illustrator']) : nil s=(names.is_a?(Hash)) \ ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.illustrator' validate_length(s,l,n) else nil end end
illustrator_detail()
click to toggle source
# File lib/sisu/dp.rb, line 408 def illustrator_detail names=@h['illustrator'] \ ? name_format(@h['illustrator']) : nil (names.is_a?(Hash)) \ ? names[:name_a_h] : nil end
institution()
click to toggle source
# File lib/sisu/dp.rb, line 831 def institution s=@h['institution'] l,n=Db[:col_name],'original.institution' validate_length(s,l,n) end
isbn()
click to toggle source
# File lib/sisu/dp.rb, line 691 def isbn s=@h['isbn'] l,n=Db[:col_small],'identifier.isbn' validate_length(s,l,n) end
issued()
click to toggle source
# File lib/sisu/dp.rb, line 758 def issued s=@h['issued'] l,n=Db[:col_date_text],'date.issued' validate_length(s,l,n) end
keywords()
click to toggle source
# File lib/sisu/dp.rb, line 716 def keywords s=@h['keywords'] l,n=Db[:col_txt_long],'classify.keywords' validate_length(s,l,n) end
language()
click to toggle source
# File lib/sisu/dp.rb, line 319 def language s=@h['language'] l,n=Db[:col_language],'title.language' validate_length(s,l,n) end
language_char()
click to toggle source
# File lib/sisu/dp.rb, line 324 def language_char # look into, this must be set, from 1 directory stub (.fi), 2 filename (~fi), [3 (not used) document header (@title:\n :language_char: fi)] s=@h['language_char'] l,n=Db[:col_language_char],'title.language_char' validate_length(s,l,n) end
license()
click to toggle source
# File lib/sisu/dp.rb, line 581 def license s=@h['license'] \ ? @h['license'] : nil l,n=Db[:col_info_note],'rights.license' validate_length(s,l,n) end
loc()
click to toggle source
# File lib/sisu/dp.rb, line 721 def loc s=@h['loc'] l,n=Db[:col_library],'classify.loc' validate_length(s,l,n) end
main()
click to toggle source
# File lib/sisu/dp.rb, line 285 def main s=@h['main'] l,n=Db[:col_title_part],'title.main' validate_length(s,l,n) end
modified()
click to toggle source
# File lib/sisu/dp.rb, line 763 def modified s=@h['modified'] l,n=Db[:col_date_text],'date.modified' validate_length(s,l,n) end
name_format(name)
click to toggle source
# File lib/sisu/dp.rb, line 216 def name_format(name) if name name=name.strip @name_a_h=[] authors=name.scan(/[^;]+/) authors.each_with_index do |a,i| b=((a =~/\s*\|\s*/) ? (a.split(/\|/)) : [a]) if b[0] =~/"(.+?)"/ @name_a_h << { the: $1 } else x=b[0].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 b.delete_at(0) b.each do |d| k,c=nil k,c=/^(\S+)\s+(.*)/.match(d)[1,2] if d @name_a_h[i][:hon]=c.strip if k=='hon' @name_a_h[i][:affiliation]=c.strip if k=='affiliation' @name_a_h[i][:nationality]=c.strip if k=='nationality' end end l=@name_a_h.length name_str='' @name_a_h.each_with_index do |a,i| name_str += if a[:others] z=(((l - i) > 1) ? ', ' : '') "#{a[:others].strip} #{a[:the].strip}" + z else z=(((l - i) > 2) ? ', ' : '') "#{a[:the].strip}" + z end end { name_a_h: @name_a_h, name_str: name_str } else nil end end
nationality()
click to toggle source
# File lib/sisu/dp.rb, line 836 def nationality s=@h['nationality'] l,n=Db[:col_language],'original.nationality' validate_length(s,l,n) end
note()
click to toggle source
# File lib/sisu/dp.rb, line 300 def note s=@h['note'] l,n=Db[:col_info_note],'title.note' validate_length(s,l,n) end
notes()
click to toggle source
# File lib/sisu/dp.rb, line 843 def notes a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) @h=build_hash(a) def description s=@h['description'] l,n=Db[:col_info_note],'notes.description' validate_length(s,l,n) end def abstract s=@h['abstract'] l,n=Db[:col_info_note],'notes.abstract' validate_length(s,l,n) end def comment s=@h['comment'] l,n=Db[:col_info_note],'notes.comment' validate_length(s,l,n) end def coverage s=@h['coverage'] l,n=Db[:col_info_note],'notes.coverage' validate_length(s,l,n) end def relation s=@h['relation'] l,n=Db[:col_info_note],'notes.relation' validate_length(s,l,n) end def source s=@h['source'] l,n=Db[:col_txt_long],'notes.source' validate_length(s,l,n) end def history s=@h['history'] l,n=Db[:col_txt_long],'notes.history' validate_length(s,l,n) end def type s=@h['type'] l,n=Db[:col_txt_long],'notes.relation' validate_length(s,l,n) end def format s=@h['format'] l,n=Db[:col_txt_short],'notes.format' validate_length(s,l,n) end def prefix @h['prefix'] end self end
oclc()
click to toggle source
# File lib/sisu/dp.rb, line 686 def oclc s=@h['oclc'] l,n=Db[:col_library],'identifier.oclc' validate_length(s,l,n) end
original()
click to toggle source
# File lib/sisu/dp.rb, line 808 def original a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) @h=build_hash(a) def publisher s=@h['publisher'] l,n=Db[:col_name],'original.publisher' validate_length(s,l,n) end def language s=@h['language'] l,n=Db[:col_language],'original.language' validate_length(s,l,n) end def language_char s=@h['language_char'] l,n=Db[:col_language_char],'original.language_char' validate_length(s,l,n) end def source s=@h['source'] l,n=Db[:col_name],'original.source' validate_length(s,l,n) end def institution s=@h['institution'] l,n=Db[:col_name],'original.institution' validate_length(s,l,n) end def nationality s=@h['nationality'] l,n=Db[:col_language],'original.nationality' validate_length(s,l,n) end self end
pg()
click to toggle source
# File lib/sisu/dp.rb, line 696 def pg s=@h['pg'] l,n=Db[:col_small],'identifier.pg' validate_length(s,l,n) end
photographer()
click to toggle source
# File lib/sisu/dp.rb, line 416 def photographer names=@h['photographer'] \ ? name_format(@h['photographer']) : nil s=(names.is_a?(Hash)) \ ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.photographer' validate_length(s,l,n) else nil end end
photographer_detail()
click to toggle source
# File lib/sisu/dp.rb, line 429 def photographer_detail names=@h['photographer'] \ ? name_format(@h['photographer']) : nil (names.is_a?(Hash)) \ ? names[:name_a_h] : nil end
photographs()
click to toggle source
# File lib/sisu/dp.rb, line 558 def photographs s=@h['photographs'] \ ? @h['photographs'] : nil l,n=Db[:col_info_note],'rights.copyright.photographs' validate_length(s,l,n) end
prefix()
click to toggle source
# File lib/sisu/dp.rb, line 891 def prefix @h['prefix'] end
prepared_by()
click to toggle source
# File lib/sisu/dp.rb, line 500 def prepared_by names=@h['prepared_by'] \ ? name_format(@h['prepared_by']) : nil s=(names.is_a?(Hash)) \ ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.prepared_by' validate_length(s,l,n) else nil end end
prepared_by_detail()
click to toggle source
# File lib/sisu/dp.rb, line 513 def prepared_by_detail names=@h['prepared_by'] \ ? name_format(@h['prepared_by']) : nil names=name_format(@h['prepared_by']) (names.is_a?(Hash)) \ ? names[:name_a_h] : nil end
published()
click to toggle source
# File lib/sisu/dp.rb, line 768 def published s=@h['published']=(@h['published'] ? @h['published'] : @h['main']) l,n=Db[:col_date_text],'date.published' validate_length(s,l,n) end
publisher()
click to toggle source
# File lib/sisu/dp.rb, line 733 def publisher a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) @h=build_hash(a) s=@h['main'] l,n=Db[:col_name],'publisher' validate_length(s,l,n) end
relation()
click to toggle source
# File lib/sisu/dp.rb, line 866 def relation s=@h['relation'] l,n=Db[:col_info_note],'notes.relation' validate_length(s,l,n) end
rights()
click to toggle source
# File lib/sisu/dp.rb, line 524 def rights a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) @h=build_hash(a) def copyright def text #you may wish to expand to take from all s=if @h['copyright'] then @h['copyright'] elsif @h['text'] then @h['text'] elsif @h['main'] then @h['main'] else SiSU_Screen::Ansi.new( @opt.act[:color_state][:set], 'WARNING Document Copyright missing; provide @rights: :copyright:' ).warn if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) '' end l,n=Db[:col_info_note],'rights.copyright.text' validate_length(s,l,n) end def translation s=@h['translation'] \ ? @h['translation'] : nil l,n=Db[:col_info_note],'rights.copyright.translation' validate_length(s,l,n) end def illustrations s=@h['illustrations'] \ ? @h['illustrations'] : nil l,n=Db[:col_info_note],'rights.copyright.illustrations' validate_length(s,l,n) end def photographs s=@h['photographs'] \ ? @h['photographs'] : nil l,n=Db[:col_info_note],'rights.copyright.photographs' validate_length(s,l,n) end def digitization s=@h['digitization'] \ ? @h['digitization'] : nil l,n=Db[:col_info_note],'rights.copyright.digitization' validate_length(s,l,n) end def audio s=@h['audio'] \ ? @h['audio'] : nil l,n=Db[:col_info_note],'rights.copyright.audio' validate_length(s,l,n) end self end def license s=@h['license'] \ ? @h['license'] : nil l,n=Db[:col_info_note],'rights.license' validate_length(s,l,n) end def sep(str) ' \\\\ ' end def copyright_and_license s=if @h['copyright_and_license'] then @h['copyright_and_license'] else s='' if defined? copyright.text \ and copyright.text \ and not copyright.text.empty? v=sep(copyright.text) s +=copyright.text + v end if defined? copyright.license \ and copyright.license \ and not copyright.license.empty? s +=copyright.license end if s.empty? SiSU_Screen::Ansi.new( @opt.act[:color_state][:set], 'WARNING Document Rights information missing; provide @rights: :copyright:' ).warn if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) else l,n=Db[:col_info_note],'rights.all' validate_length(s,l,n) end s=s.gsub(/ [\\]+\s+$/,'') end s end def all s=if @h['all'] then @h['all'] else s='' if defined? copyright.text \ and copyright.text \ and not copyright.text.empty? v=sep(copyright.text) s +='Copyright: ' + copyright.text + v end if defined? copyright.translation \ and copyright.translation \ and not copyright.translation.empty? v=sep(copyright.translation) s +='translation: ' + copyright.translation + v end if defined? copyright.illustrations \ and copyright.illustrations \ and not copyright.illustrations.empty? v=sep(copyright.illustrations) s +='illustrations: ' + copyright.illustrations + v end if defined? copyright.photographs \ and copyright.photographs \ and not copyright.photographs.empty? v=sep(copyright.photographs) s +='photographs: ' + copyright.photographs + v end if defined? copyright.digitization \ and copyright.digitization \ and not copyright.digitization.empty? v=sep(copyright.digitization) s +='digitization: ' + copyright.digitization + v end if defined? copyright.audio \ and copyright.audio \ and not copyright.audio.empty? v=sep(copyright.audio) s +='audio: ' + copyright.audio + v end if defined? copyright.license \ and copyright.license \ and not copyright.license.empty? s +='License: ' + copyright.license end if s.empty? SiSU_Screen::Ansi.new( @opt.act[:color_state][:set], 'WARNING Document Rights information missing; provide @rights: :copyright:' ).warn if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) else l,n=Db[:col_info_note],'rights.all' validate_length(s,l,n) end s=s.gsub(/ [\\]+\s+$/,'') end s end self end
sep(str)
click to toggle source
# File lib/sisu/dp.rb, line 588 def sep(str) ' \\\\ ' end
short()
click to toggle source
# File lib/sisu/dp.rb, line 305 def short s=@h['short'] \ ? @h['short'] : @h['main'] l,n=Db[:col_title_part],'title.short' validate_length(s,l,n) end
source()
click to toggle source
# File lib/sisu/dp.rb, line 826 def source s=@h['source'] l,n=Db[:col_name],'original.source' validate_length(s,l,n) end
sub()
click to toggle source
# File lib/sisu/dp.rb, line 290 def sub s=@h['subtitle'] l,n=Db[:col_title_part],'title.subtitle' validate_length(s,l,n) end
subject()
click to toggle source
# File lib/sisu/dp.rb, line 711 def subject s=@h['subject'] l,n=Db[:col_txt_long],'classify.subject' validate_length(s,l,n) end
text()
click to toggle source
# File lib/sisu/dp.rb, line 528 def text #you may wish to expand to take from all s=if @h['copyright'] then @h['copyright'] elsif @h['text'] then @h['text'] elsif @h['main'] then @h['main'] else SiSU_Screen::Ansi.new( @opt.act[:color_state][:set], 'WARNING Document Copyright missing; provide @rights: :copyright:' ).warn if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) '' end l,n=Db[:col_info_note],'rights.copyright.text' validate_length(s,l,n) end
title()
click to toggle source
# File lib/sisu/dp.rb, line 282 def title a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) @h=build_hash(a) def main s=@h['main'] l,n=Db[:col_title_part],'title.main' validate_length(s,l,n) end def sub s=@h['subtitle'] l,n=Db[:col_title_part],'title.subtitle' validate_length(s,l,n) end def edition s=@h['edition'] l,n=Db[:col_title_edition],'title.edition' validate_length(s,l,n) end def note s=@h['note'] l,n=Db[:col_info_note],'title.note' validate_length(s,l,n) end def short s=@h['short'] \ ? @h['short'] : @h['main'] l,n=Db[:col_title_part],'title.short' validate_length(s,l,n) end def full s=@h['subtitle'] \ ? (@h['main'] + ' - ' + @h['subtitle']) : @h['main'] l,n=Db[:col_title],'title.full' validate_length(s,l,n) end def language s=@h['language'] l,n=Db[:col_language],'title.language' validate_length(s,l,n) end def language_char # look into, this must be set, from 1 directory stub (.fi), 2 filename (~fi), [3 (not used) document header (@title:\n :language_char: fi)] s=@h['language_char'] l,n=Db[:col_language_char],'title.language_char' validate_length(s,l,n) end self end
topic_register()
click to toggle source
# File lib/sisu/dp.rb, line 706 def topic_register s=@h['topic_register'] l,n=Db[:col_info_note],'classify.topic_register' validate_length(s,l,n) end
translation()
click to toggle source
# File lib/sisu/dp.rb, line 544 def translation s=@h['translation'] \ ? @h['translation'] : nil l,n=Db[:col_info_note],'rights.copyright.translation' validate_length(s,l,n) end
translator()
click to toggle source
# File lib/sisu/dp.rb, line 437 def translator names=@h['translator'] \ ? name_format(@h['translator']) : nil s=(names.is_a?(Hash)) \ ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.translator' validate_length(s,l,n) else nil end end
translator_detail()
click to toggle source
# File lib/sisu/dp.rb, line 450 def translator_detail names=@h['translator'] \ ? name_format(@h['translator']) : nil (names.is_a?(Hash)) \ ? names[:name_a_h] : nil end
type()
click to toggle source
# File lib/sisu/dp.rb, line 881 def type s=@h['type'] l,n=Db[:col_txt_long],'notes.relation' validate_length(s,l,n) end
valid()
click to toggle source
# File lib/sisu/dp.rb, line 773 def valid s=@h['valid'] l,n=Db[:col_date_text],'date.valid' validate_length(s,l,n) end
validate_length(s,l,n)
click to toggle source
# File lib/sisu/dp.rb, line 197 def validate_length(s,l,n) #s=(s.length <= l) ? s : nil s=if s.is_a?(String) \ and s.length <= l s elsif s.is_a?(NilClass) nil elsif s.class !=String STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}" s else SiSU_Screen::Ansi.new( 'v', "*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped", @opt.fns ).warn unless @opt.act[:quiet][:set]==:on nil end end