Skip to content

Commit 40b256e

Browse files
committed
雛形追加
0 parents  commit 40b256e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+7390
-0
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.DS_Store
2+
node_modules/
3+
npm-debug.log
4+
5+
*~
6+
7+
.sass-cache/
8+
publish/
9+
10+
gopherwalker-*/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "prh-rules"]
2+
path = prh-rules
3+
url = https://github.com/prh/rules.git

Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# A sample Gemfile
2+
source "https://rubygems.org"
3+
4+
gem 'review', '2.3.0'
5+
gem 'review-peg', '0.2.2'
6+
gem 'sass', '3.4.25'

Gemfile.lock

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
review (2.3.0)
5+
rouge
6+
rubyzip
7+
review-peg (0.2.2)
8+
rouge (2.2.0)
9+
rubyzip (1.2.1)
10+
sass (3.4.25)
11+
12+
PLATFORMS
13+
ruby
14+
15+
DEPENDENCIES
16+
review (= 2.3.0)
17+
review-peg (= 0.2.2)
18+
sass (= 3.4.25)
19+
20+
BUNDLED WITH
21+
1.15.3

Gruntfile.js

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
"use strict";
2+
3+
let fs = require("fs");
4+
let yaml = require("js-yaml");
5+
6+
const articles = "articles";
7+
const publish = 'publish';
8+
const bookConfig = yaml.safeLoad(fs.readFileSync(`${articles}/config.yml`, "utf8"));
9+
10+
const reviewPrefix = process.env["REVIEW_PREFIX"] || "bundle exec ";
11+
const reviewPostfix = process.env["REVIEW_POSTFIX"] || ""; // REVIEW_POSTFIX="-peg" npm run pdf とかするとPEGでビルドできるよ
12+
const reviewPreproc = `${reviewPrefix}review-preproc${reviewPostfix}`;
13+
const reviewCompile = `${reviewPrefix}review-compile${reviewPostfix}`;
14+
const reviewWebMaker = `${reviewPrefix}review-webmaker${reviewPostfix}`;
15+
const reviewPdfMaker = `${reviewPrefix}review-pdfmaker${reviewPostfix}`;
16+
const reviewEpubMaker = `${reviewPrefix}review-epubmaker${reviewPostfix}`;
17+
18+
module.exports = grunt => {
19+
grunt.initConfig({
20+
clean: {
21+
review: {
22+
src: [
23+
`${articles}/${bookConfig.bookname}-*/`, // pdf, epub temp dir
24+
`${articles}/*.pdf`,
25+
`${articles}/*.epub`,
26+
`${articles}/*.html`,
27+
`${articles}/*.xml`,
28+
`${articles}/*.txt`,
29+
],
30+
},
31+
publish: {
32+
src: `${publish}/`,
33+
},
34+
},
35+
sass: {
36+
dist: {
37+
options: {
38+
bundleExec: true,
39+
sourcemap: 'none',
40+
},
41+
files: {
42+
'articles/style.css': 'articles/style.scss',
43+
'articles/style-web.css': 'articles/style-web.scss',
44+
},
45+
},
46+
},
47+
copy: {
48+
publish: {
49+
files: [
50+
{expand: true, cwd: `${articles}/webroot/`, src: ['**'], dest: `${publish}/`},
51+
],
52+
},
53+
},
54+
shell: {
55+
preprocess: {
56+
options: {
57+
execOptions: {
58+
cwd: articles,
59+
},
60+
},
61+
command: `${reviewPreproc} -r --tabwidth=2 *.re`,
62+
},
63+
compile2text: {
64+
options: {
65+
execOptions: {
66+
cwd: articles,
67+
},
68+
},
69+
command: `${reviewCompile} --target=text`,
70+
},
71+
compile2html: {
72+
options: {
73+
execOptions: {
74+
cwd: articles,
75+
},
76+
},
77+
command: `${reviewCompile} --target=html --yaml=config.yml --chapterlink --footnotetext`,
78+
},
79+
compile2latex: {
80+
options: {
81+
execOptions: {
82+
cwd: articles,
83+
},
84+
},
85+
command: `${reviewCompile} --target=latex --footnotetext`,
86+
},
87+
compile2idgxml: {
88+
options: {
89+
execOptions: {
90+
cwd: articles,
91+
},
92+
},
93+
command: `${reviewCompile} --target=idgxml`,
94+
},
95+
compile2web: {
96+
options: {
97+
execOptions: {
98+
cwd: articles,
99+
},
100+
},
101+
command: `${reviewWebMaker} config.yml`,
102+
},
103+
compile2pdf: {
104+
options: {
105+
execOptions: {
106+
cwd: articles,
107+
},
108+
},
109+
command: `${reviewPdfMaker} config.yml`,
110+
},
111+
compile2epub: {
112+
options: {
113+
execOptions: {
114+
cwd: articles,
115+
},
116+
},
117+
command: `${reviewEpubMaker} config.yml`,
118+
},
119+
},
120+
});
121+
122+
function generateTask(target, pretask) {
123+
pretask = pretask || [];
124+
return ["clean"].concat(pretask).concat(["shell:preprocess", `shell:compile2${target}`]);
125+
}
126+
127+
grunt.registerTask(
128+
"default",
129+
"原稿をコンパイルしてPDFファイルにする",
130+
"pdf");
131+
132+
grunt.registerTask(
133+
"text",
134+
"原稿をコンパイルしてTextファイルにする",
135+
generateTask("text"));
136+
137+
grunt.registerTask(
138+
"html",
139+
"原稿をコンパイルしてHTMLファイルにする",
140+
generateTask("html", ["sass"]));
141+
142+
grunt.registerTask(
143+
"idgxml",
144+
"原稿をコンパイルしてInDesign用XMLファイルにする",
145+
generateTask("idgxml"));
146+
147+
grunt.registerTask(
148+
"web",
149+
"原稿をコンパイルしてwebページにする",
150+
generateTask("web", ["sass"]).concat(['copy:publish']));
151+
152+
grunt.registerTask(
153+
"pdf",
154+
"原稿をコンパイルしてpdfファイルにする",
155+
generateTask("pdf"));
156+
157+
grunt.registerTask(
158+
"epub",
159+
"原稿をコンパイルしてepubファイルにする",
160+
generateTask("epub"));
161+
162+
require("load-grunt-tasks")(grunt);
163+
};

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Gopher Walker
2+
3+
## この本のビルドの仕方
4+
5+
### Dockerを使う
6+
7+
TeXの環境構築が困難な場合、一式セットアップ済みの[dockerイメージ](https://registry.hub.docker.com/u/vvakame/review/)を用意してあるので使ってください。
8+
Dockerがうまく動くようになっている場合、以下のコマンドで細かい準備なしにビルドを行うことができます。
9+
10+
```
11+
$ docker pull vvakame/review
12+
$ ./build-in-docker.sh
13+
```
14+
15+
### HTML出力
16+
17+
`npm run web` を実行すると、`publish/`ディレクトリ以下に公開用HTMLファイルおよびcss,画像を出力します。
18+
19+
## ライセンス等の表記
20+
21+
設定ファイル、テンプレートなど制作環境(techbooster-doujin.styなど)TechBoosterのものを使用しています。

articles/.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*.html
2+
!_cover.html
3+
*.txt
4+
*.xml
5+
*.tex
6+
7+
*-pdf/
8+
C89-*/
9+
webroot/
10+
11+
*.pdf
12+
*.epub
13+
14+
*.css
15+
16+
prh.yml
17+

articles/.griflet.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
specs: pdf

articles/catalog.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
PREDEF:
2+
- preface.re
3+
CHAPS:
4+
- tenntenn.re
5+
POSTDEF:
6+
- contributors.re

0 commit comments

Comments
 (0)