Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 193
- Log:
First stage commit of Typo 4.1, modified for the ROOL site.
Includes all local modifications but a final pass needs to be
made to delete any files left over from earlier Typo versions
that shouldn't be here anymore. See the 'tags' section of the
repository for a clean Typo 4.1 tree.Note that symlinks to shared files in the RISC OS Open theme
directory have been deliberately included this time around; I
decided that on balance it was better to leave them in as
placeholders, since unlike symlinks in app/views/shared, the
Typo theme structure is not a standard Rails concept.
- Author:
- rool
- Date:
- Wed Apr 04 18:51:02 +0100 2007
- Size:
- 1733 Bytes
1 | require 'open-uri' |
2 | require 'time' |
3 | require 'rexml/document' |
4 | |
5 | class Delicious |
6 | include REXML |
7 | |
8 | attr_accessor :url, :items, :link, :title, :days |
9 | |
10 | # This object holds given information of an item |
11 | class DeliciousItem < Struct.new(:link, :title, :description, :description_link, :date) |
12 | def to_s; title end |
13 | end |
14 | |
15 | # Pass the url to the RSS feed you would like to keep tabs on |
16 | # by default this will request the rss from the server right away and |
17 | # fill the items array |
18 | def initialize(url, refresh = true) |
19 | self.items = [] |
20 | self.url = url |
21 | self.days = {} |
22 | self.refresh if refresh |
23 | end |
24 | |
25 | # This method lets you refresh the items in the items array |
26 | # useful if you keep the object cached in memory and |
27 | def refresh |
28 | open(@url) do |http| |
29 | parse(http.read) |
30 | end |
31 | end |
32 | |
33 | private |
34 | |
35 | def parse(body) |
36 | |
37 | xml = Document.new(body) |
38 | |
39 | self.items = [] |
40 | self.link = XPath.match(xml, "//channel/link/text()").first.value rescue "" |
41 | self.title = XPath.match(xml, "//channel/title/text()").first.value rescue "" |
42 | |
43 | XPath.each(xml, "//item/") do |elem| |
44 | item = DeliciousItem.new |
45 | item.title = XPath.match(elem, "title/text()").first.value rescue "" |
46 | item.link = XPath.match(elem, "link/text()").first.value rescue "" |
47 | item.description = XPath.match(elem, "description/text()").first.value rescue "" |
48 | item.date = Time.mktime(*ParseDate.parsedate(XPath.match(elem, "dc:date/text()").first.value)) rescue Time.now |
49 | |
50 | item.description_link = item.description |
51 | item.description.gsub!(/<\/?a\b.*?>/, "") # remove all <a> tags |
52 | items << item |
53 | end |
54 | |
55 | self.items = items.sort_by { |item| item.date }.reverse |
56 | end |
57 | end |