karottenreibe-qwicky 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY.markdown +6 -0
- data/bin/qwicky +25 -14
- data/qwicky.gemspec +1 -1
- metadata +1 -1
data/HISTORY.markdown
CHANGED
data/bin/qwicky
CHANGED
@@ -89,6 +89,10 @@ module Markup
|
|
89
89
|
def format text
|
90
90
|
text
|
91
91
|
end
|
92
|
+
|
93
|
+
def linkify link, title, klass, text
|
94
|
+
"<a href=#{link.inspect} title=#{title.inspect} class=#{klass.inspect}>#{text}</a>"
|
95
|
+
end
|
92
96
|
end
|
93
97
|
|
94
98
|
# Text. {{{2
|
@@ -178,7 +182,7 @@ module Markup
|
|
178
182
|
require 'rdoc/markup/simple_markup'
|
179
183
|
require 'rdoc/markup/simple_markup/to_html'
|
180
184
|
rescue LoadError => boom
|
181
|
-
puts "Looks like you don't have
|
185
|
+
puts "Looks like you don't have rdoc installed!"
|
182
186
|
puts "This is the gem needed to render RDoc syntax"
|
183
187
|
puts "Reverting to simple text markup"
|
184
188
|
throw :revert
|
@@ -187,7 +191,14 @@ module Markup
|
|
187
191
|
end
|
188
192
|
|
189
193
|
def format text
|
190
|
-
SM::SimpleMarkup.new.convert(text, SM::ToHtml.new)
|
194
|
+
ret = SM::SimpleMarkup.new.convert(text, SM::ToHtml.new)
|
195
|
+
ret.gsub %r{\[\[([^|]+)\|([^|]+)\|([^|]+)\|([^|]+)\]\]} do
|
196
|
+
"<a href=#{$1.inspect} title=#{$2.inspect} class=#{$3.inspect}>#{$4}</a>"
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
def linkify link, title, klass, text
|
201
|
+
"[[#{link}|#{title}|#{klass}|#{text}]]"
|
191
202
|
end
|
192
203
|
end
|
193
204
|
end
|
@@ -227,14 +238,16 @@ class Qwicky
|
|
227
238
|
end
|
228
239
|
|
229
240
|
def format text
|
230
|
-
markup.format(
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
241
|
+
markup.format(
|
242
|
+
text.gsub %r{\[\[([^|\]]+)(\|([^\]]+))?\]\]} do |match|
|
243
|
+
page = $1
|
244
|
+
nexist = Page.first(:name => page).nil?
|
245
|
+
klass = nexist ? 'bad' : 'good'
|
246
|
+
title = nexist ? "Create page `#{page}'" : "Page `#{page}'"
|
247
|
+
link = '/' + page
|
248
|
+
markup.linkify(link, title, klass, ($3 || $1))
|
249
|
+
end
|
250
|
+
)
|
238
251
|
end
|
239
252
|
end
|
240
253
|
|
@@ -308,10 +321,8 @@ get '/..user.stylesheet.css' do
|
|
308
321
|
end
|
309
322
|
|
310
323
|
get '/..favicon' do
|
311
|
-
|
312
|
-
|
313
|
-
:type => 'image/png',
|
314
|
-
:disposition => 'inline'
|
324
|
+
content_type 'image/png'
|
325
|
+
Base64::decode64(haml(:favicon, :layout => false))
|
315
326
|
end
|
316
327
|
|
317
328
|
get '/..sitemap' do
|
data/qwicky.gemspec
CHANGED