rack-blogengine 0.2.2 → 0.2.3
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be673f3f32e05e24da51c8cf90e8ef3904df61b8
|
4
|
+
data.tar.gz: c960faa025ed506ae5c96737de9126de91bdd356
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5003c80502f0b50d63c1157fbec62be65fd530417a21c03b8cbbf83a0058b8f4213bc1664187fb4f84e834494465fc85610f9490cb8c461af2c91f6d33a8f30b
|
7
|
+
data.tar.gz: 82c214bc379dea1aa34092306f99966e4e6ec087e15244122bac5f800722ad5d9ad1889317e8ff5a3f0146187167a9e6d3e763e1974981c2f0a130a13b8b82e4
|
@@ -28,9 +28,14 @@ module Rack
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
|
31
|
+
# if no document matches -> return error page
|
32
|
+
return errorpage(env, documents)
|
33
|
+
end
|
34
|
+
|
35
|
+
def errorpage(env, documents)
|
36
|
+
{ 'path' => env['PATH_INFO'],
|
32
37
|
'response' =>
|
33
|
-
[404, { 'Content-Type' => 'text/html; charset=UTF-8' }, ['Page not found
|
38
|
+
[404, { 'Content-Type' => 'text/html; charset=UTF-8' }, ['Page not found']]
|
34
39
|
}
|
35
40
|
end
|
36
41
|
end
|
@@ -68,22 +68,34 @@ module Rack
|
|
68
68
|
|
69
69
|
if contentblock.include? '[title]:'
|
70
70
|
contentblock['[title]:'] = ''
|
71
|
-
|
71
|
+
if contentblock.empty?
|
72
|
+
raise "Title in #{file} is empty"
|
73
|
+
else
|
74
|
+
@title = contentblock.strip
|
75
|
+
end
|
72
76
|
end
|
73
77
|
|
74
78
|
if contentblock.include? '[content]:'
|
75
79
|
contentblock['[content]:'] = ''
|
76
|
-
|
80
|
+
if contentblock.empty?
|
81
|
+
raise "Content in #{file} is empty"
|
82
|
+
else
|
83
|
+
@content = contentblock.strip
|
84
|
+
end
|
77
85
|
end
|
78
86
|
|
79
87
|
if contentblock.include? '[date]:'
|
80
88
|
contentblock['[date]:'] = ''
|
81
|
-
|
82
|
-
|
83
|
-
date
|
89
|
+
if /\d/.match( contentblock )
|
90
|
+
datearray = contentblock.split(',')
|
91
|
+
datearray = datearray.map do |date|
|
92
|
+
date.to_i
|
93
|
+
end
|
94
|
+
|
95
|
+
@date = Date.new(datearray[0], datearray[1], datearray[2])
|
96
|
+
else
|
97
|
+
raise "Invalid Date in #{file}\n [date]:#{contentblock}[/date]"
|
84
98
|
end
|
85
|
-
|
86
|
-
@date = Date.new(datearray[0], datearray[1], datearray[2])
|
87
99
|
end
|
88
100
|
end
|
89
101
|
end
|
@@ -9,7 +9,7 @@ class Operator
|
|
9
9
|
Dir.foreach("#{target}/operator/") do |item|
|
10
10
|
extension = item.split('.')[1]
|
11
11
|
next if item == '.' || item == '..' || extension != 'rb'
|
12
|
-
require "#{
|
12
|
+
require "#{target}/operator/#{item}"
|
13
13
|
end
|
14
14
|
|
15
15
|
extend UserOperator # load user operators
|
@@ -39,7 +39,7 @@ class DocumentTest < MiniTest::Unit::TestCase
|
|
39
39
|
document = Rack::Blogengine::Document.new
|
40
40
|
document.html = '{% test_operator %}'
|
41
41
|
|
42
|
-
document.exec_content_operator(document,
|
42
|
+
document.exec_content_operator(document, "#{testpath}")
|
43
43
|
|
44
44
|
assert_equal('test', document.html, 'Documents html should contain test_operators return value')
|
45
45
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-blogengine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benny1992
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-17 00:00:00 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: &id001 !ruby/object:Gem::Requirement
|