lib/populate_tpl_from_coll_info.rb
############################################################################
# CUSTOMISE this method to extract volume no, issue no, year, etc from
# your DSpace collection name
CUSTOMISE this method to extract volume no, issue no, year, etc from
your DSpace collection name
CUSTOMISE this method to extract volume no issue no year etc from your DSpace collection name
def gather_extra_collection_fields
    xcf = @extra_collection_fields
    @collection_fields["collection_name"].match(COLLECTION_NAME_REGEX)
    xcf[:volume_num] = $1
    xcf[:issue_num]  = $3
    xcf[:month_name] = $4
    xcf[:year]       = $5
    yyyy = xcf[:year].to_i
    if YEAR_RANGE.include?(yyyy) && xcf[:month_name].match(MONTH_NAME_REGEX)
      date_str = "1 #{xcf[:month_name]} #{yyyy}"	
      xcf[:date_from_collection_name] = Date.parse(date_str).strftime("%Y-%m-%d")
    end
    EXTRA_COLLECTION_FIELD_KEYS.each{|k|
      STDERR.puts "WARNING: #{k} is empty" if xcf[k].nil? || xcf[k].empty?
    }
  end
def gather_extra_collection_fields xcf = @extra_collection_fields @collection_fields [ "collection_name" ] . match ( COLLECTION_NAME_REGEX ) xcf [ :volume_num ] = $1 xcf [ :issue_num ] = $3 xcf [ :month_name ] = $4 xcf [ :year ] = $5 yyyy = xcf [ :year ] . to_i if YEAR_RANGE . include? ( yyyy ) && xcf [ :month_name ] . match ( MONTH_NAME_REGEX ) date_str = "1 #{xcf[:month_name]} #{yyyy}" xcf [ :date_from_collection_name ] = Date . parse ( date_str ) . strftime ( "%Y-%m-%d" ) end EXTRA_COLLECTION_FIELD_KEYS . each { | k | STDERR . puts "WARNING: #{k} is empty" if xcf [ k ] . nil? || xcf [ k ] . empty? } end
CUSTOMISE this method to extract volume no, issue no, year, etc from
your DSpace collection name
CUSTOMISE this method to extract volume no issue no year etc from your DSpace collection name
# Eg. "1 August 2016"