Skip to content

Commit

Permalink
fix(viewer2): tried to improved the citation formation of a page of t…
Browse files Browse the repository at this point in the history
…he edition according to Chicago styleguide. Also added the whole KDL team members as editors.
  • Loading branch information
geoffroy-noel-ddh committed May 18, 2024
1 parent 29cbe22 commit 00e0a40
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions frontend/assets/js/text-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,19 @@ function setUpTextViewer() {
let panel = this.selectedPanel;
let ret = "";
if (panel) {
let pageNumber = panel.selections.locus.replace(/\D+/g, "");
let format = { year: "numeric", month: "long", day: "numeric" };
let today = new Date().toLocaleDateString("en-GB", format);
ret = `Cordelia Beattie, Suzanne Trill, Joanne Edge, Sharon Howard. '${
panel.selectors.document[panel.selections.document]
}, ${
panel.selectors.view[panel.selections.view]
} edition, p. ${pageNumber}'. Alice Thornton's Books. Accessed ${today}. https://thornton.kdl.kcl.ac.uk/books/viewer2/?${this.getQueryStringFromPanelIdx(
let editors =
"Cordelia Beattie, Suzanne Trill, Joanne Edge, Sharon Howard, Paul Caton, Ginestra Ferraro, Geoffroy Noël, Tiffany Ong, Priyal Shah";
let book = panel.selectors.document[panel.selections.document];
let version = panel.selectors.view[panel.selections.view];
let pageNumber = panel.selections.locus.replace(/\D+/g, "");
let url = `https://thornton.kdl.kcl.ac.uk/edition/?${this.getQueryStringFromPanelIdx(
this.selection.selectedPanelIndex,
true
)}`;
// ret = `${editors}. '${book}, ${version} edition, p. ${pageNumber}'. Alice Thornton's Books. Accessed ${today}. ${url}`;
ret = `Alice Thornton, <em>${book}</em>, ${version} edition by ${editors}, ${pageNumber}. 2024. <br> ${url} (accessed ${today})`;
}
return ret;
},
Expand Down Expand Up @@ -215,7 +217,7 @@ function setUpTextViewer() {
},
onClickCopyCitation() {
let citation = this.selectedPanelCitation;
navigator.clipboard.writeText(citation);
navigator.clipboard.writeText(citation.replace(/<[^>]+>/g, ""));
},
isControlHidden(controlKey) {
return (
Expand Down
2 changes: 1 addition & 1 deletion frontend/edition/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ eleventyNavigation:
<h2>Citation</h2>
<p>Cite the Research team that worked on this page of the digital edition</p>
<div class="citation">
<p>{{ selectedPanelCitation }}</p>
<p v-html="selectedPanelCitation"></p>
<button class="button is-secondary" @click="onClickCopyCitation()"><i class="far fa-copy"></i> &nbsp;
Copy</button>
</div>
Expand Down

0 comments on commit 00e0a40

Please sign in to comment.