karottenreibe-qwicky 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/HISTORY.markdown +6 -0
  2. data/bin/qwicky +25 -14
  3. data/qwicky.gemspec +1 -1
  4. metadata +1 -1
data/HISTORY.markdown CHANGED
@@ -1,3 +1,9 @@
1
+ 0.0.5
2
+ =====
3
+
4
+ * Fixed wikilinks for all markups
5
+ * Removed deprecated sinatra method
6
+
1
7
  0.0.4
2
8
  =====
3
9
 
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 RDoc installed!"
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(text).gsub %r{\[\[([^|\]]+)(\|([^\]]+))?\]\]} do |match|
231
- page = $1
232
- nexist = Page.first(:name => page).nil?
233
- klass = nexist ? 'bad' : 'good'
234
- title = nexist ? "Create page `#{page}'" : "Page `#{page}'"
235
- link = '/' + page
236
- "<a href=#{link.inspect} title=#{title.inspect} class='#{klass}'>#{$3 || $1}</a>"
237
- end
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
- send_data Base64::decode64(haml(:favicon, :layout => false)),
312
- :filename => 'favicon.png',
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{qwicky}
5
- s.version = "0.0.4"
5
+ s.version = "0.0.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Fabian Streitel"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karottenreibe-qwicky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabian Streitel