@harvard-lts/mirador-eda-plugin 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/pull_request_template.md +31 -0
- package/.github/workflows/publish-package.yml +34 -0
- package/.nvmrc +1 -0
- package/.parcelrc +9 -0
- package/.travis.yml +16 -0
- package/CONTRIBUTING.md +20 -0
- package/LICENSE +201 -0
- package/README.md +175 -0
- package/__mocks__/fileMock.js +1 -0
- package/babel.config.json +11 -0
- package/demo/data/manifest-3037.json +524 -0
- package/demo/data/manifest-5f3b.json +315 -0
- package/demo/data/manifest-609.json +500 -0
- package/demo/data/ms_am_1118_3_142_0001.jpg +0 -0
- package/demo/data/ms_am_1118_3_142_0002.jpg +0 -0
- package/demo/data/ms_am_1118_3_142_0003.jpg +0 -0
- package/demo/demoEntry.js +21 -0
- package/demo/index.html +23 -0
- package/dist/es/index.js +535 -0
- package/jest.config.js +23 -0
- package/nwb.config.js +20 -0
- package/package.json +73 -0
- package/rollup.config.mjs +12 -0
- package/setupTests.js +1 -0
- package/src/index.js +10 -0
- package/src/plugins/EdaSideBarButtonsWrapper.js +51 -0
- package/src/plugins/EdaTranscriptionButton.js +19 -0
- package/src/plugins/EdaTranscriptionPanel.js +245 -0
- package/src/plugins/__tests__/EdaSideBarButtonsWrapper.spec.js +183 -0
- package/src/plugins/__tests__/EdaTranscriptionButton.spec.js +17 -0
- package/src/plugins/__tests__/EdaTranscriptionPanel.spec.js +188 -0
- package/src/plugins/__tests__/edaManifest.spec.js +110 -0
- package/src/plugins/__tests__/nonEdaManifest.spec.js +64 -0
- package/src/plugins/__tests__/transcriptionUtils.spec.js +430 -0
- package/src/plugins/testFixtures/combinedEditionsTranscriptions.js +62 -0
- package/src/plugins/testFixtures/franklinVariorum1998Transcription.js +85 -0
- package/src/plugins/testFixtures/johnsonPoems1955Transcription.js +88 -0
- package/src/plugins/transcriptionUtils.js +114 -0
- package/src/plugins/utils/suppressWarnings.js +41 -0
- package/webpack.config.cjs +56 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
**The title of this pull-request should be a brief description of what the pull-request fixes/improves/changes. Ideally 50 characters or less.**
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
**JIRA Ticket**: (link)
|
|
6
|
+
|
|
7
|
+
- Other Relevant Links (Mailing list discussion, related pull requests, etc.)
|
|
8
|
+
|
|
9
|
+
# What does this Pull Request do?
|
|
10
|
+
|
|
11
|
+
A brief description of what the intended result of the PR will be and/or what problem it solves.
|
|
12
|
+
|
|
13
|
+
# How should this be tested?
|
|
14
|
+
|
|
15
|
+
A description of what steps someone could take to:
|
|
16
|
+
|
|
17
|
+
- Reproduce the problem you are fixing (if applicable)
|
|
18
|
+
- Test that the Pull Request does what is intended.
|
|
19
|
+
- Please be as detailed as possible.
|
|
20
|
+
- Good testing instructions help get your PR completed faster.
|
|
21
|
+
|
|
22
|
+
# Test coverage
|
|
23
|
+
|
|
24
|
+
Yes/No: Are changes in this pull-request covered by:
|
|
25
|
+
|
|
26
|
+
- unit tests?
|
|
27
|
+
- integration tests?
|
|
28
|
+
|
|
29
|
+
# Interested parties
|
|
30
|
+
|
|
31
|
+
Tag (@ mention) interested parties
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Publish to npmjs on release
|
|
2
|
+
on:
|
|
3
|
+
release:
|
|
4
|
+
types: [published]
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
publish:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
|
|
10
|
+
steps:
|
|
11
|
+
- name: Checkout repository
|
|
12
|
+
uses: actions/checkout@v4
|
|
13
|
+
with:
|
|
14
|
+
fetch-depth: 0
|
|
15
|
+
|
|
16
|
+
- name: Compare the tag and version
|
|
17
|
+
run: |
|
|
18
|
+
NODE_VERSION=$(node -p -e "require('./package.json').version")
|
|
19
|
+
LATEST_TAG=$(git describe --tags --abbrev=0)
|
|
20
|
+
if [ "v$NODE_VERSION" != $LATEST_TAG ]; then echo "Github tag ($LATEST_TAG) and version ($NODE_VERSION) don't match" && exit 1; fi
|
|
21
|
+
|
|
22
|
+
- name: Set up Node.js
|
|
23
|
+
uses: actions/setup-node@v4
|
|
24
|
+
with:
|
|
25
|
+
node-version: 18
|
|
26
|
+
registry-url: "https://registry.npmjs.org"
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: npm ci
|
|
30
|
+
|
|
31
|
+
- name: Publish to npm
|
|
32
|
+
run: npm publish --access=public
|
|
33
|
+
env:
|
|
34
|
+
NODE_AUTH_TOKEN: ${{ secrets.LTS_NPM_TOKEN }}
|
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
lts/hydrogen
|
package/.parcelrc
ADDED
package/.travis.yml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
sudo: false
|
|
2
|
+
|
|
3
|
+
language: node_js
|
|
4
|
+
node_js:
|
|
5
|
+
- 18
|
|
6
|
+
|
|
7
|
+
before_install:
|
|
8
|
+
- npm install codecov.io coveralls
|
|
9
|
+
|
|
10
|
+
after_success:
|
|
11
|
+
- cat ./coverage/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js
|
|
12
|
+
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
|
|
13
|
+
|
|
14
|
+
branches:
|
|
15
|
+
only:
|
|
16
|
+
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
## Prerequisites
|
|
2
|
+
|
|
3
|
+
Check the `.nvmrc` file for the requisite node version
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
- Running `npm install` in the component's root directory will install everything you need for development.
|
|
8
|
+
|
|
9
|
+
## Running Tests
|
|
10
|
+
|
|
11
|
+
- `npm test` will run the tests once.
|
|
12
|
+
|
|
13
|
+
- `npm run test:coverage` will run the tests and produce a coverage report in `coverage/`.
|
|
14
|
+
|
|
15
|
+
- `npm run test:watch` will run the tests on every change.
|
|
16
|
+
|
|
17
|
+
## Building
|
|
18
|
+
|
|
19
|
+
- `npm run build` will build the component for publishing to npm and also bundle the demo app.
|
|
20
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Mirador EDA Plugin
|
|
2
|
+
|
|
3
|
+
A Mirador 3 plugin for displaying Emily Dickinson Archive (EDA) transcriptions with toggleable line breaks and editorial marks. This plugin replicates the viewing experience of [edickinson.org](https://www.edickinson.org) while gracefully handling non-Emily Dickinson manifests.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Edition Switcher**: Dropdown to switch between different editions (e.g., Franklin Variorum 1998, Johnson Poems 1955)
|
|
8
|
+
- **Line Break Toggle**: Show/hide physical line breaks in the manuscript (shows metric line breaks by default)
|
|
9
|
+
- **Editorial Marks Toggle**: Show/hide editorial marks and textual variants (hided edits by default)
|
|
10
|
+
- **HTML Rendering**: Full support for HTML tags including `ruby`, `ins`, `em`, `strong`, `br`, and more
|
|
11
|
+
- **Textual Variants**: Display alternate readings and editorial choices
|
|
12
|
+
- **EDA Icon**: Custom fern ornament icon in the sidebar
|
|
13
|
+
- **Smart Manifest Handling**: Automatically detects Emily Dickinson content and only shows the transcription button when relevant while hiding the default Annotations button
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
- [NVM](https://github.com/nvm-sh/nvm)
|
|
18
|
+
- Node.js 14+
|
|
19
|
+
- Mirador 3.x
|
|
20
|
+
|
|
21
|
+
## Setup
|
|
22
|
+
|
|
23
|
+
1. Run `npm i` to install dependencies
|
|
24
|
+
2. Use one of the [NPM scripts](#npm-scripts) to perform the actions described below.
|
|
25
|
+
|
|
26
|
+
## NPM scripts
|
|
27
|
+
|
|
28
|
+
The following are some useful scripts can be ran using `npm run <script>`. A full list can be seen in [package.json](./package.json)
|
|
29
|
+
|
|
30
|
+
| Script | Description |
|
|
31
|
+
| ------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| `build` | Builds the source files into the `./dist` directory |
|
|
33
|
+
| `serve` | Spins up the local development server at http://localhost:9000 |
|
|
34
|
+
| `test` | Runs the test suite |
|
|
35
|
+
|
|
36
|
+
## Installing in Mirador
|
|
37
|
+
|
|
38
|
+
The `@harvard-lts/mirador-eda-plugin` requires an instance of Mirador 3. Visit the [Mirador wiki](https://github.com/ProjectMirador/mirador/wiki) to learn how to [install an existing plugin](https://github.com/ProjectMirador/mirador/wiki/Mirador-3-plugins#installing-an-existing-plugin) and for additional information about plugins.
|
|
39
|
+
|
|
40
|
+
### Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm i @harvard-lts/mirador-eda-plugin
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Emily Dickinson Archive IIIF Manifest
|
|
47
|
+
|
|
48
|
+
For the plugin to show transcriptions, your IIIF manifest should include annotations with the following structure:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"annotations": [
|
|
53
|
+
{
|
|
54
|
+
"id": "annotation_page_id",
|
|
55
|
+
"type": "AnnotationPage",
|
|
56
|
+
"items": [
|
|
57
|
+
{
|
|
58
|
+
"id": "annotation_id",
|
|
59
|
+
"type": "Annotation",
|
|
60
|
+
"motivation": "commenting",
|
|
61
|
+
"body": {
|
|
62
|
+
"type": "Text",
|
|
63
|
+
"language": "en",
|
|
64
|
+
"format": "text/html",
|
|
65
|
+
"value": "<div class=\"work-body\" data-exhibit=\"emily-dickinson-archive\" data-edition=\"Edition Name\">...</div>"
|
|
66
|
+
},
|
|
67
|
+
"target": "canvas_id"
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Important:** The plugin specifically looks for the `data-exhibit="emily-dickinson-archive"` attribute to identify Emily Dickinson transcriptions.
|
|
76
|
+
|
|
77
|
+
### Non-Emily Dickinson Manifests
|
|
78
|
+
|
|
79
|
+
For non-Emily Dickinson manifests, the plugin will automatically:
|
|
80
|
+
|
|
81
|
+
1. Hide the transcription button from the sidebar
|
|
82
|
+
2. If a user somehow activates the panel (via API or programmatically), it will display a helpful message explaining that transcriptions are only available for Emily Dickinson content
|
|
83
|
+
|
|
84
|
+
### Supported HTML Tags
|
|
85
|
+
|
|
86
|
+
The plugin supports the following HTML tags and classes:
|
|
87
|
+
|
|
88
|
+
- **Required attributes**: `data-exhibit="emily-dickinson-archive"` on `.work-body`
|
|
89
|
+
- **Edition identification**: `data-edition` attribute on `.work-body`
|
|
90
|
+
- **Line breaks**: `<br class="emily">` and `<br class="emily author">`
|
|
91
|
+
- **Textual variants**: `<ruby>`, `<rt>`, `<rp>` tags
|
|
92
|
+
- **Alternate readings**: `<ins class="alternate">`
|
|
93
|
+
- **Text formatting**: `<em>`, `<strong>`, `<p>`, `<span>`
|
|
94
|
+
- **Stanzas**: Elements with `class="stanza"`
|
|
95
|
+
- **Lines**: Elements with `class="line"`
|
|
96
|
+
|
|
97
|
+
## Plugin Architecture
|
|
98
|
+
|
|
99
|
+
The plugin consists of these main components:
|
|
100
|
+
|
|
101
|
+
1. **EdaTranscriptionButton**: Adds the EDA icon to the sidebar (only visible for EDA manifests)
|
|
102
|
+
2. **EdaTranscriptionPanel**: Displays the transcription content with controls
|
|
103
|
+
3. **EdaTranslationOverrideWrapper**: Provides translation and configuration
|
|
104
|
+
4. **transcriptionUtils**: Utility functions for extracting transcriptions from manifests
|
|
105
|
+
|
|
106
|
+
## Development
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Install dependencies
|
|
110
|
+
npm i
|
|
111
|
+
|
|
112
|
+
# Start development server
|
|
113
|
+
npm run serve
|
|
114
|
+
|
|
115
|
+
# Run tests
|
|
116
|
+
npm test
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The development server will start at http://localhost:9000 and automatically reload when you make changes.
|
|
120
|
+
|
|
121
|
+
### Compatibility Notes
|
|
122
|
+
|
|
123
|
+
The plugin includes a warning suppression utility for versions of Mirador prior to 4.0.0 that use a deprecated Material-UI Badge prop. This suppression:
|
|
124
|
+
|
|
125
|
+
- Suppresses the `overlap="rectangle"` deprecation warning
|
|
126
|
+
- Notes if the suppression file is no longer needed
|
|
127
|
+
- Can be deleted once this app is upgraded to Mirador version 4.0.0 or later where the issue is fixed
|
|
128
|
+
|
|
129
|
+
The warning suppression is implemented in `src/plugins/utils/suppressWarnings.js`.
|
|
130
|
+
|
|
131
|
+
### Testing
|
|
132
|
+
|
|
133
|
+
The plugin includes comprehensive tests using Jest and React Testing Library. The test suite is organized by responsibility:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Run all tests
|
|
137
|
+
npm test
|
|
138
|
+
|
|
139
|
+
# Run specific test files
|
|
140
|
+
npm test src/plugins/__tests__/[filename].spec.js
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Test Files and Responsibilities:
|
|
144
|
+
|
|
145
|
+
#### Component Tests
|
|
146
|
+
- `EdaTranscriptionButton.spec.js` - Tests button rendering, visibility, and interaction
|
|
147
|
+
- `EdaTranscriptionPanel.spec.js` - Tests panel UI, transcription display, and controls
|
|
148
|
+
- `EdaSideBarButtonsWrapper.spec.js` - Tests sidebar button container and layout
|
|
149
|
+
|
|
150
|
+
#### Manifest Tests
|
|
151
|
+
- `edaManifest.spec.js` - Tests Emily Dickinson manifest handling and transcription extraction
|
|
152
|
+
- `nonEdaManifest.spec.js` - Tests non-Emily Dickinson manifest behavior
|
|
153
|
+
- `transcriptionUtils.spec.js` - Tests utility functions for transcription processing
|
|
154
|
+
|
|
155
|
+
#### Test Fixtures
|
|
156
|
+
Organized by edition in `testFixtures/`:
|
|
157
|
+
- `johnsonPoems1955Transcription.js` - Johnson 1955 edition samples
|
|
158
|
+
- `franklinVariorum1998Transcription.js` - Franklin Variorum 1998 samples
|
|
159
|
+
- `combinedEditionsTranscriptions.js` - Multi-edition test cases
|
|
160
|
+
|
|
161
|
+
Testing Philosophy:
|
|
162
|
+
- Component tests focus on user interaction and rendering
|
|
163
|
+
- Manifest tests verify data handling and structure
|
|
164
|
+
- Each test file has a single responsibility
|
|
165
|
+
- Mocks are used judiciously to isolate functionality
|
|
166
|
+
- React Testing Library encourages testing user behavior over implementation
|
|
167
|
+
|
|
168
|
+
## Demo
|
|
169
|
+
|
|
170
|
+
The plugin includes a demo environment with sample manifests:
|
|
171
|
+
|
|
172
|
+
1. Emily Dickinson Archive manifest (`data/manifest-3037.json` and `data/manifest-609.json`)
|
|
173
|
+
2. Non-Emily Dickinson manifest from Harvard (`https://iiif.lib.harvard.edu/manifests/ids:488815`)
|
|
174
|
+
|
|
175
|
+
To switch between them, edit the `manifestId` in `demo/demoEntry.js`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = "mock-file-stub"
|