xpub 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,376 @@
1
+ \documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
2
+
3
+ %
4
+ % macro ルビ usage: \ruby{漢}{かん}\ruby{字}{じ}
5
+ %
6
+ \def\ruby#1#2{%
7
+ \leavevmode
8
+ \setbox0=\hbox{#1}\setbox1=\hbox{\tiny#2}%
9
+ \ifdim\wd0>\wd1 \dimen0=\wd0 \else \dimen0=\wd1 \fi
10
+ \hbox{\kanjiskip=\fill
11
+ \vbox{\hbox to \dimen0{\tiny \hfil#2\hfil}%
12
+ \nointerlineskip
13
+ \hbox to \dimen0{\hfil#1\hfil}}}}
14
+
15
+ % セクションの文字サイズ変更
16
+
17
+ \makeatletter
18
+ \renewcommand{\section}{\@startsection{section}{1}{\z@}%
19
+ {1\Cvs \@plus.5\Cvs \@minus.2\Cvs}%
20
+ {.5\Cvs \@plus.3\Cvs}%
21
+ {\reset@font\large\bfseries}}
22
+ \makeatother
23
+
24
+ % サブセクションの文字サイズ変更
25
+
26
+ \makeatletter
27
+ \renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}%
28
+ {1\Cvs \@plus.5\Cvs \@minus.2\Cvs}%
29
+ {.5\Cvs \@plus.3\Cvs}%
30
+ {\reset@font\normalsize\bfseries}}
31
+ \makeatother
32
+
33
+ % chapterの文字サイズ変更
34
+
35
+ \makeatletter
36
+ \renewcommand{\chapter}{%
37
+ \if@openright\cleardoublepage\else\clearpage\fi
38
+ \thispagestyle{jpl@in}%
39
+ \global\@topnum\z@
40
+ \@afterindenttrue
41
+ \secdef\@chapter\@schapter}
42
+ \def\@chapter[#1]#2{%
43
+ \ifnum \c@secnumdepth >\m@ne
44
+ \if@mainmatter
45
+ \refstepcounter{chapter}%
46
+ \typeout{\@chapapp\space\thechapter\space\@chappos}%
47
+ \addcontentsline{toc}{chapter}%
48
+ {\protect\numberline{\@chapapp\thechapter\@chappos}#1}%
49
+ \else\addcontentsline{toc}{chapter}{#1}\fi
50
+ \else
51
+ \addcontentsline{toc}{chapter}{#1}%
52
+ \fi
53
+ \chaptermark{#1}%
54
+ \addtocontents{lof}{\protect\addvspace{10\p@}}%
55
+ \addtocontents{lot}{\protect\addvspace{10\p@}}%
56
+ \@makechapterhead{#2}\@afterheading}
57
+ \def\@makechapterhead#1{\hbox{}%
58
+ \vskip0\Cvs
59
+ {\parindent\z@
60
+ \raggedright
61
+ \reset@font\large\bfseries
62
+ \leavevmode
63
+ \ifnum \c@secnumdepth >\m@ne
64
+ \setlength\@tempdima{\linewidth}%
65
+ \if@mainmatter
66
+ \setbox\z@\hbox{\@chapapp\thechapter\@chappos\hskip1zw}%
67
+ \addtolength\@tempdima{-\wd\z@}%
68
+ \unhbox\z@\nobreak
69
+ \fi
70
+ \vtop{\hsize\@tempdima#1}%
71
+ \else
72
+ #1\relax
73
+ \fi}\nobreak\vskip0.1\Cvs}
74
+ \def\@schapter#1{%
75
+ \@makeschapterhead{#1}\@afterheading
76
+ }
77
+ \def\@makeschapterhead#1{\hbox{}%
78
+ \vskip0.1\Cvs
79
+ {\parindent\z@
80
+ \raggedright
81
+ \reset@font\large\bfseries
82
+ \leavevmode
83
+ \setlength\@tempdima{\linewidth}%
84
+ \vtop{\hsize\@tempdima#1}}\vskip0.1\Cvs}
85
+ \makeatother
86
+
87
+ % 2カラムの幅
88
+ \iftdir
89
+ \makeatletter
90
+ \if@stysize
91
+ \setlength\columnsep{1\Cwd}
92
+ \else
93
+ \setlength\columnsep{10\p@}
94
+ \fi
95
+ \makeatother
96
+ \addtolength\textwidth{0.4in}
97
+ \fi
98
+ \addtolength\topmargin{-0.4in}
99
+
100
+ % フォントの多様化
101
+ \usepackage[uplatex,deluxe]{otf}
102
+
103
+ $if(fontfamily)$
104
+ \usepackage{$fontfamily$}
105
+ $else$
106
+ \usepackage{lmodern}
107
+ $endif$
108
+ $if(linestretch)$
109
+ \usepackage{setspace}
110
+ \setstretch{$linestretch$}
111
+ $endif$
112
+ \usepackage{amssymb,amsmath}
113
+ \usepackage{ifxetex,ifluatex}
114
+ \usepackage{fixltx2e} % provides \textsubscript
115
+ \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
116
+ \usepackage[T1]{fontenc}
117
+ \usepackage[utf8]{inputenc}
118
+ $if(euro)$
119
+ \usepackage{eurosym}
120
+ $endif$
121
+ \else % if luatex or xelatex
122
+ \ifxetex
123
+ \usepackage{mathspec}
124
+ \usepackage{xltxtra,xunicode}
125
+ \else
126
+ \usepackage{fontspec}
127
+ \fi
128
+ \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
129
+ \newcommand{\euro}{€}
130
+ $if(mainfont)$
131
+ \setmainfont{$mainfont$}
132
+ $endif$
133
+ $if(sansfont)$
134
+ \setsansfont{$sansfont$}
135
+ $endif$
136
+ $if(monofont)$
137
+ \setmonofont[Mapping=tex-ansi]{$monofont$}
138
+ $endif$
139
+ $if(mathfont)$
140
+ \setmathfont(Digits,Latin,Greek){$mathfont$}
141
+ $endif$
142
+ \fi
143
+ % use upquote if available, for straight quotes in verbatim environments
144
+ \IfFileExists{upquote.sty}{\usepackage{upquote}}{}
145
+ $if(geometry)$
146
+ \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
147
+ $endif$
148
+ $if(lang)$
149
+ \ifxetex
150
+ \usepackage{polyglossia}
151
+ \setmainlanguage{$mainlang$}
152
+ \else
153
+ \usepackage[shorthands=off,$lang$]{babel}
154
+ \fi
155
+ $endif$
156
+ $if(natbib)$
157
+ \usepackage{natbib}
158
+ \bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
159
+ $endif$
160
+ $if(biblatex)$
161
+ \usepackage{biblatex}
162
+ $if(biblio-files)$
163
+ \bibliography{$biblio-files$}
164
+ $endif$
165
+ $endif$
166
+ $if(listings)$
167
+ \usepackage{listings}
168
+ $endif$
169
+ $if(lhs)$
170
+ \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
171
+ $endif$
172
+ $if(highlighting-macros)$
173
+ $highlighting-macros$
174
+ $endif$
175
+ $if(verbatim-in-note)$
176
+ \usepackage{fancyvrb}
177
+ \VerbatimFootnotes
178
+ $endif$
179
+ $if(tables)$
180
+ \usepackage{longtable,booktabs}
181
+ $endif$
182
+ \usepackage{plext}
183
+ \usepackage[dvipdfmx]{graphicx}
184
+ \usepackage[dvipdfmx]{color}
185
+
186
+ % 画像サイズを置き換え
187
+ \let\Oldincludegraphics\includegraphics
188
+ \makeatletter
189
+ \if@twocolumn\renewcommand{\includegraphics}[2][totalheight=0.5\textheight]{\ifydir\Oldincludegraphics[width=0.45\textwidth,#1]{#2}\else\Oldincludegraphics[angle=90,width=0.5\textwidth,#1]{#2}\fi}
190
+ \else\renewcommand{\includegraphics}[2][totalheight=\textheight]{\ifydir\Oldincludegraphics[width=1\textwidth,#1]{#2}\else\Oldincludegraphics[angle=90,width=\textwidth,#1]{#2}\fi}\fi
191
+ \makeatother
192
+
193
+ % カラム切り替えのタイミングで画像のサイズも調整する
194
+ \let\Oldtwocolumn\twocolumn
195
+ \let\Oldonecolumn\onecolumn
196
+ \makeatletter
197
+ \def\twocolumn{\Oldtwocolumn\renewcommand{\includegraphics}[2][totalheight=0.5\textheight]{\ifydir\Oldincludegraphics[width=0.45\textwidth,##1]{##2}\else\Oldincludegraphics[angle=90,width=0.5\textwidth,##1]{##2}\fi}}
198
+ \def\onecolumn{\Oldonecolumn\renewcommand{\includegraphics}[2][totalheight=\textheight]{\ifydir\Oldincludegraphics[width=1\textwidth,##1]{##2}\else\Oldincludegraphics[angle=90,width=\textwidth,##1]{##2}\fi}}
199
+ \makeatother
200
+
201
+ % 目次 ?
202
+ \makeatletter
203
+ \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
204
+ \def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
205
+ \makeatother
206
+ % Scale images if necessary, so that they will not overflow the page
207
+ % margins by default, and it is still possible to overwrite the defaults
208
+ % using explicit options in \includegraphics[width, height, ...]{}
209
+ \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
210
+ \ifxetex
211
+ \usepackage[setpagesize=false, % page size defined by xetex
212
+ unicode=false, % unicode breaks when used with xetex
213
+ xetex]{hyperref}
214
+ \else
215
+ \usepackage[unicode=true]{hyperref}
216
+ \fi
217
+ \hypersetup{breaklinks=true,
218
+ bookmarks=true,
219
+ pdfauthor={$author-meta$},
220
+ pdftitle={$title-meta$},
221
+ colorlinks=false,
222
+ citecolor=$if(citecolor)$$citecolor$$else$blue$endif$,
223
+ urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
224
+ linkcolor=$if(linkcolor)$$linkcolor$$else$black$endif$,
225
+ pdfborder={0 0 0}}
226
+ \urlstyle{same} % don't use monospace font for urls
227
+
228
+ \makeatletter
229
+ \def\contentsline#1#2#3#4{%
230
+ \begingroup
231
+ \Hy@safe@activestrue
232
+ \edef\x{\endgroup
233
+ \def\noexpand\Hy@tocdestname{#4}%
234
+ }\x
235
+ \ifx\Hy@tocdestname\ltx@empty
236
+ \csname l@#1\endcsname{#2}{#3}%
237
+ \else
238
+ \ifcase\Hy@linktoc % none
239
+ \csname l@#1\endcsname{#2}{#3}%
240
+ \or % section
241
+ \csname l@#1\endcsname{%
242
+ \hyper@linkstart{link}{\Hy@tocdestname}{#2}\hyper@linkend
243
+ }{\pbox<y>{#3}}%
244
+ \or % page
245
+ \def\Hy@temp{#3}%
246
+ \ifx\Hy@temp\ltx@empty
247
+ \csname l@#1\endcsname{#2}{#3}%
248
+ \else
249
+ \csname l@#1\endcsname{{#2}}{%
250
+ \hyper@linkstart{link}{\Hy@tocdestname}{#3}\hyper@linkend
251
+ }%
252
+ \fi
253
+ \else % all
254
+ \def\Hy@temp{#3}%
255
+ \ifx\Hy@temp\ltx@empty
256
+ \csname l@#1\endcsname{%
257
+ \hyper@linkstart{link}{\Hy@tocdestname}{#2}\hyper@linkend
258
+ }{}%
259
+ \else
260
+ \csname l@#1\endcsname{%
261
+ \hyper@linkstart{link}{\Hy@tocdestname}{#2}\hyper@linkend
262
+ }{%
263
+ \hyper@linkstart{link}{\Hy@tocdestname}{#3}\hyper@linkend
264
+ }%
265
+ \fi
266
+ \fi
267
+ \fi
268
+ \vspace{-5mm}
269
+ }
270
+ \makeatother
271
+
272
+ $if(links-as-notes)$
273
+ % Make links footnotes instead of hotlinks:
274
+ \renewcommand{\href}[2]{#2\footnote{\url{#1}}}
275
+ $endif$
276
+ $if(strikeout)$
277
+ \usepackage[normalem]{ulem}
278
+ % avoid problems with \sout in headers with hyperref:
279
+ \pdfstringdefDisableCommands{\renewcommand{\sout}{}}
280
+ $endif$
281
+ \setlength{\parindent}{0pt}
282
+ \setlength{\parskip}{6pt plus 2pt minus 1pt}
283
+ \setlength{\emergencystretch}{3em} % prevent overfull lines
284
+ $if(numbersections)$
285
+ \setcounter{secnumdepth}{5}
286
+ $else$
287
+ \setcounter{secnumdepth}{0}
288
+ $endif$
289
+ $if(verbatim-in-note)$
290
+ \VerbatimFootnotes % allows verbatim text in footnotes
291
+ $endif$
292
+
293
+ % タイトル
294
+ $if(title)$
295
+ \title{$title$$if(subtitle)$\\\vspace{0.5em}{\large $subtitle$}$endif$}
296
+ $endif$
297
+ $if(author)$
298
+ \author{$for(author)$$author$$sep$ \and $endfor$}
299
+ $endif$
300
+ \date{$date$}
301
+ $for(header-includes)$
302
+ $header-includes$
303
+ $endfor$
304
+
305
+ % 章の名前付け
306
+ $if(prepartname)$
307
+ \renewcommand{\prepartname}{$prepartname$}
308
+ $endif$
309
+ $if(postpartname)$
310
+ \renewcommand{\postpartname}{$postpartname$}
311
+ $endif$
312
+ $if(prechaptername)$
313
+ \renewcommand{\prechaptername}{$prechaptername$}
314
+ $endif$
315
+ $if(postchaptername)$
316
+ \renewcommand{\postchaptername}{$postchaptername$}
317
+ $endif$
318
+
319
+
320
+ \begin{document}
321
+
322
+ \include{$book_name$.before_body}
323
+
324
+ $if(title)$
325
+ \maketitle
326
+ $endif$
327
+
328
+ %\typeout{<<<}
329
+ %\typeout{paperheight:\the\paperheight}
330
+
331
+ $for(include-before)$
332
+ $include-before$
333
+
334
+ $endfor$
335
+ $if(toc)$
336
+ {
337
+ %\hypersetup{linkcolor=black}
338
+ \setcounter{tocdepth}{1}%$toc-depth$}
339
+ \tableofcontents
340
+ }
341
+ $endif$
342
+ $if(lot)$
343
+ \listoftables
344
+ $endif$
345
+ $if(lof)$
346
+ \listoffigures
347
+ $endif$
348
+
349
+ $body$
350
+
351
+ $if(natbib)$
352
+ $if(biblio-files)$
353
+ $if(biblio-title)$
354
+ $if(book-class)$
355
+ \renewcommand\bibname{$biblio-title$}
356
+ $else$
357
+ \renewcommand\refname{$biblio-title$}
358
+ $endif$
359
+ $endif$
360
+ \bibliography{$biblio-files$}
361
+
362
+ $endif$
363
+ $endif$
364
+ $if(biblatex)$
365
+ \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
366
+
367
+ $endif$
368
+
369
+ $for(include-after)$
370
+ $include-after$
371
+
372
+ $endfor$
373
+
374
+ \include{$book_name$.after_body}
375
+
376
+ \end{document}
data/skel/tmp/.gitkeep ADDED
File without changes
data/xpub.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'xpub/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "xpub"
8
+ spec.version = Xpub::VERSION
9
+ spec.authors = ["Yoshihisa AMAKATA"]
10
+ spec.email = ["amakata@gmail.com"]
11
+ spec.summary = %q{Xpub is EPUB and PDF publisher.}
12
+ spec.description = %q{Xpub is EPUB and PDF publisher.}
13
+ spec.homepage = "https://github.com/Amakata/xpub"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+
24
+ spec.add_dependency 'rainbow', '~> 2.0.0'
25
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xpub
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Yoshihisa AMAKATA
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rainbow
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 2.0.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 2.0.0
55
+ description: Xpub is EPUB and PDF publisher.
56
+ email:
57
+ - amakata@gmail.com
58
+ executables:
59
+ - xpub
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/xpub
69
+ - lib/xpub.rb
70
+ - lib/xpub/dsl/book.rb
71
+ - lib/xpub/dsl/builder.rb
72
+ - lib/xpub/dsl/page.rb
73
+ - lib/xpub/dsl/src_file.rb
74
+ - lib/xpub/version.rb
75
+ - skel/.gitignore
76
+ - skel/Xpub
77
+ - skel/output/.gitkeep
78
+ - skel/src/.gitkeep
79
+ - skel/src/sample.md
80
+ - skel/src/sample1.jpg
81
+ - skel/theme/default/epub/epub.css
82
+ - skel/theme/default/epub/metadata.dat.erb
83
+ - skel/theme/default/epub/pandoc-filter.rb
84
+ - skel/theme/default/epub/template.html
85
+ - skel/theme/default/latex/pandoc-filter.rb
86
+ - skel/theme/default/latex/template.tex
87
+ - skel/tmp/.gitkeep
88
+ - xpub.gemspec
89
+ homepage: https://github.com/Amakata/xpub
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.4.3
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Xpub is EPUB and PDF publisher.
113
+ test_files: []