bookmaker 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bookmaker/generator.rb +1 -1
- data/lib/bookmaker/parser/pdf.rb +10 -1
- data/lib/bookmaker/version.rb +1 -1
- data/templates/latex.erb +47 -0
- metadata +18 -18
data/lib/bookmaker/generator.rb
CHANGED
@@ -9,7 +9,7 @@ module Bookmaker
|
|
9
9
|
@name = full_name
|
10
10
|
@uid = Digest::MD5.hexdigest("#{Time.now}--#{rand}")
|
11
11
|
@year = Date.today.year
|
12
|
-
template "config.erb", "_bookmaker
|
12
|
+
template "config.erb", "_bookmaker.yml"
|
13
13
|
end
|
14
14
|
def copy_templates
|
15
15
|
copy_file "latex.erb", "templates/pdf/layout.erb"
|
data/lib/bookmaker/parser/pdf.rb
CHANGED
@@ -8,9 +8,14 @@ module Bookmaker
|
|
8
8
|
entries.keys.each do |chapter|
|
9
9
|
raw << "{::nomarkdown}\\Chapter{#{chapter.split(/_/)[1].gsub('-',' ')}}{:/}"
|
10
10
|
entries[chapter].each do |section|
|
11
|
-
|
11
|
+
s = read_content(section)[0]
|
12
|
+
s.gsub!(/\[([^\]]+?)\]\(([^\)]+?\![^\)]+?)\)/m) { "{::nomarkdown}\\emph{#{$1}}\\index{#{$2}}{:/}" }
|
13
|
+
# puts s
|
14
|
+
# exit
|
15
|
+
raw << "#{s}\n\n* * *"
|
12
16
|
end
|
13
17
|
end
|
18
|
+
|
14
19
|
raw
|
15
20
|
end
|
16
21
|
def parse
|
@@ -20,6 +25,10 @@ module Bookmaker
|
|
20
25
|
File.open(root_dir.join(tex_file), 'w').write(output)
|
21
26
|
spawn_command ["xelatex", tex_file.to_s,]
|
22
27
|
spawn_command ["xelatex", tex_file.to_s,]
|
28
|
+
spawn_command ["makeindex #{name}.idx"]
|
29
|
+
# spawn_command ["makeglossaries #{name}.glo"]
|
30
|
+
spawn_command ["xelatex", tex_file.to_s,]
|
31
|
+
|
23
32
|
spawn_command ["rm *.glo *.idx *.log *.out *.toc *aux"]
|
24
33
|
spawn_command ["mv #{name}.pdf output/#{name}.pdf"]
|
25
34
|
true
|
data/lib/bookmaker/version.rb
CHANGED
data/templates/latex.erb
CHANGED
@@ -196,6 +196,53 @@
|
|
196
196
|
|
197
197
|
<%= contents %>
|
198
198
|
|
199
|
+
% Todolist
|
200
|
+
%
|
201
|
+
% \ifdefined\isdraft
|
202
|
+
% \listoftodos
|
203
|
+
% \fi
|
204
|
+
% Back Matter
|
205
|
+
%
|
199
206
|
\backmatter
|
200
207
|
|
208
|
+
%% Bibliography
|
209
|
+
% \bibliographystyle{\mybibliostyle}
|
210
|
+
% \bibliocommand
|
211
|
+
% \pagestyle{empty}
|
212
|
+
\begin{center}
|
213
|
+
\vspace*{\fill}
|
214
|
+
|
215
|
+
\ifdefined\ReturningCharacters {\Large \par
|
216
|
+
\noindent Thank you for reading
|
217
|
+
|
218
|
+
\vspace*{0.125in}
|
219
|
+
{\LARGE\textbf{\textsf{\thetitle}}}
|
220
|
+
\vspace*{0.125in}
|
221
|
+
|
222
|
+
\par
|
223
|
+
\noindent\ReturningCharacters{} will return in \emph{\NextBook}.} \vspace*{\fill} \fi
|
224
|
+
|
225
|
+
{\LARGE\textbf{\textsf{Follow Me}}}
|
226
|
+
|
227
|
+
\vspace*{0.125in}
|
228
|
+
|
229
|
+
\textbf{\theauthor{}} can be followed on Twitter and Facebook.
|
230
|
+
\newline Visit his web site at http://dausha.net for more information. You can also sign up for announcements of other books in this series at http://dausha.net.
|
231
|
+
|
232
|
+
\vspace*{\fill}
|
233
|
+
\end{center}
|
234
|
+
|
235
|
+
% \notfinal{
|
236
|
+
|
237
|
+
%% Glossary
|
238
|
+
\printglossaries
|
239
|
+
|
240
|
+
%% Index
|
241
|
+
\printindex
|
242
|
+
% }
|
243
|
+
|
244
|
+
% \chapter{Colophon}
|
245
|
+
|
246
|
+
% This book was typeset using the venerable \TeX document markup protocol, using \XeTeX. The \emph{Memoir} class was used for the many features it provided over the standard \emph{Book} class of \TeX{}. \XeTeX{} is distributed at no cost under the \TeX{} Project Public License. Spell checking was done using Aspell. The final version was compiled into the Portable Document Format (PDF) or various epublishing formats, facilitated by use of Make, a utility for automatically building large applications that would otherwise be time-consuming to build through non-automated means.
|
247
|
+
|
201
248
|
\end{document}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookmaker
|
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: 2013-03-
|
12
|
+
date: 2013-03-03 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153103420 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153103420
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: aruba
|
27
|
-
requirement: &
|
27
|
+
requirement: &2153102900 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2153102900
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: cucumber
|
38
|
-
requirement: &
|
38
|
+
requirement: &2153102120 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2153102120
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: eeepub
|
49
|
-
requirement: &
|
49
|
+
requirement: &2153101480 !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: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2153101480
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: kramdown
|
60
|
-
requirement: &
|
60
|
+
requirement: &2153101020 !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: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2153101020
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: thor
|
71
|
-
requirement: &
|
71
|
+
requirement: &2153100380 !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: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2153100380
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: nokogiri
|
82
|
-
requirement: &
|
82
|
+
requirement: &2153099740 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2153099740
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: notifier
|
93
|
-
requirement: &
|
93
|
+
requirement: &2153099060 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2153099060
|
102
102
|
description: ! 'ODO: Write a gem description'
|
103
103
|
email:
|
104
104
|
- dausha@gmail.com
|