Skip to content
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

Update Old Bailey Online.js #1760

Merged
merged 4 commits into from Nov 12, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 37 additions & 2 deletions Old Bailey Online.js
Expand Up @@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2018-10-08 14:06:13"
"lastUpdated": "2018-10-08 14:15:17"
}

/*
Expand Down Expand Up @@ -86,13 +86,14 @@ if (url.includes('browse.jsp') && ( url.includes('div=OA') || url.includes('nam
var trialTitle = ZU.xpathText(doc, '//div[@class="sessionsPaper"]/div[@class="sessions-paper-main-title"]'); // updated @class name



newItem.url = url;

var sessDate = ZU.xpathText(doc, '//div[@class="sessionsPaper"]/div[@class="sessions-paper-date"]'); // add session date, as the date is now in a gettable node

newItem.date = ZU.strToISO(sessDate);

if (newItem.itemType == "case" && newItem.title && newItem.title == newItem.title.toUpperCase()) {
if (newItem.itemType == "case" && trialTitle && trialTitle == trialTitle.toUpperCase()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to split this further up, because maybe also trialTitle for a case might exitsts which is not all uppercase:

if (newItem.itemType == "case" && trialTitle) {
   if (trialTitle == trialTitle.toUpperCase()) {
      newItem.title = ZU.capitalizeTitle(trialTitle, true);
   } else {
      newItem.title = trialTitle;
   }
}

newItem.title = ZU.capitalizeTitle(trialTitle, true); // todo tidying this up - sometimes no name, messy punctuation
} else if (newItem.itemType == "book") {
newItem.title = trialTitle + " " + sessDate;
Expand Down Expand Up @@ -296,6 +297,40 @@ var testCases = [
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.oldbaileyonline.org/browse.jsp?id=t16780828-12&div=t16780828-12&terms=hog#highlight",
"items": [
{
"itemType": "case",
"caseName": ".",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't seem right/helpful as data import. I think what I would do is strip all trailing periods and commas, and then set newItem.title = [no title] when there's nothing left -- does that sound right?

Copy link
Contributor

@zuphilip zuphilip Nov 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you suggest looks fine for me.

"creators": [],
"dateDecided": "1678-08-28",
"docketNumber": "t16780828-12",
"extra": "Reference Number: t16780828-12",
"url": "https://www.oldbaileyonline.org/browse.jsp?id=t16780828-12&div=t16780828-12&terms=hog#highlight",
"attachments": [
{
"title": "OBO Snapshot",
"mimeType": "text/html"
}
],
"tags": [
{
"tag": "Guilty"
},
{
"tag": "Theft"
},
{
"tag": "animal theft"
}
],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/