md_splitter 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
data/README
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
Accepts a markdown file as input and uses Kramdown to convert to HTML. Optionally splits the source document using a given string and saves multiple output docs.
|
4
4
|
|
5
|
+
## Change Log
|
6
|
+
|
7
|
+
### V0.2.0
|
8
|
+
|
9
|
+
* Prepend page id's in the manifest with the sanitized manifest id
|
10
|
+
|
5
11
|
## Install ##
|
6
12
|
|
7
13
|
% gem install md_splitter
|
@@ -15,7 +15,8 @@ module MdSplitter
|
|
15
15
|
# - ++ ->
|
16
16
|
#
|
17
17
|
def initialize
|
18
|
-
@raw_object = {}
|
18
|
+
@raw_object = {}
|
19
|
+
@logger = Logger.new(STDOUT)
|
19
20
|
end
|
20
21
|
|
21
22
|
#
|
@@ -53,20 +54,21 @@ module MdSplitter
|
|
53
54
|
private
|
54
55
|
|
55
56
|
def build_manifest_object items, id = nil
|
57
|
+
@logger.debug "Creating manifest with id: #{id}"
|
56
58
|
pages = Array.new
|
57
|
-
id = encode_string id
|
59
|
+
@id = encode_string id
|
58
60
|
items.each do |item|
|
59
61
|
pages << get_page_object(item)
|
60
62
|
end
|
61
63
|
obj = {
|
62
|
-
:id => id,
|
64
|
+
:id => @id,
|
63
65
|
:pages => pages
|
64
66
|
}
|
65
67
|
end
|
66
68
|
|
67
69
|
def get_page_object item
|
68
70
|
{
|
69
|
-
:id => File.basename(item, File.extname(item)),
|
71
|
+
:id => [@id, File.basename(item, File.extname(item))].join("_"),
|
70
72
|
:title => File.basename(item, File.extname(item)).humanize.titleize,
|
71
73
|
:url => File.basename(item)
|
72
74
|
}
|
data/lib/md_splitter/version.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
require 'md_splitter/elf_manifest_builder'
|
2
|
+
require 'logger'
|
2
3
|
require 'base64'
|
3
4
|
|
4
|
-
describe "ELF manifest builder." do
|
5
|
+
describe "ELF manifest builder." do
|
6
|
+
before(:all) do
|
7
|
+
@logger = Logger.new(STDOUT)
|
8
|
+
end
|
9
|
+
|
5
10
|
before(:each) do
|
6
11
|
@manifest_id = 'this/is/a/./path'
|
7
12
|
@page_list = get_test_page_list
|
@@ -27,6 +32,7 @@ describe "ELF manifest builder." do
|
|
27
32
|
end
|
28
33
|
|
29
34
|
it "should properly encode the id provided" do
|
35
|
+
@logger.debug("manifest id: #{@result[:id]}")
|
30
36
|
@result[:id].should eq 'this_is_a_path'
|
31
37
|
end
|
32
38
|
|
@@ -45,11 +51,13 @@ describe "ELF manifest builder." do
|
|
45
51
|
it "should have an id" do
|
46
52
|
@result[:pages].each do |page|
|
47
53
|
page[:id].should be_a String
|
54
|
+
@logger.debug "page id: #{page[:id]}"
|
48
55
|
end
|
49
56
|
end
|
50
57
|
it "should have a title" do
|
51
58
|
@result[:pages].each do |page|
|
52
59
|
page[:title].should be_a String
|
60
|
+
@logger.debug "page title: #{page[:title]}"
|
53
61
|
end
|
54
62
|
end
|
55
63
|
it "should have a url" do
|
@@ -60,7 +68,7 @@ describe "ELF manifest builder." do
|
|
60
68
|
|
61
69
|
it "ids should match source item ids" do
|
62
70
|
get_test_page_list.each_index do |i|
|
63
|
-
@result[:pages][i][:id].should eq
|
71
|
+
@result[:pages][i][:id].should eq get_test_page_list_ids[i]
|
64
72
|
end
|
65
73
|
end
|
66
74
|
|
@@ -82,7 +90,7 @@ describe "ELF manifest builder." do
|
|
82
90
|
describe "Return json manifest" do
|
83
91
|
it "json manifest should be a string" do
|
84
92
|
@subject.json.should be_a String
|
85
|
-
|
93
|
+
@logger.debug @subject.json
|
86
94
|
end
|
87
95
|
|
88
96
|
it "should be parsable as a json object" do
|
@@ -106,7 +114,7 @@ def get_test_page_list_titles
|
|
106
114
|
end
|
107
115
|
|
108
116
|
def get_test_page_list_ids
|
109
|
-
return ['
|
117
|
+
return ['this_is_a_path_page_number_1', 'this_is_a_path_page_number_2', 'this_is_a_path_page_number_3']
|
110
118
|
end
|
111
119
|
|
112
120
|
def get_test_result
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: md_splitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-04-24 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70281330868500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.9.2
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70281330868500
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &70281330867560 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.0.21
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70281330867560
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70281330866620 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.7.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70281330866620
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: guard-rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &70281330866040 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70281330866040
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: growl
|
60
|
-
requirement: &
|
60
|
+
requirement: &70281330853020 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70281330853020
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rb-fsevent
|
71
|
-
requirement: &
|
71
|
+
requirement: &70281330852240 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70281330852240
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: kramdown
|
82
|
-
requirement: &
|
82
|
+
requirement: &70281330851480 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 0.13.3
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70281330851480
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: commander
|
93
|
-
requirement: &
|
93
|
+
requirement: &70281330850580 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 4.0.6
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70281330850580
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: json
|
104
|
-
requirement: &
|
104
|
+
requirement: &70281330849780 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: 1.6.1
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70281330849780
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: uuidtools
|
115
|
-
requirement: &
|
115
|
+
requirement: &70281330848880 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: 2.1.2
|
121
121
|
type: :runtime
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70281330848880
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: active_support
|
126
|
-
requirement: &
|
126
|
+
requirement: &70281330848120 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ~>
|
@@ -131,7 +131,7 @@ dependencies:
|
|
131
131
|
version: 3.0.0
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70281330848120
|
135
135
|
description: Parses md docs for split markers and produces multiple html files and
|
136
136
|
a json manifest
|
137
137
|
email:
|
@@ -165,8 +165,8 @@ files:
|
|
165
165
|
- spec/fixtures/sample/sample_3.html
|
166
166
|
- spec/fixtures/sample/sample_4.html
|
167
167
|
- spec/fixtures/split_me.md
|
168
|
-
- spec/
|
169
|
-
- spec/
|
168
|
+
- spec/lib/md_splitter/manifest_builder_spec.rb
|
169
|
+
- spec/lib/md_splitter/splitter_spec.rb
|
170
170
|
homepage: ''
|
171
171
|
licenses: []
|
172
172
|
post_install_message:
|
@@ -181,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
segments:
|
183
183
|
- 0
|
184
|
-
hash:
|
184
|
+
hash: 451883338566065726
|
185
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
186
|
none: false
|
187
187
|
requirements:
|
@@ -190,10 +190,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
version: '0'
|
191
191
|
segments:
|
192
192
|
- 0
|
193
|
-
hash:
|
193
|
+
hash: 451883338566065726
|
194
194
|
requirements: []
|
195
195
|
rubyforge_project: md_splitter
|
196
|
-
rubygems_version: 1.8.
|
196
|
+
rubygems_version: 1.8.15
|
197
197
|
signing_key:
|
198
198
|
specification_version: 3
|
199
199
|
summary: Prepares Markdown docs for web delivery
|
@@ -207,5 +207,5 @@ test_files:
|
|
207
207
|
- spec/fixtures/sample/sample_3.html
|
208
208
|
- spec/fixtures/sample/sample_4.html
|
209
209
|
- spec/fixtures/split_me.md
|
210
|
-
- spec/
|
211
|
-
- spec/
|
210
|
+
- spec/lib/md_splitter/manifest_builder_spec.rb
|
211
|
+
- spec/lib/md_splitter/splitter_spec.rb
|