-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding Atom * Switching from EventEmitter to Promise
- Loading branch information
Frank Boës
committed
Aug 5, 2016
1 parent
64a8263
commit 91cba8d
Showing
10 changed files
with
170 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Represents all posts | ||
* @constructor | ||
*/ | ||
var RssJs = function (index, pubDate) { | ||
var config = require('./config'); | ||
var items = []; | ||
|
||
index.forEach(function(item){ | ||
var tags = []; | ||
if (item.meta.Tags !== undefined) { | ||
item.meta.Tags.forEach(function(t){ | ||
tags.push(t.title); | ||
}); | ||
} | ||
items.push({ | ||
title: item.meta.Title, | ||
description: item.htmlTeaser, | ||
link: config.baseUrl + config.basePath + item.meta.Url, | ||
pubDate: item.meta.rfcDate, | ||
guid: config.baseUrl + config.basePath + item.meta.Url, | ||
categories: tags | ||
}); | ||
}); | ||
|
||
return { | ||
version: 2.0, | ||
channel: { | ||
title: config.name, | ||
link: config.baseUrl + config.basePath, | ||
description: config.description, | ||
language: config.language, | ||
lastBuildDate: pubDate, | ||
items: items | ||
} | ||
}; | ||
}; | ||
|
||
module.exports = RssJs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<feed xmlns="http://www.w3.org/2005/Atom"> | ||
<title>{{config.name}}</title> | ||
<link href="{{{config.baseUrl}}}{{{config.basePath}}}" /> | ||
<id>{{{config.baseUrl}}}{{{config.basePath}}}</id> | ||
<!--description>{{config.description}}</description--> | ||
<updated>{{pubDate}}</updated> | ||
<!--language>{{config.language}}</language--> | ||
<link href="{{{config.baseUrl}}}{{{config.basePath}}}posts.atom" rel="self" /> | ||
<author> | ||
<name>{{config.name}}</name> | ||
</author> | ||
{{#index}} | ||
<entry> | ||
<title>{{meta.Title}}</title> | ||
<summary type="html"><![CDATA[{{htmlTeaser}}]]></summary> | ||
<link href="{{{config.baseUrl}}}{{{config.basePath}}}{{{meta.Url}}}" /> | ||
<updated>{{meta.isoDate}}</updated> | ||
<id>{{{config.baseUrl}}}{{{config.basePath}}}{{{meta.Url}}}</id> | ||
{{#meta.Tags}} | ||
<category term="{{title}}" /> | ||
{{/meta.Tags}} | ||
</entry> | ||
{{/index}} | ||
</feed> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.