-
Notifications
You must be signed in to change notification settings - Fork 825
Improve import from Citavi #3426
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
Also fixing potential problems handling keywords with other tags in general.
dab062d
to
4057e7c
Compare
Citavi 5 XML.js
Outdated
if (rememberTags[noteObject.id]) { | ||
noteObject.tags = rememberTags[noteObject.id]; | ||
for (let j = 0; j < rememberTags[noteObject.id]; j++) { |
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.
j < rememberTags[noteObject.id]
won't work - did you mean to add .length
? We should just use for..of
here (and elsewhere).
Citavi 5 XML.js
Outdated
} | ||
if (pages) { | ||
noteObject.note += "<i>" + pages + "</i>"; | ||
} | ||
keywords = ZU.xpathText(doc, '//KnowledgeItemKeywords/OnetoN[starts-with(text(), "' + noteObject.id + '")]'); | ||
if (keywords && keywords.length > 0) { |
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.
Redundant comparison - empty string is falsey
Citavi 5 XML.js
Outdated
valueList.push(ZU.xpathText(author, 'Name')); | ||
} | ||
else { | ||
Z.debug("Can't find this id:", id); |
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.
debug()
doesn't work like console.log()
. Need to concatenate the strings.
Thank you for the code review. I fixed all the points. |
Citavi 5 XML.js
Outdated
for (let tag of rememberTags[noteObject.id]) { | ||
noteObject.tags.append(tag); | ||
} |
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.
There's no array method called append()
. push()
? Oh, and we can just do this:
for (let tag of rememberTags[noteObject.id]) { | |
noteObject.tags.append(tag); | |
} | |
noteObject.tags.push(...rememberTags[noteObject.id]); |
And the same above.
@zuphilip: I made the update - would you be able to test? I don't have any Citavi data to test with. |
These cherry-pick two small commits from #3183.