bindery-cli 0.1.1 → 0.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af953a6d3a3f8b05cff050e4a9e7a6ced73a8bfc59a6c9269793b5f53e60cbde
4
- data.tar.gz: 877069de98701d6a504b010f3268cb1f2a1ce471fc4e5b56d3ea058ec769e35d
3
+ metadata.gz: 7457c3072ce5bcbcbdedc902ef9318408f638430051e6c704fafa29d78bba631
4
+ data.tar.gz: f7a197b9dff65d489d3d6b245139e8ac67b88fce77a8283b87a1c9eafb79d382
5
5
  SHA512:
6
- metadata.gz: 95295349a768fd7abb2c8c2a557391ae789b581265a07d299b9dfb617bcad57f6a902956fb53dc87dd7a8bc1bf480a390d4f28a08f0f07f4598cfb28d0f06cfc
7
- data.tar.gz: c05bfa81b2fa39164c2d0d21497b1cbebb1ae090fb95f6b87590796cd58a6542b9e69531849c62a2ac7989486082c3aaf201b0b17d93f63caf4c18d328079441
6
+ metadata.gz: f86e911bfbee318cf7784389007f3e37bd9067a2eb20af9b01d8e7da5d1dd45cbfacfdc6d2f2106f23ee80c09557b25158c8ef9ae7cb37afc625e06c4f32b1cc
7
+ data.tar.gz: c24b1ea8c04950e228ee87387d6ed5fa9b172f16d420a336ee3234b29f954c173524369578ec0af541aa985ec43d5f05bfbbcee9eb1ea1ddbb15a454d3c7da9e
data/README.md CHANGED
@@ -2,9 +2,11 @@
2
2
 
3
3
  把 Markdown 公版书批量构建为 EPUB 的项目脚手架工具。
4
4
 
5
- - `bindery new <项目名>` 创建整套项目结构
6
- - `bindery generate book <id> <书名>` 为单本书生成骨架
5
+ - `bindery init` 在当前目录初始化项目
6
+ - `bindery new book <书名>` 新建一本书(ID 自动生成)
7
7
  - `bindery build` 调用 [Pandoc](https://pandoc.org) 批量构建 EPUB
8
+ - `bindery validate` / `clean` / `watch` / `serve` / `status` 管理书籍与产物
9
+ - `bindery web` 打开 Web 封面生成器(自动填充书籍信息)
8
10
 
9
11
  仅依赖 Ruby 标准库,不引入任何第三方 gem。
10
12
 
@@ -27,23 +29,51 @@ brew install pandoc
27
29
  ## 快速开始
28
30
 
29
31
  ```bash
30
- # 1. 创建项目
31
- bindery new my-books
32
+ # 1. 创建并进入项目目录
33
+ mkdir my-books
32
34
  cd my-books
33
35
 
34
- # 2. 新建一本书
35
- bindery generate book lunyu "论语" --author "孔子及弟子" --dynasty "先秦"
36
+ # 2. 就地初始化项目
37
+ bindery init
36
38
 
37
- # 3. 编辑 books/lunyu/chapters/ 下的章节文件
39
+ # 3. 新建一本书(ID 自动生成,可 --id 指定;--cover 自动生成封面)
40
+ # 也可以一步到位建好章节:bindery new book "论语" chapter 20 --author "孔子及弟子"
41
+ # (N = 正文章节数,封面/目录由构建自动生成)
42
+ bindery new book "论语" --author "孔子及弟子" --dynasty "先秦" --translator "译者甲" --isbn "9781234567890" --cover
38
43
 
39
- # 4. 构建 EPUB
40
- bindery build lunyu
44
+ # 4. (可选)卷式结构:卷由标题层级定义(h2=卷名,h3=章名),每卷在 EPUB 中独立成页
45
+ bindery new volume <id> "学而" --chapters 5
46
+ bindery new volume <id> "为政" --chapters 5
41
47
 
42
- # 批量构建所有书
48
+ # 5. 编辑 books/<id>/chapters/ 下的章节文件
49
+ # (可选)单独批量创建章节:bindery new chapter <id> 10
50
+ # (可选)按标题自动重命名章节:bindery rename chapters <id>
51
+ # (可选)单独生成封面:bindery cover <id>
52
+
53
+ # 6. 构建 EPUB
43
54
  bindery build --all
44
55
 
56
+ # 构建前校验(不实际构建)
57
+ bindery validate --all
58
+ bindery build --all --check
59
+
60
+ # 构建后用 epubcheck 校验
61
+ bindery build --all --epubcheck
62
+
45
63
  # 查看书籍状态
46
64
  bindery status
65
+
66
+ # 监听书籍目录,改动自动重建
67
+ bindery watch
68
+
69
+ # 本地启动书库站点
70
+ bindery serve
71
+
72
+ # 打开 Web 封面生成器(自动填充书籍信息)
73
+ bindery web
74
+
75
+ # 清理构建产物
76
+ bindery clean --all
47
77
  ```
48
78
 
49
79
  ## 项目结构
@@ -51,11 +81,14 @@ bindery status
51
81
  ```
52
82
  my-books/
53
83
  ├── config/bindery.yml # 项目标记文件,不要删除
54
- ├── books/ # 每本书一个子目录
84
+ ├── books/ # 每本书一个子目录(ID 即目录名)
55
85
  │ └── <id>/
56
86
  │ ├── metadata.yaml # 书籍元信息
57
- │ ├── cover.jpg # 封面(可选)
58
- │ └── chapters/ # Markdown 章节,按文件名排序合并
87
+ │ ├── cover.png # 封面(可选,bindery cover 自动生成)
88
+ │ └── chapters/ # 平铺 Markdown,卷结构由标题层级定义(## 卷名 / ### 章名)
89
+ │ ├── 01-chapter.md
90
+ │ ├── 卷01-学而.md
91
+ │ └── 卷02-为政.md
59
92
  ├── templates/style.css # 全项目共用的 EPUB 样式
60
93
  ├── output/epub/ # 构建产物
61
94
  └── books.json # 自动生成的书目索引