smeagol 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/smeagol/app.rb CHANGED
@@ -83,7 +83,7 @@ module Smeagol
83
83
  cache.get_page(name, version)
84
84
  # Then try to create the wiki page
85
85
  elsif page = wiki.page(name, version)
86
- content = Mustache.render(get_template('page'), Smeagol::Views::Page.new(page))
86
+ content = Mustache.render(get_template('page'), Smeagol::Views::Page.new(page, tag_name))
87
87
  cache.set_page(name, page.version.id, content) if settings.cache_enabled
88
88
  content
89
89
  # If it is a directory, redirect to the index page
@@ -1,3 +1,3 @@
1
1
  module Smeagol
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -6,8 +6,9 @@ module Smeagol
6
6
  # wiki - The wiki that this view represents.
7
7
  #
8
8
  # Returns a new view object.
9
- def initialize(wiki)
10
- @wiki = wiki
9
+ def initialize(wiki, version='master')
10
+ @wiki = wiki
11
+ @version = version || 'master'
11
12
  end
12
13
 
13
14
  # Public: The title of the wiki. This is set in the settings file.
@@ -32,7 +33,12 @@ module Smeagol
32
33
  if !menu.nil?
33
34
  html = "<ul>\n"
34
35
  menu.each do |item|
35
- html << "<li><a href=\"#{item.href}\">#{item.title}</a></li>\n"
36
+ if version != 'master' && item.href.index('/') == 0
37
+ prefix = "/#{version}"
38
+ else
39
+ prefix = ""
40
+ end
41
+ html << "<li><a href=\"#{prefix}#{item.href}\">#{item.title}</a></li>\n"
36
42
  end
37
43
  html << "</ul>\n"
38
44
  end
@@ -60,9 +66,12 @@ module Smeagol
60
66
 
61
67
  protected
62
68
 
63
- # The Gollum::Page that this view represents.
69
+ # The Gollum::Wiki that this view represents.
64
70
  attr_reader :wiki
65
71
 
72
+ # The tagged version that is being viewed.
73
+ attr_reader :version
74
+
66
75
 
67
76
  private
68
77
 
@@ -3,11 +3,12 @@ module Smeagol
3
3
  class Page < Base
4
4
  # Initializes a new page template data object.
5
5
  #
6
- # page - The individual wiki page that this view represents.
6
+ # page - The individual wiki page that this view represents.
7
+ # version - The tagged version of the page.
7
8
  #
8
9
  # Returns a new page object.
9
- def initialize(page)
10
- super(page.wiki)
10
+ def initialize(page, version='master')
11
+ super(page.wiki, version)
11
12
  @page = page
12
13
  end
13
14
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smeagol
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 0
10
- version: 0.5.0
9
+ - 1
10
+ version: 0.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ben Johnson