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 +4 -4
- data/Gemfile.lock +1 -1
- data/HISTORY.md +5 -0
- data/gollum_rails.gemspec +2 -1
- data/lib/gollum_rails.rb +2 -1
- data/lib/gollum_rails/core.rb +1 -0
- data/lib/gollum_rails/meta.rb +58 -0
- data/lib/gollum_rails/orm.rb +1 -0
- data/lib/gollum_rails/page.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f71884c345d954f3511cf8c6ea58bb840ae6a50
|
4
|
+
data.tar.gz: fff2ffd81c27dcd66a362a834f6518ec8b0e0261
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e65f565da5445905b61693867eb482603a85eea98dd0157346631b89ca1c937bb734d057b8ace2af8009076116632f1ab75b9fbdeb66023adfdcd7a9b1946b9a
|
7
|
+
data.tar.gz: cc49fccfab54ae62599b1800eb512966bd2f6074b4c38c58e436ba2e1217fca4083ee5a594f690f1dd5620a42f7c2df92fc7c83d9b22547ecba9a14e2912998a
|
data/Gemfile.lock
CHANGED
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.
|
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
data/lib/gollum_rails/core.rb
CHANGED
@@ -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
|
data/lib/gollum_rails/orm.rb
CHANGED
data/lib/gollum_rails/page.rb
CHANGED
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
|
+
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-
|
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
|