/instiki/svnpassword

To download this project, use:
bzr branch https://golem.ph.utexas.edu/~distler/code/instiki/svn/
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
begin
 require "rdoc/markup/simple_markup"
 require 'rdoc/markup/simple_markup/to_html'
rescue LoadError
 # Ruby 1.9
 require "rdoc/markup"
 require 'rdoc/markup/to_html'
 module SM
 class SimpleMarkup < RDoc::Markup
 end
 class ToHtml <RDoc::Markup::ToHtml
 end
 end
end
module RDocSupport
# A simple +rdoc+ markup class which recognizes some additional
# formatting commands suitable for Wiki use.
class RDocMarkup < SM::SimpleMarkup
 def initialize
 super()
 pre = '(?:\\s|^|\\\\)'
 # links of the form
 # [[<url> description with spaces]]
 add_special(/((\\)?\[\[\S+?\s+.+?\]\])/,:TIDYLINK)
 # and external references
 add_special(/((\\)?(link:|anchor:|http:|mailto:|ftp:|img:|www\.)\S+\w\/?)/,
 :HYPERLINK)
 # <br/>
 add_special(%r{(#{pre}<br/>)}, :BR)
 # and <center> ... </center>
 add_html("center", :CENTER)
 end
 def convert(text, handler)
 super.sub(/^<p>\n/, '').sub(/<\/p>$/, '')
 end
end
# Handle special hyperlinking requirments for RDoc formatted
# entries. Requires RDoc
class HyperLinkHtml < SM::ToHtml
 # Initialize the HyperLinkHtml object.
 # [path] location of the node
 # [site] object representing the whole site (typically of class
 # +Site+)
 def initialize
 super()
 add_tag(:CENTER, "<center>", "</center>")
 end
 # handle <br/>
 def handle_special_BR(special)
 return "&lt;br/&gt" if special.text[0,1] == '\\'
 special.text
 end
 # We're invoked with a potential external hyperlink.
 # [mailto:] just gets inserted.
 # [http:] links are checked to see if they
 # reference an image. If so, that image gets inserted
 # using an <img> tag. Otherwise a conventional <a href>
 # is used.
 # [img:] insert a <tt><img></tt> tag
 # [link:] used to insert arbitrary <tt><a></tt> references
 # [anchor:] used to create an anchor
 def handle_special_HYPERLINK(special)
 text = special.text.strip
 return text[1..-1] if text[0,1] == '\\'
 url = special.text.strip
 if url =~ /([A-Za-z]+):(.*)/
 type = 1ドル
 path = 2ドル
 else
 type = "http"
 path = url
 url = "http://#{url}"
 end
 case type 
 when "http"
 if url =~ /\.(gif|png|jpg|jpeg|bmp)$/
 "<img src=\"#{url}\"/>"
 else
 "<a href=\"#{url}\">#{url.sub(%r{^\w+:/*}, '')}</a>"
 end
 when "img"
 "<img src=\"#{path}\"/>"
 when "link"
 "<a href=\"#{path}\">#{path}</a>"
 when "anchor"
 "<a name=\"#{path}\"></a>"
 else
 "<a href=\"#{url}\">#{url.sub(%r{^\w+:/*}, '')}</a>"
 end
 end
 # Here's a hyperlink where the label is different to the URL
 # [[url label that may contain spaces]]
 #
 def handle_special_TIDYLINK(special)
 text = special.text.strip
 return text[1..-1] if text[0,1] == '\\'
 unless text =~ /\[\[(\S+?)\s+(.+?)\]\]/
 return text
 end
 url = 1ドル
 label = 2ドル
 label = RDocFormatter.new(label).to_html
 label = label.split.select{|x| x =~ /\S/}.
 map{|x| x.chomp}.join(' ')
 case url
 when /link:(\S+)/
 return %{<a href="#{1ドル}">#{label}</a>}
 when /img:(\S+)/
 return %{<img src="http://#{1ドル}" alt="#{label}" />}
 when /rubytalk:(\S+)/
 return %{<a href="http://ruby-talk.org/blade/#{1ドル}">#{label}</a>}
 when /rubygarden:(\S+)/
 return %{<a href="http://www.rubygarden.org/ruby?#{1ドル}">#{label}</a>}
 when /c2:(\S+)/
 return %{<a href="http://c2.com/cgi/wiki?#{1ドル}">#{label}</a>}
 when /isbn:(\S+)/
 return %{<a href="http://search.barnesandnoble.com/bookSearch/} +
 %{isbnInquiry.asp?isbn=#{1ドル}">#{label}</a>}
 end
 unless url =~ /\w+?:/
 url = "http://#{url}"
 end
 "<a href=\"#{url}\">#{label}</a>"
 end
end
class RDocFormatter
 def initialize(text)
 @text = text
 end
 def to_html
 markup = RDocMarkup.new
 h = HyperLinkHtml.new
 markup.convert(@text, h)
 end
end
end

AltStyle によって変換されたページ (->オリジナル) /