Skip to content

Commit

Permalink
Change annotation id URI to match JSON nesting
Browse files Browse the repository at this point in the history
  • Loading branch information
masaball committed May 4, 2022
1 parent 1d70a58 commit f7dcb90
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/iiif_manifest/v3/manifest_builder/content_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ def initialize(display_content, iiif_annotation_factory:, body_builder_factory:)
end

def apply(canvas)
annotation['id'] = canvas['id'].to_s.gsub(/manifest.*/, "annotation/#{annotation.index}")
# Assume first item in canvas is an annotation page
annotation['id'] = "#{canvas.items.first['id']}/annotation/#{annotation.index}"
annotation['target'] = canvas['id']
canvas['width'] = annotation.body['width'] if annotation.body['width'].present?
canvas['height'] = annotation.body['height'] if annotation.body['height'].present?
canvas['duration'] = annotation.body['duration'] if annotation.body['duration'].present?
# Assume first item in canvas is an annotation page
canvas.items.first.items += [annotation]
end

Expand Down

0 comments on commit f7dcb90

Please sign in to comment.