Skip to content

Commit

Permalink
update manifest creation
Browse files Browse the repository at this point in the history
  • Loading branch information
dnoneill committed Sep 5, 2019
1 parent 04443a0 commit 346a226
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ collections:
source: 'objects.csv' # path to the metadata file, must be within '_data'
images:
source 'source_images/objects' # path to the directory of source images, must be within '_data'
iiif_config: #allows for custom iiif fields to be defined. Only important for the created manifest.
attribution: attribution_field #by default 'attribution'. This does not need to be set if the metadata has a field named 'attribution'
description: description_field #by default 'description'
label: title_field #by default 'label' field, when no label field 'pid' field
skip_keys: #list of fields which should not go in the manifest 'metadata' field. This can also be set to a string of 'all' and no metadata field will be created. Default fields skipped: ['manifest', 'thumbnail', 'full', 'pid', 'order', 'label', 'layout']
- title
- manifest



# wax search index settings
lunr_index:
Expand Down
37 changes: 27 additions & 10 deletions lib/wax_tasks/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,28 +68,45 @@ def logo
end

def label
label_key = @iiif_config&.dig 'label'
if @record && label_key
@record.hash.dig label_key
else
@pid
end
label_key = @iiif_config&.dig 'label' if @iiif_config
label_key ||= 'label'
label = @record.hash.dig label_key if @record && label_key
label ||= @pid
label
end

#
#
def description
description_key = @iiif_config&.dig 'description'
description_key = @iiif_config&.dig 'description' if @iiif_config
description_key ||= 'description'
@record.hash.dig description_key if description_key && @record
end

#
#
def attribution
attribution_key = @iiif_config.dig 'attribution'
attribution_key = @iiif_config.dig 'attribution' if @iiif_config
attribution_key ||= 'attribution'
@record.hash.dig attribution_key if attribution_key && @record
end

#
#
def metadata
csv_metadata = []
skip_keys = @iiif_config.dig 'skipkeys' if @iiif_config
skip_keys ||= %w[manifest thumbnail full pid order label layout]
if @record.hash.class == Hash && skip_keys != 'all'
@record.hash.each do |key, value|
unless skip_keys.include? key
csv_metadata.push('label': key, 'value': value)
end
end
end
csv_metadata
end

#
#
def iiif_image_records
Expand All @@ -105,11 +122,11 @@ def iiif_image_records
#
def base_opts
opts = { label: label }
return opts unless @iiif_config

opts[:logo] = logo if logo

opts[:description] = description.to_s if description
opts[:attribution] = attribution.to_s if attribution
opts[:metadata] = metadata if metadata
opts
end
end
Expand Down

0 comments on commit 346a226

Please sign in to comment.