feed icon indicating copy to clipboard operation
feed copied to clipboard

add extra items support

Open yshrsmz opened this issue 5 years ago • 8 comments

related #82

Hi, based on #82 I added the ability to add extra items.

I still need to add some documentation, but could you review this to make sure that the direction is right?

yshrsmz avatar Jul 13 '20 09:07 yshrsmz

Coverage Status

Coverage increased (+0.03%) to 99.605% when pulling 86dffd1837c088fa5077675c8214397dc5284395 on yshrsmz:custom-elements into fd77835d23990670975092c15009c75432e258ac on jpmonette:master.

coveralls avatar Jul 13 '20 09:07 coveralls

Hei there, thanks for your time and this plugin.

Any ideas when (or if) this will be merged? It would be super handy for us.

FelixButzbach avatar Jul 20 '20 22:07 FelixButzbach

hey @yshrsmz thanks for your time in creating this, I have forked your code and tried to understand it as much as I could.

I am trying to add it to my feed as you can see in the image below, i have the attribute "extra" in the addItem function, but it doesn't seem to be working for me.

I have also tried including the xml-js library and using the 'json2xml' function doesn't seem to work too.

I have also simply tried with a plain string but to no avail.

Any help would be greatly appreciated. image

JosephSaw avatar Aug 12 '20 10:08 JosephSaw

@JosephSaw could you add your example in a code snippet, not a screenshot?

The following item seems to render its content correctly(I've tested with test cases in this repo).

sampleFeed.addItem({
      title: "Hello World",
      id: "https://example.com/hello-world?id=this&that=true",
      link: "https://example.com/hello-world?link=sanitized&value=2",
      description: "This is an article about Hello World.",
      content: "Content of my item",
      date: new Date(),
      extra: {
        testExtra: '{"a": {"_text": " Hi "}}'
      }
    })

atom1

<entry>
    <title type="html"><![CDATA[Hello World]]></title>
    <id>https://example.com/hello-world?id=this&amp;that=true</id>
    <link href="https://example.com/hello-world?link=sanitized&amp;value=2"/>
    <updated>2020-08-12T11:21:50.778Z</updated>
    <summary type="html"><![CDATA[This is an article about Hello World.]]></summary>
    <content type="html"><![CDATA[Content of my item]]></content>
    <testExtra>{"a": {"_text": " Hi "}}</testExtra>
</entry>

rss2

<item>
    <title><![CDATA[Hello World]]></title>
    <link>https://example.com/hello-world?link=sanitized&amp;value=2</link>
    <guid>https://example.com/hello-world?id=this&amp;that=true</guid>
    <pubDate>Wed, 12 Aug 2020 11:24:36 GMT</pubDate>
    <description><![CDATA[This is an article about Hello World.]]></description>
    <content:encoded><![CDATA[Content of my item]]></content:encoded>
    <testExtra>{"a": {"_text": " Hi "}}</testExtra>
</item>

yshrsmz avatar Aug 12 '20 11:08 yshrsmz

@yshrsmz Yup sorry, it works!

Was actually using https://github.com/nuxt-community/feed-module I had to fork this and update the dependency to use the newly forked feed you created

JosephSaw avatar Aug 14 '20 06:08 JosephSaw

@jpmonette I've rebased the PR to the current master. Could you take a look?

yshrsmz avatar Feb 26 '21 07:02 yshrsmz

Has anyone already published a fork with these changes?

remorses avatar Sep 02 '22 11:09 remorses

@remorses if you really need it, you can use my fork directly

"dependencies": {
  "feed": "https://github.com/yshrsmz/feed.git#commit=5d545dc6ce46ac9b05b357e26be23e74472f966e"
}

edit 2022/09/08: merge master branch, updated commit hash

yshrsmz avatar Sep 02 '22 11:09 yshrsmz