Skip to content

Commit

Permalink
RSSを行ごとにliタグでリスト化 #240
Browse files Browse the repository at this point in the history
  • Loading branch information
shokai committed May 8, 2015
1 parent a1f1ce7 commit e914e14
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions controllers/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -90,37 +90,34 @@ module.exports = (app) ->
site_url = "#{req.protocol}://#{subdomains}#{req.get "host"}"

feed = new RSS
title: "Gyazz:#{wiki}"
description: "description"
title: "Gyazz::#{wiki}"
feed_url: "#{site_url}/#{wiki}/rss.xml"
site_url: site_url
image_url: "#{site_url}/favicon.ico"
docs: "http://github.com/masuilab/gyazz"
managingEditor: "toshiyuki masui"
webMaster: "http://gihub.com/masuilab/gyazz"
webMaster: "https://gihub.com/masuilab/gyazz"
copyright: "2014 "
language: "ja"
categories: []
pubDate: docs[0]?.timestamp || new Date()

# Limit
docs = docs.slice(0,20) if docs.length > 20

markup = new GyazzMarkup host: site_url, wiki: wiki

for page in docs
description = "<ul>"
description += page.text
.split /[\r\n]/
.map (line) -> "<li>#{markup.markup line, escape: false}</li>"
.join ''
description += "</ul>"

feed.item
title: page._id
description: markup.markup page.text, escape: false
description: description
url: "#{site_url}/#{wiki}/#{page._id}"
#guid: "" # optional - defaults to url
#categories: [] # optional - array of item categories
#author: "" # optional - defaults to feed author property
date: page.timestamp # any format that js Date can parse.
#lat : 33.417974 #optional latitude field for GeoRSS
#long: -111.933231 #optional longitude field for GeoRSS
#enclosure: # optional enclosure
#url: "..."
#file: "path-to-file"
res.set
"Content-Type": "text/xml"
res.send feed.xml()
Expand Down

0 comments on commit e914e14

Please sign in to comment.