From 361032d47d096c241d562852e71211feb0198b56 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 26 Apr 2010 21:07:14 -0400 Subject: metadata, db sql (table structure), adds OCLC number, and; html metadata, renables showing of topic_register * db (sql) add oclc (Online Computer Library Center) number, affects table structure, (hence breakage & version bump) * new db name prefix "sisu_v2c_"; new pgsql db name prefix "SiSUv2c_" * OCLC == Online Computer Library Center --- lib/sisu/v2/constants.rb | 4 ++-- lib/sisu/v2/db_columns.rb | 26 ++++++++++++++++++++++++-- lib/sisu/v2/db_create.rb | 2 ++ lib/sisu/v2/db_load_tuple.rb | 2 ++ lib/sisu/v2/i18n.rb | 6 ++++++ lib/sisu/v2/manifest.rb | 10 +++++++++- lib/sisu/v2/param.rb | 21 ++++++++++++++++++++- lib/sisu/v2/shared_metadata.rb | 10 ++++++++++ 8 files changed, 75 insertions(+), 6 deletions(-) diff --git a/lib/sisu/v2/constants.rb b/lib/sisu/v2/constants.rb index 8606796a..83914038 100644 --- a/lib/sisu/v2/constants.rb +++ b/lib/sisu/v2/constants.rb @@ -131,8 +131,8 @@ Px[:lv4]= '-' Px[:lv5]= '.' Px[:lv6]= '.' #Px[:lv5_6]= '.' -Db[:name_prefix]="SiSU#{SiSU_version_dir}b_" -Db[:name_prefix_db]="sisu_#{SiSU_version_dir}b_" +Db[:name_prefix]="SiSU#{SiSU_version_dir}c_" +Db[:name_prefix_db]="sisu_#{SiSU_version_dir}c_" Db[:col_title]=800 Db[:col_title_part]=400 Db[:col_title_edition]=10 diff --git a/lib/sisu/v2/db_columns.rb b/lib/sisu/v2/db_columns.rb index 0c2eb367..ba861f4d 100644 --- a/lib/sisu/v2/db_columns.rb +++ b/lib/sisu/v2/db_columns.rb @@ -1425,7 +1425,7 @@ module SiSU_DB_columns end def column_comment %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'metadata classify document library of congress (if available)';} + IS 'metadata classify document Library of Congress';} end def tuple t=if defined? @md.classify.loc \ @@ -1447,7 +1447,7 @@ module SiSU_DB_columns end def column_comment %{COMMENT ON COLUMN metadata_and_text.#{name} - IS 'metadata classify document dewey (if available)';} + IS 'metadata classify document Dewey';} end def tuple t=if defined? @md.classify.dewey \ @@ -1460,6 +1460,28 @@ module SiSU_DB_columns end self end + def classify_oclc + def name + 'classify_oclc' + end + def create_column + "#{name} VARCHAR(#{Db[:col_classify_library]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata classify document Online Computer Library Center number';} + end + def tuple + t=if defined? @md.classify.oclc \ + and @md.classify.oclc=~/\S+/ + txt=@md.classify.oclc + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end def classify_pg def name 'classify_pg' diff --git a/lib/sisu/v2/db_create.rb b/lib/sisu/v2/db_create.rb index c7ce9a6d..f6c2e50f 100644 --- a/lib/sisu/v2/db_create.rb +++ b/lib/sisu/v2/db_create.rb @@ -166,6 +166,7 @@ module SiSU_DB_create #{column.classify_type.create_column} #{column.classify_loc.create_column} #{column.classify_dewey.create_column} + #{column.classify_oclc.create_column} #{column.classify_pg.create_column} #{column.classify_isbn.create_column} #{column.classify_format.create_column} @@ -418,6 +419,7 @@ module SiSU_DB_create %{#{column.classify_type.column_comment}}, %{#{column.classify_loc.column_comment}}, %{#{column.classify_dewey.column_comment}}, + %{#{column.classify_oclc.column_comment}}, %{#{column.classify_pg.column_comment}}, %{#{column.classify_isbn.column_comment}}, %{#{column.classify_format.column_comment}}, diff --git a/lib/sisu/v2/db_load_tuple.rb b/lib/sisu/v2/db_load_tuple.rb index 67c8008f..f1af99a0 100644 --- a/lib/sisu/v2/db_load_tuple.rb +++ b/lib/sisu/v2/db_load_tuple.rb @@ -176,6 +176,7 @@ module SiSU_DB_tuple #{@tp.column.classify_type.tuple[0]} #{@tp.column.classify_loc.tuple[0]} #{@tp.column.classify_dewey.tuple[0]} +#{@tp.column.classify_oclc.tuple[0]} #{@tp.column.classify_pg.tuple[0]} #{@tp.column.classify_isbn.tuple[0]} #{@tp.column.classify_format.tuple[0]} @@ -259,6 +260,7 @@ tid) #{@tp.column.classify_type.tuple[1]} #{@tp.column.classify_loc.tuple[1]} #{@tp.column.classify_dewey.tuple[1]} +#{@tp.column.classify_oclc.tuple[1]} #{@tp.column.classify_pg.tuple[1]} #{@tp.column.classify_isbn.tuple[1]} #{@tp.column.classify_format.tuple[1]} diff --git a/lib/sisu/v2/i18n.rb b/lib/sisu/v2/i18n.rb index e65e3717..1f81a941 100644 --- a/lib/sisu/v2/i18n.rb +++ b/lib/sisu/v2/i18n.rb @@ -213,6 +213,9 @@ module SiSU_Translate def cls_dewey @lang_class.cls_dewey end + def cls_oclc + @lang_class.cls_oclc + end def cls_gutenberg @lang_class.cls_gutenberg end @@ -428,6 +431,9 @@ module SiSU_Translate def cls_dewey 'Classify Dewey' end + def cls_oclc + 'Classify OCLC number' + end def cls_gutenberg 'Classify Project Gutenberg' end diff --git a/lib/sisu/v2/manifest.rb b/lib/sisu/v2/manifest.rb index c1da4ccb..85881263 100644 --- a/lib/sisu/v2/manifest.rb +++ b/lib/sisu/v2/manifest.rb @@ -485,6 +485,13 @@ module SiSU_Manifest id,info=@translate.cls_dewey,@md.classify.dewey metadata(id,info) end + if defined? @md.classify.oclc \ + and @md.classify.oclc=~/\S+/ + id,info=@translate.cls_oclc,@md.classify.oclc + @manifest[:html] << %{

#{id}:

\n} + @manifest[:html] << %{

#{info}

\n} + @manifest[:html] << %{\n} + end if defined? @md.classify.pg \ and @md.classify.pg=~/\S+/ id,info=@translate.cls_gutenberg,@md.classify.pg @@ -505,7 +512,8 @@ module SiSU_Manifest id,info=@translate.prefix_b,@md.notes.prefix_b metadata(id,info) end - if @md.topic_register_array.length > 1 + if defined? @md.topic_register_array \ + and @md.topic_register_array.length > 0 @manifest[:html] << %{

#{@translate.topic_register}:

\n} @md.topic_register_array.each do |t| t.each_with_index do |st,i| diff --git a/lib/sisu/v2/param.rb b/lib/sisu/v2/param.rb index 87dd9aab..bf32fc59 100644 --- a/lib/sisu/v2/param.rb +++ b/lib/sisu/v2/param.rb @@ -514,6 +514,11 @@ module SiSU_Param l,n=Db[:col_classify_library],'classify.dewey' validate_length(s,l,n) end + def oclc + s=@h['oclc'] + l,n=Db[:col_classify_library],'classify.oclc' + validate_length(s,l,n) + end def pg s=@h['pg'] l,n=Db[:col_classify_small],'classify.pg' @@ -927,7 +932,7 @@ module SiSU_Param l=determine_papersize(l.dup) @papersize=l end - when /^@make:(.+)/m #% metainfo DC + when /^@make:(.+)/m #% metainfo DC @make=Md.new($1.strip,@opt).make if defined? @make.breaks \ and @make.breaks[:page_new] #clearpage @@ -1097,6 +1102,20 @@ module SiSU_Param @rights=Md_default.new.rights("[#{@creator.author}]",'') end end + if defined? @classify.topic_register \ + and @classify.topic_register.length >3 + topic_register=@classify.topic_register + 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 + @topic_register_array.sort! + end if @markup_version.to_f >= 0.38 #convert values in headers to internal representation translated=[] translate_list=[@pagenew,@pagebreak,@num_top,@toc_lev_limit] diff --git a/lib/sisu/v2/shared_metadata.rb b/lib/sisu/v2/shared_metadata.rb index 07f87e2c..bd1fe73a 100644 --- a/lib/sisu/v2/shared_metadata.rb +++ b/lib/sisu/v2/shared_metadata.rb @@ -633,6 +633,11 @@ WOK tag,inf=tr.date,@md.date.published meta << meta_para(tag,inf) end + if defined? @md.classify.topic_register \ + and @md.classify.topic_register=~/\S+/ + tag,inf=tr.topic_register,@md.classify.topic_register + meta << meta_para(tag,inf) + end if defined? @md.classify.loc \ and @md.classify.loc=~/\S+/ tag,inf=tr.cls_loc,@md.classify.loc @@ -643,6 +648,11 @@ WOK tag,inf=tr.cls_dewey,@md.classify.dewey meta << meta_para(tag,inf) end + if defined? @md.classify.oclc \ + and @md.classify.oclc=~/\S+/ + tag,inf=tr.cls_oclc,@md.classify.oclc + meta << meta_para(tag,inf) + end if defined? @md.classify.pg \ and @md.classify.pg=~/\S+/ tag,inf=tr.cls_gutenberg,@md.classify.pg -- cgit v1.2.3