bookchef 0.1.6

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.
@@ -0,0 +1,101 @@
1
+ <html xmlns:exslt="http://exslt.org/common">
2
+ <head>
3
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4
+ <link href="file://#{gem_path}/stylesheets/css/default.css" rel="stylesheet" type="text/css">
5
+ <meta name="pdfkit-margin_top" content="0.5in">
6
+ <meta name="pdfkit-margin_right" content="0.3in">
7
+ <meta name="pdfkit-margin_bottom" content="0.5in">
8
+ <meta name="pdfkit-margin_left" content="0.8in">
9
+ </head>
10
+ <body>
11
+ <div class="cover">
12
+ <img src="#{source_path}/cover.png">1.0.0</div>
13
+ <div class="tableOfContents">
14
+ <h2>Table of contents</h2>
15
+ <ul>
16
+ <li>Chapter 1. <a href="#/section1/index.xml">Chapter 1 Title</a>
17
+ </li>
18
+ <li>Chapter 2. <a href="#">Chapter 2 Title</a>
19
+ </li>
20
+ </ul>
21
+ </div>
22
+
23
+
24
+
25
+
26
+
27
+ <div class="chapter">
28
+
29
+ <h1 id="/section1/index.xml">Chapter 1. Chapter 1 Title</h1>
30
+ <p>hello world</p>
31
+ <a href="http://hasbrains.ru">Reference 1 text</a>
32
+ <a href="http://google.com">Google</a>
33
+ <i>reference&mdash;link as a term</i> <a href="#/section1/index.xml/reference_1">[1]</a>
34
+ <i>footnote link as a term</i><a href="#/section1/index.xml/footnote_1"><sup>1</sup></a>
35
+ <i>this is a term</i>
36
+ <div class="section">
37
+ <h1 id="/section1/subsection.xml">Subsection title</h1>
38
+ <a href="#/main.xml">Link to the root</a>
39
+ <a href="#/hello/index.xml">Link to the root</a>
40
+
41
+ <a href="#/section1/supersubsection/hello.xml">SuperSubSection hello</a>
42
+ <a href="#/section1/index.xml">Chapter 1 Title</a>
43
+
44
+ <p><a href="#/hello/world.xml">Link to the root</a></p>
45
+ <span class="footnoteSelection">Footnote 1</span><a href="#/section1/index.xml/footnote_1"><sup>1</sup></a>
46
+ <span class="referenceSelection">Reference 1</span> <a href="#/section1/index.xml/reference_1">[1]</a>
47
+ <p class="frameDescription">a description of this code </p>
48
+ <code>&lt;%= link_to %&gt;&lt;a href="hi"&gt;
49
+ &lt;img src="hello.png"/&gt;
50
+ &lt;/a&gt;</code>
51
+ <p class="frameDescription"> </p>
52
+ <code>puts 2 - 1
53
+ puts "some ruby code" &amp;&amp; &lt;
54
+ puts "some more ruby code"
55
+ puts "even more ruby code"
56
+ puts "A ruby is a pink to blood-red colored gemstone, a
57
+ variety of the mineral corundum (aluminium oxide). The red
58
+ color is caused mainly by the presence of the element chromium
59
+ Its name comes from ruber, Latin for red."</code>
60
+
61
+ <span class="code inline">hello world</span>
62
+
63
+
64
+ <span class="name">Name</span>
65
+ <span class="filename">File Name</span>
66
+
67
+ </div>
68
+
69
+ <div class="section">
70
+ <h1 id="/section1/supersubsection/index.xml">SuperSubSection index</h1>
71
+ <div class="section">
72
+ <h1 id="/section1/supersubsection/hello.xml">SuperSubSection hello</h1>
73
+ <span class="referenceSelection">a supersubsection reference link</span> <a href="#/section1/supersubsection/index.xml/reference_1">[1]</a>
74
+ </div>
75
+ <div class="references">
76
+ <div class="reference" id="/section1/supersubsection/index.xml/reference_1">
77
+ <img src="file://#{gem_path}/images/manual_link.png">
78
+ [1] <a href="http://google.com">a supersubsection reference</a>
79
+ </div>
80
+ </div>
81
+ </div>
82
+
83
+ <div class="footnotes">
84
+ <div class="footnote" id="/section1/index.xml/footnote_1">
85
+ <sup>1</sup> Footnote 1 text</div>
86
+ </div>
87
+
88
+ <div class="references">
89
+ <div class="reference" id="/section1/index.xml/reference_1">
90
+ <img src="file://#{gem_path}/images/manual_link.png">
91
+ [1] <a href="http://hasbrains.ru">Reference 1 text</a>
92
+ </div>
93
+ </div>
94
+
95
+ </div>
96
+
97
+ <div class="chapter"><h1 id="">Chapter 2. Chapter 2 Title</h1></div>
98
+ <p>Some other tag</p>
99
+
100
+ </body>
101
+ </html>
@@ -0,0 +1,10 @@
1
+ <book>
2
+
3
+ <cover><img src="cover.png"/><InsertBookVersion/></cover>
4
+
5
+ <chapter src="section1">Chapter 1 Title</chapter>
6
+ <chapter>
7
+ <title>Chapter 2 Title</title>
8
+ </chapter>
9
+ <p>Some other tag</p>
10
+ </book>
@@ -0,0 +1,78 @@
1
+ <book>
2
+
3
+ <settings>
4
+
5
+ <meta name="pdfkit-margin_top" content="0.5in"/>
6
+ <meta name="pdfkit-margin_right" content="0.3in"/>
7
+ <meta name="pdfkit-margin_bottom" content="0.5in"/>
8
+ <meta name="pdfkit-margin_left" content="0.8in"/>
9
+
10
+ </settings>
11
+
12
+ <cover><img src="#{source_path}/cover.png"/><InsertBookVersion/></cover>
13
+
14
+ <chapter id="/section1/index.xml">
15
+
16
+ <title>Chapter 1 Title</title>
17
+ <p>hello world</p>
18
+ <a reference="/section1/index.xml/reference_1" number="1"/>
19
+ <a href="https://google.com">Google</a>
20
+ <term reference="/section1/index.xml/reference_1" number="1">reference - link as a term</term>
21
+ <term footnote="/section1/index.xml/footnote_1" number="1">footnote link as a term</term>
22
+ <term>this is a term</term>
23
+ <section id="/section1/subsection.xml">
24
+ <title>Subsection title</title>
25
+ <a href="#/main.xml">Link to the root</a>
26
+ <a href="#/hello/index.xml">Link to the root</a>
27
+
28
+ <a href="#/section1/supersubsection/hello.xml"/>
29
+ <a href="#/section1/index.xml"/>
30
+
31
+ <p><a href="#/hello/world.xml">Link to the root</a></p>
32
+ <span footnote="/section1/index.xml/footnote_1" number="1">Footnote 1</span>
33
+ <span reference="/section1/index.xml/reference_1" number="1">Reference 1</span>
34
+ <code description="a description of this code">#lt;%= link_to %#gt;&lt;a href="hi"&gt;
35
+ &lt;img src="hello.png"/&gt;
36
+ &lt;/a&gt;</code>
37
+ <code>puts 2 - 1
38
+ puts "some ruby code" #amp;#amp; #lt;
39
+ puts "some more ruby code"
40
+ puts "even more ruby code"
41
+ puts "A ruby is a pink to blood-red colored gemstone, a
42
+ variety of the mineral corundum (aluminium oxide). The red
43
+ color is caused mainly by the presence of the element chromium
44
+ Its name comes from ruber, Latin for red."</code>
45
+
46
+ <code-inline>hello world</code-inline>
47
+
48
+
49
+ <name>Name</name>
50
+ <filename>File Name</filename>
51
+
52
+ </section>
53
+
54
+ <section id="/section1/supersubsection/index.xml">
55
+ <title>SuperSubSection index</title>
56
+ <section id="/section1/supersubsection/hello.xml">
57
+ <title>SuperSubSection hello</title>
58
+ <span reference="/section1/supersubsection/index.xml/reference_1" number="1">a supersubsection reference link</span>
59
+ </section>
60
+ <references>
61
+ <reference id="/section1/supersubsection/index.xml/reference_1" type="manual" url="https://google.com">a supersubsection reference</reference>
62
+ </references>
63
+ </section>
64
+
65
+ <footnotes>
66
+ <footnote id="/section1/index.xml/footnote_1">Footnote 1 text</footnote>
67
+ </footnotes>
68
+
69
+ <references>
70
+ <reference id="/section1/index.xml/reference_1" type="manual" url="http://hasbrains.ru">Reference 1 text</reference>
71
+ </references>
72
+
73
+ </chapter>
74
+
75
+ <chapter><title>Chapter 2 Title</title></chapter>
76
+ <p>Some other tag</p>
77
+
78
+ </book>
@@ -0,0 +1,20 @@
1
+ <section>
2
+ <title>Chapter 1 Title</title>
3
+ <p>hello world</p>
4
+ <a reference="1"/>
5
+ <a href="https://google.com">Google</a>
6
+ <term reference="1">reference - link as a term</term>
7
+ <term footnote="1">footnote link as a term</term>
8
+ <term>this is a term</term>
9
+ <section src="subsection.xml">Subsection title</section>
10
+ <section src="supersubsection"/>
11
+
12
+ <footnotes>
13
+ <footnote id="1">Footnote 1 text</footnote>
14
+ </footnotes>
15
+
16
+ <references>
17
+ <reference id="1" type="manual" url="http://hasbrains.ru">Reference 1 text</reference>
18
+ </references>
19
+
20
+ </section>
@@ -0,0 +1,23 @@
1
+ <section>
2
+ <title>Subsection title</title>
3
+ <a href="../main.xml">Link to the root</a>
4
+ <a href="../hello/">Link to the root</a>
5
+ <a href="supersubsection/hello.xml"/>
6
+ <a href="index.xml"/>
7
+ <p><a href="../hello/world.xml">Link to the root</a></p>
8
+ <span footnote="1">Footnote 1</span>
9
+ <span reference="1">Reference 1</span>
10
+ <code description="a description of this code"><%= link_to %><a href="hi"><img src="hello.png"/></a></code>
11
+ <code>
12
+ puts 2 - 1
13
+ puts "some ruby code" && &lt;
14
+ puts "some more ruby code"
15
+ puts "even more ruby code"
16
+ puts "A ruby is a pink to blood-red colored gemstone, a variety of the mineral corundum (aluminium oxide). The red color is caused mainly by the presence of the element chromium. Its name comes from ruber, Latin for red."
17
+ </code>
18
+
19
+ <code-inline>hello world</code:inline>
20
+ <name>Name</name>
21
+ <filename>File Name</filename>
22
+
23
+ </section>
@@ -0,0 +1,6 @@
1
+ <section>
2
+ <title>SuperSubSection hello</title>
3
+
4
+ <span reference="1">a supersubsection reference link</span>
5
+
6
+ </section>
@@ -0,0 +1,11 @@
1
+ <section>
2
+
3
+ <title>SuperSubSection index</title>
4
+
5
+ <section src="hello.xml"/>
6
+
7
+ <references>
8
+ <reference id="1" type="manual" url="https://google.com">a supersubsection reference</reference>
9
+ </references>
10
+
11
+ </section>
@@ -0,0 +1,8 @@
1
+ <settings>
2
+
3
+ <meta name="pdfkit-margin_top" content="0.5in"/>
4
+ <meta name="pdfkit-margin_right" content="0.3in"/>
5
+ <meta name="pdfkit-margin_bottom" content="0.5in"/>
6
+ <meta name="pdfkit-margin_left" content="0.8in"/>
7
+
8
+ </settings>
@@ -0,0 +1,24 @@
1
+ require "spec_helper"
2
+
3
+ describe BookChef::Compiler::HTML do
4
+
5
+ before(:each) do
6
+ @book_dir = File.expand_path(File.dirname(__FILE__) + '/../../../fixtures/book')
7
+ end
8
+
9
+ it "converts xml tags into html" do
10
+ source_xml = File.read("#@book_dir/merge_expected.xml").gsub('#{source_path}', "file://#@book_dir")
11
+ source_xml.gsub!("<book>", "<book version=\"1.0.0\">")
12
+ converter = BookChef::Compiler::HTML.new(source_xml)
13
+ converter.run
14
+ converter.save_to("#@book_dir/html_converted.html")
15
+
16
+ converted_html = File.read("#@book_dir/html_converted.html")
17
+ expected_html = File.read("#@book_dir/html_expected.html").gsub('#{gem_path}', BookChef::LIB_PATH).gsub('#{source_path}', "file://#@book_dir")
18
+
19
+ File.unlink "#{@book_dir}/html_converted.html"
20
+
21
+ converted_html.should == expected_html
22
+ end
23
+
24
+ end
@@ -0,0 +1,23 @@
1
+ require "spec_helper"
2
+ require "equivalent-xml"
3
+
4
+ describe BookChef::TreeMerger do
5
+
6
+ before(:each) do
7
+ @book_dir = File.expand_path(File.dirname(__FILE__) + '/../../fixtures/book')
8
+ end
9
+
10
+ it "follows src= args in tags and merges files into one" do
11
+ merger = BookChef::TreeMerger.new(@book_dir, "main.xml")
12
+ merger.run
13
+ merger.save_to "#{@book_dir}/merge_saved.xml"
14
+
15
+ merge_saved = Nokogiri::XML.parse File.new("#{@book_dir}/merge_saved.xml")
16
+ merge_expected = Nokogiri::XML.parse(File.read("#{@book_dir}/merge_expected.xml").gsub('#{source_path}', "file://#@book_dir"))
17
+ File.unlink "#{@book_dir}/merge_saved.xml"
18
+
19
+ merge_saved.should be_equivalent_to(merge_expected)
20
+ end
21
+
22
+
23
+ end
@@ -0,0 +1,8 @@
1
+ require "rubygems"
2
+ require "bundler/setup"
3
+ require File.dirname(__FILE__) + "/../lib/bookchef.rb"
4
+
5
+ RSpec.configure do |config|
6
+ # Use color in STDOUT
7
+ config.color_enabled = true
8
+ end
metadata ADDED
@@ -0,0 +1,243 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bookchef
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.6
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Roman Snitko
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-09-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: pdfkit
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - '='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.5.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - '='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.5.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: nokogiri
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: ruby-xslt
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rdoc
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: bundler
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: jeweler
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: rspec
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: sass
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: equivalent-xml
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: nokogiri-diff
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ description:
175
+ email: roman.snitko@gmail.com
176
+ executables:
177
+ - bookchef
178
+ extensions: []
179
+ extra_rdoc_files:
180
+ - LICENSE.txt
181
+ files:
182
+ - .document
183
+ - Gemfile
184
+ - Gemfile.lock
185
+ - LICENSE.txt
186
+ - Rakefile
187
+ - VERSION
188
+ - bin/bookchef
189
+ - lib/bookchef.rb
190
+ - lib/bookchef/compilers/html.rb
191
+ - lib/bookchef/compilers/pdf.rb
192
+ - lib/bookchef/images/article_link.png
193
+ - lib/bookchef/images/book_link.png
194
+ - lib/bookchef/images/external_link.png
195
+ - lib/bookchef/images/lib_link.png
196
+ - lib/bookchef/images/manual_link.png
197
+ - lib/bookchef/images/video_link.png
198
+ - lib/bookchef/images/website_link.png
199
+ - lib/bookchef/stylesheets/css/default.css
200
+ - lib/bookchef/stylesheets/scss/default.scss
201
+ - lib/bookchef/stylesheets/xslt/bookchef_to_html.xsl
202
+ - lib/bookchef/templates/footer.html
203
+ - lib/bookchef/tree_merger.rb
204
+ - spec/fixtures/book/html_expected.html
205
+ - spec/fixtures/book/main.xml
206
+ - spec/fixtures/book/merge_expected.xml
207
+ - spec/fixtures/book/section1/index.xml
208
+ - spec/fixtures/book/section1/subsection.xml
209
+ - spec/fixtures/book/section1/supersubsection/hello.xml
210
+ - spec/fixtures/book/section1/supersubsection/index.xml
211
+ - spec/fixtures/book/settings.xml
212
+ - spec/lib/bookchef/compilers/html_spec.rb
213
+ - spec/lib/bookchef/tree_merger_spec.rb
214
+ - spec/spec_helper.rb
215
+ homepage: http://github.com/snitko/bookchef
216
+ licenses:
217
+ - MIT
218
+ post_install_message:
219
+ rdoc_options: []
220
+ require_paths:
221
+ - lib
222
+ required_ruby_version: !ruby/object:Gem::Requirement
223
+ none: false
224
+ requirements:
225
+ - - ! '>='
226
+ - !ruby/object:Gem::Version
227
+ version: '0'
228
+ segments:
229
+ - 0
230
+ hash: 997388749527007355
231
+ required_rubygems_version: !ruby/object:Gem::Requirement
232
+ none: false
233
+ requirements:
234
+ - - ! '>='
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ requirements: []
238
+ rubyforge_project:
239
+ rubygems_version: 1.8.24
240
+ signing_key:
241
+ specification_version: 3
242
+ summary: Parser and compiler for BookChef.xml format
243
+ test_files: []