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

within citations, if page is undefined do not make it a string #7641

Merged
merged 1 commit into from
Nov 20, 2023

Conversation

cderv
Copy link
Collaborator

@cderv cderv commented Nov 20, 2023

This would have the side effect of having the undefined field shows in output

Fixes #7638 following change in 2e7ba02

cc @dragonstyle

This would have the side effect of having the undefined field shows in output

See #7638 following change in 2e7ba02
@cderv cderv requested a review from dragonstyle November 20, 2023 13:41
@kdheepak
Copy link
Contributor

Thanks for the quick PR!

The function you modified returns this:

  return {
    firstPage: firstPage as string,
    lastPage: lastPage as string,
    page: pages,
  };

but firstPage and lastPage may also be undefined, right? Wouldn't you need to do a similar check for those two lines?

Alternatively, do it in the first couple of lines and return this instead:

  return {
    firstPage,
    lastPage,
    page: pages,
  };

@cderv
Copy link
Collaborator Author

cderv commented Nov 20, 2023

Thanks for chiming in.

I don't think we need it because

> undefined as string
undefined
> `${ undefined}` as string
"undefined"

For pages we added in 2e7ba02 the special treatment of passing to a string using `${ var }` syntax. And this was the syntax that make undefined become a string as "undefined" instead of staying undefined. Other variables do not have that treatment

Copy link
Collaborator

@dragonstyle dragonstyle left a comment

Choose a reason for hiding this comment

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

sweet

@dragonstyle dragonstyle merged commit a280e8d into main Nov 20, 2023
@dragonstyle dragonstyle deleted the citation/pages branch November 20, 2023 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When using citations: true and ieee.csl, pages = {undefined} is being printed
3 participants