File: referer_scheme.rb

package info (click to toggle)
tdiary 2.0.1-1sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 7,220 kB
  • ctags: 1,667
  • sloc: ruby: 20,044; lisp: 476; makefile: 91; sql: 32; sh: 31
file content (78 lines) | stat: -rw-r--r-- 2,469 bytes parent folder | download | duplicates (5)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
=begin
= Meta-scheme plugin((-$Id: referer_scheme.rb,v 1.8 2004/07/30 18:38:33 zunda Exp $-))
Υ󥯸ִꥹȤεҤڤˤޤ

== ˡ
Υץ饰򡢥ץ饰Υǥ쥯ȥ뤫ץ饰ץ饰
󤫤ͭˤƤ

ˡꡢ󥯸顢󥯸ִꥹȤԽơtdiary:
hatena:Ȥץեå(᥿ȸƤ֤Ȥˤޤ)URL
դƤ

ˤꡢդִ롼񤫤ʤǤ⡢ִʸ˼ưŪ
դʤɤ뤳ȤǤޤ

㤨СΤ褦ʵҤ򤷤Ƥ
* tdiary:http://tdiary.tdiary.net/ tDiary.net
* tdiarynet:foo((-http://foo.tdiary.net/Ÿޤ-)) foo
* hatena:bar((-http://d.hatena.ne.jp/bar/Ÿޤ-)) bar
ǤϡURLդޤޤС(YYYY-MM-DD)Ȥɲäޤ

== 
tdiary:ǻϤޤURLϡ
* ̤ȤʤǤ
* /ǽ餻Ƥ

tdiarynet:hatena:ǻϤޤURLϡ
* ̤ȤʤǤ
* URLȤƤϥ桼IDꤷƤ

== ᥿κ
󥯸ִꥹȤURLɽʸФơ/^(\w+):/Ȥɽ
ǰפʸ󤬥᥿ȤƸФޤ
  def scheme_̾( url, name )
    :
    yield( url_variants, name_variants )
    :
  end
Ȥ@conf.referer_tableðۥ᥽åɤ򥤥ƥ졼ȤƤС
ִꥹȤεҤ˱ƤΥ᥽åɤƤФޤurlˤ
֥᥿̾:פɽϤ뤳ȤդƤ

== Copyright
Copyright (C) 2003 zunda <zunda at freeshell.org>

Permission is granted for use, copying, modification, distribution, and
distribution of modified versions of this work under the terms of GPL
version 2 or later.
=end

unless @conf.referer_table.respond_to?( 'scheme_tdiarynet', true ) then
	class << @conf.referer_table
	private
		TdiaryNet = '\.tdiary\.net/'
	
		def scheme_tdiarynet( url, name )
			TdiaryDates.each do |a|
				yield( "http://#{url}#{TdiaryNet}#{a[0]}", name + a[1] )
			end
			yield( "http://#{url}#{TdiaryNet}.*", name )
		end
	end
end

unless @conf.referer_table.respond_to?( 'scheme_hatena', true ) then
	class << @conf.referer_table
		HatenaHost = 'http://d(?:iary)?\.hatena\.ne\.jp/'
		def scheme_hatena( url, name )
			[
				['(\d{4})(\d{2})(\d{2}).*', '(\1-\2-\3)'],
				['(\d{4})(\d{2}).*', '(\1-\2)'],
			].each do |a|
				yield( "#{HatenaHost}#{url}/#{a[0]}", name + a[1] )
			end
			yield( "#{HatenaHost}#{url}/.*", name )
		end
	end
end