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

Rewrite Encore #1482

Merged
merged 3 commits into from Nov 25, 2017

Conversation

@adam3smith
Copy link
Collaborator

commented Nov 19, 2017

closes #1481

Rewrite Encore
closes #1481

@adam3smith adam3smith requested a review from zuphilip Nov 19, 2017

@zuphilip
Copy link
Collaborator

left a comment

The logic inside the loop is confusing and I suggest an alternative solution. Moreover, I commented some smaller things to look at.

"tag": "Nursing"
},
{
"tag": "Nursing"

This comment has been minimized.

Copy link
@zuphilip

zuphilip Nov 22, 2017

Collaborator

Why do we have here duplicate tags?

This comment has been minimized.

Copy link
@adam3smith

adam3smith Nov 23, 2017

Author Collaborator

Look at the MARC here: http://sallypro.sandiego.edu/iii/encore/record/C__Rb1516899__Stesting__P0,2__Orightresult__U__X6?lang=eng&suite=cobalt&marcData=Y
in the 650 fields:
650 0 Nursing|xEducation
650 0 Critical thinking
650 0 Constructivism (Education)
650 0 Nursing|xDecision making
650 0 Nursing|xPhilosophy

MARC imports both parts of the field as tag -- maybe that's not right? Or we should save the category in the 0 field and check against it to avoid duplication? In any case, this is a MARC issue, I'd like to address it separately

This comment has been minimized.

Copy link
@zuphilip

zuphilip Nov 23, 2017

Collaborator

Okay, I see.

Although, I thought that duplicate tags were technically not possible. At least manually I cannot enter twice the same tag.

This comment has been minimized.

Copy link
@adam3smith

adam3smith Nov 24, 2017

Author Collaborator

Turns out they only show up in the tests, not in Zotero itself.

This comment has been minimized.

Copy link
@zuphilip

zuphilip Nov 25, 2017

Collaborator

ok

}
]
"url": "http://sallypro.sandiego.edu/iii/encore/record/C__Rb1516899__Stesting__P0%2C2__Orightresult__U__X6?lang=eng&suite=cobalt",
"items": [{

This comment has been minimized.

Copy link
@zuphilip

zuphilip Nov 22, 2017

Collaborator

Did you add these tests with Scaffold? The [{ is usually on two lines...

This comment has been minimized.

Copy link
@adam3smith

adam3smith Nov 23, 2017

Author Collaborator

of course tests are from scaffold, yes. I think this was jsbeautify which I ran on the whole file.

This comment has been minimized.

Copy link
@zuphilip

zuphilip Nov 23, 2017

Collaborator

Ah, okay. For test it makes IMO sense to leave the formatting as Scaffold outputs it. Otherwise this will show differences the next time someone is updating and testing the same translator.

@@ -9,15 +9,14 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsb",
"lastUpdated": "2014-08-26 03:59:48"
"lastUpdated": "2017-11-19 20:03:16"

This comment has been minimized.

Copy link
@zuphilip

zuphilip Nov 22, 2017

Collaborator

For a rewrite we should IMO increase the minVersion also to 3.0.

@@ -9,15 +9,14 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsb",

This comment has been minimized.

Copy link
@zuphilip

zuphilip Nov 22, 2017

Collaborator

Add all of them (or do you have any reasons that they should not work?).

for (var i in items) {
articles.push(i);
}
scrape(articles)

This comment has been minimized.

Copy link
@zuphilip

zuphilip Nov 22, 2017

Collaborator

Missing ;

scrape(articles)
});
} else {
var marcURL = createMarcURL(url)

This comment has been minimized.

Copy link
@zuphilip

zuphilip Nov 22, 2017

Collaborator

Missing ;

var record = new marc.record();
var newItem = new Zotero.Item();

var linee = text.split("\n");

This comment has been minimized.

Copy link
@zuphilip

zuphilip Nov 22, 2017

Collaborator

Fix typo linee (or do I miss the point in the variable name here?).


var linee = text.split("\n");
for (var i = 0; i < linee.length; i++) {
if (!linee[i]) {

This comment has been minimized.

Copy link
@zuphilip

zuphilip Nov 22, 2017

Collaborator

Can we add comment here, e.g. // skip empty line?


if (linee[i].substr(0, 6) == " ") {
// add this onto previous value
tagValue += value;

This comment has been minimized.

Copy link
@zuphilip

zuphilip Nov 22, 2017

Collaborator

This is IMO quite confusing and tagValue is not yet initialized.

I suggest to actually clean the text before splitting into lines with something like:

				// delete empty lines, delete confusing newlines, e.g. 
				// 245 10 Testing a theoretical model of critical thinking and 
                		//        cognitive development /|cby Jane Rapps 
				text = text.replace(/^\n/mg, '').replace(/\s?\n\s+/gm, ' ');
@adam3smith

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 24, 2017

Please take a look. I switched out the test because the catalog always detects book and the old test was a thesis so tests failed (probably not worth fixing detect here)

@zuphilip zuphilip merged commit 3b08a48 into zotero:master Nov 25, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@zuphilip

This comment has been minimized.

Copy link
Collaborator

commented Nov 25, 2017

Thank you very much, @adam3smith ! (I simplified the code a little and add some nits.)

@adam3smith

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 25, 2017

Thanks!

danmichaelo added a commit to danmichaelo/translators that referenced this pull request Nov 28, 2017

psisquared2 added a commit to psisquared2/translators that referenced this pull request Feb 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.