xpub 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +158 -0
- data/lib/xpub/dsl/builder.rb +4 -1
- data/lib/xpub/version.rb +1 -1
- data/lib/xpub.rb +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 877ab04ae6dcc87b84f58981a8b4f4cf4db2b13c
|
4
|
+
data.tar.gz: 97eb7fb47e86d13a1771ad5adc36ed0e772e2c24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37a38c380d0590f97bb65a496ad9da5eb35c189b652b86c24f2699ed7fbd298fb71a0d6e8f50c91d0b1c47d5935d6ce41c8e8c1eb20c220c654845f90e0e2c08
|
7
|
+
data.tar.gz: 09a15c7aa078c85c4cf10309aa1c3e9ca5935883217a6bd54c8c78cbd4aa8c59cdf76f346396ca4b52a33d1392dbad2f0dd71159f0efd306320653e776a5c58b
|
data/README.md
CHANGED
@@ -128,6 +128,164 @@ $ xpub clean
|
|
128
128
|
カレントディレクトリのtmpディレクトリ、outputディレクトリをクリアします。
|
129
129
|
|
130
130
|
|
131
|
+
# Xpubファイルの形式
|
132
|
+
|
133
|
+
Xpubファイルは```xpub init```をすることでひな形が作成されます。
|
134
|
+
|
135
|
+
下記はひな形の例です。
|
136
|
+
|
137
|
+
```ruby
|
138
|
+
Xpub::book "sample" do
|
139
|
+
# identifier "urn:uuid:c12fdf58-6f2b-4a77-bd58-186b3192b52a" do
|
140
|
+
# scheme "UUID"
|
141
|
+
# end
|
142
|
+
title "サンプル"
|
143
|
+
# subtitle "サブタイトル"
|
144
|
+
# short "短縮タイトル"
|
145
|
+
# collection "コレクションタイトル"
|
146
|
+
# edition "エディションタイトル"
|
147
|
+
# extended "エクステンドタイトル"
|
148
|
+
|
149
|
+
# publisher "○○出版社"
|
150
|
+
creator "電書 電子" do
|
151
|
+
# role "aut"
|
152
|
+
end
|
153
|
+
# contributor "コントリビュータの名前" do
|
154
|
+
# role "ill"
|
155
|
+
# end
|
156
|
+
description "テストのアブストラクトです。長い文のアブストラクトだとどういう表示になるのかをテストしています。"
|
157
|
+
# rights "権利表記"
|
158
|
+
# publication "2015/01/22 18:10:00"
|
159
|
+
# modification Time.now.to_s
|
160
|
+
|
161
|
+
md_file "sample"
|
162
|
+
# md_files "."
|
163
|
+
|
164
|
+
img_file "sample1.jpg"
|
165
|
+
# img_file "hyoushi.png"
|
166
|
+
# img_file "urahyoushi.png"
|
167
|
+
|
168
|
+
latex_builder "latex" do
|
169
|
+
documentclass "utbook"
|
170
|
+
classoption "11pt"
|
171
|
+
classoption "twocolumn"
|
172
|
+
classoption "twoside"
|
173
|
+
classoption "a5j"
|
174
|
+
# prepartname "第"
|
175
|
+
# postpartname "部"
|
176
|
+
# prechaptername "第"
|
177
|
+
# postchaptername "章"
|
178
|
+
# output "sample"
|
179
|
+
# theme "default"
|
180
|
+
# template "template.tex"
|
181
|
+
# filter "pandoc-filter.rb"
|
182
|
+
|
183
|
+
hyoushi_image_page "h01" do
|
184
|
+
file "sample1.jpg"
|
185
|
+
topoffset "-0.8mm"
|
186
|
+
leftoffset "2.1mm"
|
187
|
+
end
|
188
|
+
hyoushi_empty_page "h02" do
|
189
|
+
no_page_number
|
190
|
+
end
|
191
|
+
hyoushi_inner_title_page "title"
|
192
|
+
urahyoushi_empty_page "h03" do
|
193
|
+
no_page_number
|
194
|
+
end
|
195
|
+
urahyoushi_image_page "h04" do#
|
196
|
+
file "sample1.jpg"
|
197
|
+
topoffset "-0.8mm"
|
198
|
+
leftoffset "-5mm"
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
epub_builder "epub" do
|
203
|
+
cover_image "sample1.jpg"
|
204
|
+
end
|
205
|
+
end
|
206
|
+
```
|
207
|
+
|
208
|
+
# Markdownの形式
|
209
|
+
|
210
|
+
本ツールのMarkdownの形式は現在のところpandocの読み込み形式に従います。
|
211
|
+
|
212
|
+
EPUB出力では下記のオプションが与えられた物として動作します。
|
213
|
+
|
214
|
+
```
|
215
|
+
markdown_phpextra+hard_line_breaks+raw_html
|
216
|
+
```
|
217
|
+
|
218
|
+
PDF出力では下記のオプションが与えられた物として動作します。
|
219
|
+
|
220
|
+
```
|
221
|
+
markdown_phpextra+hard_line_breaks+raw_tex
|
222
|
+
```
|
223
|
+
|
224
|
+
## ルビ
|
225
|
+
|
226
|
+
ルビの形式は下記のようなものを受け付けるようになっています。
|
227
|
+
|
228
|
+
### グループルビ
|
229
|
+
```
|
230
|
+
{ルビテスト|るび}
|
231
|
+
```
|
232
|
+
|
233
|
+
### 熟語ルビ
|
234
|
+
```
|
235
|
+
{ルビテスト|る|び|て|す|と}
|
236
|
+
```
|
237
|
+
|
238
|
+
ルビの中には全角文字が使われる前提になっています。
|
239
|
+
|
240
|
+
## 縦横中
|
241
|
+
|
242
|
+
縦横中の形式は下記のようなものを受け付けるようになっています。
|
243
|
+
|
244
|
+
```
|
245
|
+
^54^
|
246
|
+
```
|
247
|
+
|
248
|
+
## 改ページ
|
249
|
+
|
250
|
+
PDFでは、下記の指定で改ページを行うことができます。EPUBでは現時点では改ページはされません。
|
251
|
+
|
252
|
+
### LaTeXのnewpage相当
|
253
|
+
```
|
254
|
+
===
|
255
|
+
```
|
256
|
+
|
257
|
+
### LaTeXのclearpage相当
|
258
|
+
```
|
259
|
+
====
|
260
|
+
```
|
261
|
+
|
262
|
+
### LaTeXのcleardoublepage相当
|
263
|
+
```
|
264
|
+
=====
|
265
|
+
```
|
266
|
+
|
267
|
+
## LaTeX専用目次出力
|
268
|
+
|
269
|
+
目次を出力します。
|
270
|
+
```
|
271
|
+
<!-- %%toc%% -->
|
272
|
+
```
|
273
|
+
|
274
|
+
## LaTex専用カラム数変更
|
275
|
+
|
276
|
+
これ以降を改ページして2カラム出力にします。
|
277
|
+
```
|
278
|
+
<!-- %%twocolumn%% -->
|
279
|
+
```
|
280
|
+
|
281
|
+
これ以降を改ページして1カラム出力にします。
|
282
|
+
|
283
|
+
```
|
284
|
+
<!-- %%onecolumn%% -->
|
285
|
+
```
|
286
|
+
|
287
|
+
|
288
|
+
|
131
289
|
# メモ
|
132
290
|
|
133
291
|
## MacでのTeXのフォントの設定メモ
|
data/lib/xpub/dsl/builder.rb
CHANGED
@@ -32,7 +32,7 @@ module Xpub
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def tmp_path file
|
35
|
-
"#{Dir::getwd}/tmp/#{file}"
|
35
|
+
"#{Dir::getwd}/tmp/#{@book.name}/#{file}"
|
36
36
|
end
|
37
37
|
|
38
38
|
def output_path file
|
@@ -196,6 +196,8 @@ module Xpub
|
|
196
196
|
end
|
197
197
|
|
198
198
|
def build option
|
199
|
+
FileUtils.mkdir_p(tmp_path "") unless FileTest.exist?(tmp_path "")
|
200
|
+
|
199
201
|
build_epub_metadata option
|
200
202
|
|
201
203
|
if option['pandoc-json-output']
|
@@ -328,6 +330,7 @@ module Xpub
|
|
328
330
|
end
|
329
331
|
|
330
332
|
def build option
|
333
|
+
FileUtils.mkdir_p(tmp_path "") unless FileTest.exist?(tmp_path "")
|
331
334
|
if option['pandoc-json-output']
|
332
335
|
cmd_exec pandoc_cmd, ["-o", json_path, "-t", "json"].concat(pandoc_option option).concat(vars_option).concat(@book.src_files.map{ |f| f.full_path }), option
|
333
336
|
end
|
data/lib/xpub/version.rb
CHANGED
data/lib/xpub.rb
CHANGED