-
Notifications
You must be signed in to change notification settings - Fork 825
New Translator: Château de VersaillesAdd files via upload #3481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Allow to integrate into your Zotero Library items from the Collections of the Château de Versailles' website.
@@ -0,0 +1,121 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Scaffold to create a translator. You can have ChatGPT generate sections, but as is, this isn't a valid translator:
- License text is wrong
- License text is above the metadata block (metadata block needs to be the very first thing in the file)
Create a new translator in Scaffold and add the Web Translator template (toolbar Plus button in the Code tab).
{ | ||
"translatorID": "7ae64474-9f23-4d2c-9995-dfe8c5010c4b", | ||
"label": "ChateauVersailles", | ||
"creator": "OpenAI / Alexandre MENISSEZ", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenAI doesn't get credit (or blame) for code we merge. creator
should just be the human who worked on the code.
"translatorID": "7ae64474-9f23-4d2c-9995-dfe8c5010c4b", | ||
"label": "ChateauVersailles", | ||
"creator": "OpenAI / Alexandre MENISSEZ", | ||
"target": "^https://collections\\.chateauversailles\\.fr/\\#/query/.*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"target": "^https://collections\\.chateauversailles\\.fr/\\#/query/.*", | |
"target": "^https://collections\\.chateauversailles\\.fr/", |
"creator": "OpenAI / Alexandre MENISSEZ", | ||
"target": "^https://collections\\.chateauversailles\\.fr/\\#/query/.*", | ||
"minVersion": "3.0", | ||
"maxVersion": "6.999", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this doesn't work. Use Scaffold to create a new translator and copy your code (everything below the metadata block) into the Code tab.
item.attachments.push({ | ||
title: "Image de l'œuvre", | ||
mimeType: "image/jpeg", | ||
url: new URL(img.getAttribute("src"), url).href, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
url: new URL(img.getAttribute("src"), url).href, | |
url: img.src, |
let abstractParts = []; | ||
let commentaireNode = doc.querySelector("div.commentaire-chef-doeuvre") || [...doc.querySelectorAll("div")].find(el => el.textContent.includes("Commentaire")); | ||
if (commentaireNode) { | ||
let texte = commentaireNode.textContent.trim().replace(/\s+/g, " "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let texte = commentaireNode.textContent.trim().replace(/\s+/g, " "); | |
let texte = ZU.trimInternal(commentaireNode.textContent); |
|
||
let historiqueNode = [...doc.querySelectorAll("div")].find(el => el.textContent.includes("Historique")); | ||
if (historiqueNode) { | ||
let texte = historiqueNode.textContent.trim().replace(/\s+/g, " "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let texte = historiqueNode.textContent.trim().replace(/\s+/g, " "); | |
let texte = ZU.trimInternal(historiqueNode.textContent); |
|
||
item.libraryCatalog = "Château de Versailles Collections"; | ||
item.language = "fr"; | ||
item.publisher = "Château de Versailles"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
artwork
doesn't have a publisher
field, and this would probably create an incorrect citation. archive
would be better.
|
||
{ | ||
"translatorID": "7ae64474-9f23-4d2c-9995-dfe8c5010c4b", | ||
"label": "ChateauVersailles", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"label": "ChateauVersailles", | |
"label": "Château de Versailles", |
And rename the file to Château de Versailles.js
(Scaffold will do this for you).
item.url = url; | ||
|
||
item.complete(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests (Scaffold can help with that - load a page in the browser and click Create Web Test).
Allow to integrate into your Zotero Library items from the Collections of the Château de Versailles' website.
Hello,
This adds a new translator for the Château de Versailles collections website (collections.chateauversailles.fr).
It correctly imports artwork metadata, including title, artist, date, and combines the "Commentaire" and "Historique" sections into the abstract field.
Example URL: https://collections.chateauversailles.fr/#/query/efca7ba3-35b6-4624-af48-b6ca0838b5e5