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:
- 1769 Bytes
- Properties:
- Property svn:executable is set to *
1 | require 'open-uri' |
2 | require 'rexml/document' |
3 | |
4 | # Example: |
5 | # |
6 | # upcoming = Upcoming.new('http://upcoming.org/syndicate/my_events/<your_user_id>') |
7 | # upcoming.events.each do |event| |
8 | # puts "#{event.title} @ #{event.timespan} #{event.link} : #{event.description}" |
9 | # end |
10 | # |
11 | |
12 | class Upcoming |
13 | include REXML |
14 | |
15 | def choose(num) |
16 | events.last(num) |
17 | end |
18 | |
19 | attr_accessor :events, :link, :title, :description, :url |
20 | |
21 | # This object holds given information for an Event |
22 | class Event < Struct.new(:link, :title, :description) |
23 | def to_s; title end |
24 | |
25 | def timespan |
26 | description.split(':')[0] |
27 | end |
28 | |
29 | def info |
30 | description.split(':')[1] |
31 | end |
32 | end |
33 | |
34 | # Pass the url to the RSS feed you would like to keep tabs on |
35 | # by default this will request the rss from the server right away and |
36 | # fill the tasks array |
37 | def initialize(url, refresh = true) |
38 | self.events = [] |
39 | self.url = url |
40 | self.refresh if refresh |
41 | end |
42 | |
43 | # This method lets you refresh the tasks int the tasks array |
44 | # useful if you keep the object cached in memory and |
45 | def refresh |
46 | open(@url) do |http| |
47 | parse(http.read) |
48 | end |
49 | end |
50 | |
51 | private |
52 | |
53 | def parse(body) |
54 | |
55 | xml = Document.new(body) |
56 | |
57 | self.events = [] |
58 | self.link = XPath.match(xml, "//channel/link/text()").to_s |
59 | self.title = XPath.match(xml, "//channel/title/text()").to_s |
60 | self.description = XPath.match(xml, "//channel/description/text()").to_s |
61 | |
62 | XPath.each(xml, "//item/") do |elem| |
63 | |
64 | event = Event.new |
65 | event.title = XPath.match(elem, "title/text()").to_s |
66 | event.link = XPath.match(elem, "link/text()").to_s |
67 | event.description = XPath.match(elem, "description/text()").to_s |
68 | event.inspect |
69 | events << event |
70 | end |
71 | end |
72 | end |
73 | |
74 |