summaryrefslogtreecommitdiff
path: root/lib/page_remote.rb
blob: 9617754521956d06db6b60ebfa9c8cc09822fd6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# coding: utf-8
require 'date'

require 'config'
require 'page'

class RemotePage < Page
	def initialize(metadata)
		@metadata = metadata
		super()
	end

	def url
		return Config::get.url + @metadata['url']
	end

	def atom_title
		@metadata['title']
	end

	def atom_author
		Person::new(@metadata['author'] || Config::get.default_author)
	end

	def atom_content
		return nil
	end
	
	def atom_rights
		return nil
	end

	def page_categories
		@metadata['categories'] || []
	end

	def page_published
		str = @metadata['published']
		if str.nil?
			return nil
		end
		return DateTime::parse(str).to_time
	end

	def page_updated
		str = @metadata['updated']
		if str.nil?
			return nil
		end
		return DateTime::parse(str).to_time
	end

	def page_years
		return []
	end

	def index_class
		return 'external'
	end
end