using a self-made translator
I'm struggling to make a translator for the dansih legal site www.retsinformation.dk.
So far, I've managed to scrape metadata from the webpage and into an object that I have constructed with like this:
var newItem = new Zotero.Item("statute");
newItem.title = getTitle(doc, url);
newItem.shortTitle = infoArray[0];
newItem.dateEnacted = statuteInfo[1];
newItem.publicLawNumber = statuteInfo[0];
newItem.complete();
When I 'Run doWeb' in Scaffold I get this output:
10:24:37 Returned item:
{
"itemType": "statute"
"creators": []
"notes": []
"tags": []
"seeAlso": []
"attachments": []
- "title": "Bekendtgørelse af lov om forbud mod forskelsbehandling på arbejdsmarkedet m.v. 1)"
"shortTitle": "Forskelsbehandlingsloven"
"dateEnacted": "16/12/2008"
"publicLawNumber": "LBK nr 1349"
- "libraryCatalog": "Retsinformation"
+ "nameOfAct": "Bekendtgørelse af lov om forbud mod forskelsbehandling på arbejdsmarkedet m.v. 1)"
}
10:24:37 Translation successful
This all look fine to me, but the Zotero icon in the menu doesn't change, it's still set to web page, and I can't choose to save as a statute.
It's probably just some minor oversight on my part, but I'm pretty stumped.
So far, I've managed to scrape metadata from the webpage and into an object that I have constructed with like this:
var newItem = new Zotero.Item("statute");
newItem.title = getTitle(doc, url);
newItem.shortTitle = infoArray[0];
newItem.dateEnacted = statuteInfo[1];
newItem.publicLawNumber = statuteInfo[0];
newItem.complete();
When I 'Run doWeb' in Scaffold I get this output:
10:24:37 Returned item:
{
"itemType": "statute"
"creators": []
"notes": []
"tags": []
"seeAlso": []
"attachments": []
- "title": "Bekendtgørelse af lov om forbud mod forskelsbehandling på arbejdsmarkedet m.v. 1)"
"shortTitle": "Forskelsbehandlingsloven"
"dateEnacted": "16/12/2008"
"publicLawNumber": "LBK nr 1349"
- "libraryCatalog": "Retsinformation"
+ "nameOfAct": "Bekendtgørelse af lov om forbud mod forskelsbehandling på arbejdsmarkedet m.v. 1)"
}
10:24:37 Translation successful
This all look fine to me, but the Zotero icon in the menu doesn't change, it's still set to web page, and I can't choose to save as a statute.
It's probably just some minor oversight on my part, but I'm pretty stumped.
If that's not it, post the entire translator (not just what you see in Scaffold -- get the whole file from the translator folder in your zotero data directory) to gist.github.com create a private gist, and link to it from here.
Today it works. Maybe Zotero needed to be restarted in order to 'recognize' the new translator?
Anyway, the translator can now succesfully scrape a single statute from the webpage, now I just need to make it differentiate between types, and be able to scrape multiple items. You'll probably hear from me again, when I get stumped next time.