gollum_rails 1.4.14 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b14f13cec09a2773a0f5a9c15005db2c886d8e1
4
- data.tar.gz: 4ba9089266e351d09ea4beb5c3f385dbbcad19d8
3
+ metadata.gz: 1f71884c345d954f3511cf8c6ea58bb840ae6a50
4
+ data.tar.gz: fff2ffd81c27dcd66a362a834f6518ec8b0e0261
5
5
  SHA512:
6
- metadata.gz: 189fad38e9cdc87b1b1939e99a5ab4a7f01ee11e7a00d1f2ae247089862fa21ec59dd4637b4f11406be3de600d0a9273b0c4beff7a900cd17364c0d356046d72
7
- data.tar.gz: 331d7592754e7c9873e01c07c055cac68a6f8bf6b2a1fbe738448690f66760b47593a39ff03b98d734a97cd85ed674021429b24fcdd11ec851537d4a45a33c46
6
+ metadata.gz: e65f565da5445905b61693867eb482603a85eea98dd0157346631b89ca1c937bb734d057b8ace2af8009076116632f1ab75b9fbdeb66023adfdcd7a9b1946b9a
7
+ data.tar.gz: cc49fccfab54ae62599b1800eb512966bd2f6074b4c38c58e436ba2e1217fca4083ee5a594f690f1dd5620a42f7c2df92fc7c83d9b22547ecba9a14e2912998a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gollum_rails (1.4.14)
4
+ gollum_rails (1.5.0)
5
5
  activemodel (>= 3.2.11)
6
6
  activesupport (>= 3.2.11)
7
7
  gollum-lib (~> 1.0.9)
data/HISTORY.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 1.5.0 22th January 2014
2
+ * Added parsing support for YAML header `page.meta`
3
+ * Added html rendering without the YAML `page.html_without_yaml`
4
+ * Added `has_meta?` method to page
5
+
1
6
  # 1.4.14 21th January 2014
2
7
  * set directory by calling Page.folder= or Page.set_folder
3
8
  * all supports directories
data/gollum_rails.gemspec CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
4
4
  s.name = 'gollum_rails'
5
5
  s.rubyforge_project = s.name
6
6
 
7
- s.version = '1.4.14'
7
+ s.version = '1.5.0'
8
8
 
9
9
  s.summary = 'Combines Gollum and Rails'
10
10
  s.description= 'include Gollum into Rails with ease'
@@ -51,6 +51,7 @@ Gem::Specification.new do |s|
51
51
  lib/gollum_rails/core.rb
52
52
  lib/gollum_rails/error.rb
53
53
  lib/gollum_rails/finders.rb
54
+ lib/gollum_rails/meta.rb
54
55
  lib/gollum_rails/orm.rb
55
56
  lib/gollum_rails/page.rb
56
57
  lib/gollum_rails/persistance.rb
data/lib/gollum_rails.rb CHANGED
@@ -42,9 +42,10 @@ module GollumRails
42
42
  autoload :Page
43
43
  autoload :Setup
44
44
  autoload :Orm
45
+ autoload :Meta
45
46
 
46
47
  # GollumRails version string
47
- VERSION = '1.4.14'
48
+ VERSION = '1.5.0'
48
49
 
49
50
  end
50
51
 
@@ -82,6 +82,7 @@ module GollumRails
82
82
  gollum_page.title
83
83
  end
84
84
 
85
+
85
86
  # == Gets formatted_data for current Gollum::Page
86
87
  #
87
88
  # Returns a String
@@ -0,0 +1,58 @@
1
+ module GollumRails
2
+ module Meta
3
+ extend ActiveSupport::Concern
4
+
5
+ # == Checks if this page has a Yaml part
6
+ #
7
+ # Example YAML part:
8
+ #
9
+ # ---
10
+ # title: "My Page"
11
+ #
12
+ # ---
13
+ #
14
+ # YAML part is seperated from the rest by `---` before and after
15
+ # the content
16
+ #
17
+ # Returns true or false
18
+ def has_yaml?
19
+ !!raw_meta
20
+ end
21
+
22
+ # == Gets the pages raw Yaml header.
23
+ #
24
+ #
25
+ # Returns either the raw yaml or an empty string
26
+ def raw_meta
27
+ raw_data.match(/^(?<headers>---\s*\n.*?\n?)^(---\s*$\n?)/m).to_s
28
+ end
29
+
30
+ # == Gets the parsed meta data
31
+ #
32
+ #
33
+ # Returns parsed YAML
34
+ def meta
35
+ @meta ||= YAML.load(raw_meta)
36
+ rescue Psych::SyntaxError => e
37
+ {error: e}
38
+ end
39
+
40
+
41
+ # == Example for meta data usage:
42
+ #
43
+ # Gets the title from the meta data
44
+ #
45
+ # Returns the title or nil
46
+ def meta_title
47
+ meta['title']
48
+ end
49
+
50
+ # == Gets the parsed html without the YAML part
51
+ #
52
+ # Returns a string
53
+ def html_without_yaml
54
+ gollum_page.markup_class.render(raw_data.tap{|s| s.slice!(raw_meta.to_s)})
55
+ end
56
+
57
+ end
58
+ end
@@ -1,4 +1,5 @@
1
1
  module GollumRails
2
+ # Playground
2
3
  module Orm
3
4
  extend ActiveSupport::Concern
4
5
 
@@ -77,6 +77,7 @@ module GollumRails
77
77
 
78
78
  include Error
79
79
  include Core
80
+ include Meta
80
81
  include Store
81
82
  include Validation
82
83
  include Persistance
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gollum_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.14
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Kasper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-21 00:00:00.000000000 Z
11
+ date: 2014-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -163,6 +163,7 @@ files:
163
163
  - lib/gollum_rails/core.rb
164
164
  - lib/gollum_rails/error.rb
165
165
  - lib/gollum_rails/finders.rb
166
+ - lib/gollum_rails/meta.rb
166
167
  - lib/gollum_rails/orm.rb
167
168
  - lib/gollum_rails/page.rb
168
169
  - lib/gollum_rails/persistance.rb