Skip to content

Commit

Permalink
Refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
markpbaggett committed Dec 9, 2024
1 parent 4d4f9f5 commit 32f2777
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
3 changes: 3 additions & 0 deletions docs/recipes/0033-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
| **JSON-LD:** | [https://iiif.io/api/cookbook/recipe/0033-choice/manifest.json](https://iiif.io/api/cookbook/recipe/0033-choice/manifest.json) |

### Method 1 -
```python
--8<-- "docs/recipes/scripts/0033-choice-method1.py"
```
20 changes: 12 additions & 8 deletions docs/recipes/scripts/0033-choice-method1.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
)
canvas = manifest.make_canvas(
id=f"{base_url}/page/p1/1",
height=1271,
width=2000
)

natural_light = ResourceItem(
Expand Down Expand Up @@ -40,14 +42,16 @@
choice = Choice(
items=[natural_light, x_ray],
)
canvas.add_annotation(
anno_page_id=f"{base_url}/page/p1/1",
annotation=Annotation(
id=f"{base_url}/annotation/p0001-image",
motivation="painting",
body=choice,
target=f"{base_url}/canvas/p1"
),
anno_page = AnnotationPage(
id=f"{base_url}/page/p1/1",
)
anno = Annotation(
id=f"{base_url}/annotation/p0001-image",
motivation="painting",
body=choice,
target=canvas.id
)
canvas.add_item(anno_page)
anno_page.add_item(anno)

print(manifest.json(indent=2))

0 comments on commit 32f2777

Please sign in to comment.