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

Add support for dc:creator #131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

deadcoder0904
Copy link

Closes #130

@coveralls
Copy link

Coverage Status

Coverage increased (+0.002%) to 99.573% when pulling 0118475 on deadcoder0904:master into 96c6aec on jpmonette:master.

Copy link

@chazmcgarvey chazmcgarvey left a comment

Choose a reason for hiding this comment

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

How about something like this?

  • Adds the schema for dc, if creator is used.
  • Allow multiple creators.
  • Do author or creator, not both (as one best practice suggests).

Comment on lines 159 to 163
entry.author.map((author: Author) => {
item["dc:creator"] = { _cdata: author.name };
if (author.email && author.name) {
item.author.push({ _text: author.email + " (" + author.name + ")" });
}

Choose a reason for hiding this comment

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

Suggested change
entry.author.map((author: Author) => {
item["dc:creator"] = { _cdata: author.name };
if (author.email && author.name) {
item.author.push({ _text: author.email + " (" + author.name + ")" });
}
item["dc:creator"] = [];
entry.author.map((author: Author) => {
if (author.email && author.name) {
item.author.push({ _text: author.email + " (" + author.name + ")" });
} else if (author.name) {
isDublinCore = true;
item["dc:creator"].push({ _cdata: author.name });
}

And up above:

  let isDublinCore = false;

And down below:

  if (isDublinCore) {
    base.rss._attributes["xmlns:dc"] = "http://purl.org/dc/elements/1.1/";
  }

@jpmonette jpmonette force-pushed the master branch 2 times, most recently from ebe9963 to fd77835 Compare January 22, 2021 09:47
@paul-uz
Copy link

paul-uz commented Feb 17, 2021

This should not be added to the RSS2 spec, as by definition, it is not in the RSS2 spec (https://validator.w3.org/feed/docs/rss2.html)

@chazmcgarvey
Copy link

chazmcgarvey commented Feb 17, 2021

This should not be added to the RSS2 spec, as by definition, it is not in the RSS2 spec (https://validator.w3.org/feed/docs/rss2.html)

Are you referring to the spec file modified by this pull request? That's a test file. "spec" in the filename does not mean it has anything to do with the RSS2 spec, it's just a Jest convention.

If you're saying this node module shouldn't use extra namespaces, consider this from the document you link:

RSS is by no means a perfect format, but it is very popular and widely supported. Having a settled spec is something RSS has needed for a long time. The purpose of this work is to help it become a unchanging thing, to foster growth in the market that is developing around it, and to clear the path for innovation in new syndication formats. Therefore, the RSS spec is, for all practical purposes, frozen at version 2.0.1. We anticipate possible 2.0.2 or 2.0.3 versions, etc. only for the purpose of clarifying the specification, not for adding new features to the format. Subsequent work should happen in modules, using namespaces, and in completely new syndication formats, with new names.

(Emphasis mine.)

Nobody is saying that the Dublin core namespace is part of the RSS2 spec. The RSS2 spec over time has proven to have problems and be incomplete, which is why new namespaces -- which have schemas apart from the RSS2 schema -- have added missing functionality. Dublin core is such a namespace. It is popular and well-supported by readers.

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.

Use dc:creator for author of the post in RSS
4 participants