create-asciidoc-multi-book-workspace 0.1.8 → 0.1.9

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.
Files changed (24) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.json +1 -1
  3. package/templates/default-workspace/books/07-structured-writing-conventions/backmatter/appendix-a.adoc +27 -15
  4. package/templates/default-workspace/books/07-structured-writing-conventions/backmatter/glossary.adoc +5 -1
  5. package/templates/default-workspace/books/07-structured-writing-conventions/backmatter/index.adoc +1 -0
  6. package/templates/default-workspace/books/07-structured-writing-conventions/book.adoc +10 -10
  7. package/templates/default-workspace/books/07-structured-writing-conventions/frontmatter/abstract.adoc +1 -1
  8. package/templates/default-workspace/books/07-structured-writing-conventions/frontmatter/preface.adoc +9 -2
  9. package/templates/default-workspace/books/07-structured-writing-conventions/parts/010-source-surface/010-source-and-projection.adoc +83 -0
  10. package/templates/default-workspace/books/07-structured-writing-conventions/parts/010-source-surface/020-default-semantics.adoc +48 -0
  11. package/templates/default-workspace/books/07-structured-writing-conventions/parts/010-source-surface/030-source-order-notation.adoc +36 -0
  12. package/templates/default-workspace/books/07-structured-writing-conventions/parts/020-identity-and-relation/010-role-identity.adoc +35 -0
  13. package/templates/default-workspace/books/07-structured-writing-conventions/parts/020-identity-and-relation/020-relation-predicate.adoc +24 -0
  14. package/templates/default-workspace/books/07-structured-writing-conventions/parts/020-identity-and-relation/_partintro.adoc +1 -0
  15. package/templates/default-workspace/books/07-structured-writing-conventions/parts/{300-fields-and-lookup → 030-fields-and-lookup}/010-surface-fields.adoc +1 -1
  16. package/templates/default-workspace/books/07-structured-writing-conventions/parts/100-source-surface/010-source-and-projection.adoc +0 -44
  17. package/templates/default-workspace/books/07-structured-writing-conventions/parts/100-source-surface/020-default-semantics.adoc +0 -26
  18. package/templates/default-workspace/books/07-structured-writing-conventions/parts/100-source-surface/030-source-order-notation.adoc +0 -23
  19. package/templates/default-workspace/books/07-structured-writing-conventions/parts/200-identity-and-relation/010-role-identity.adoc +0 -37
  20. package/templates/default-workspace/books/07-structured-writing-conventions/parts/200-identity-and-relation/020-relation-predicate.adoc +0 -22
  21. package/templates/default-workspace/books/07-structured-writing-conventions/parts/200-identity-and-relation/_partintro.adoc +0 -1
  22. /package/templates/default-workspace/books/07-structured-writing-conventions/parts/{100-source-surface → 010-source-surface}/_partintro.adoc +0 -0
  23. /package/templates/default-workspace/books/07-structured-writing-conventions/parts/{300-fields-and-lookup → 030-fields-and-lookup}/020-index-and-glossary.adoc +0 -0
  24. /package/templates/default-workspace/books/07-structured-writing-conventions/parts/{300-fields-and-lookup → 030-fields-and-lookup}/_partintro.adoc +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.9 - 2026-06-17
4
+
5
+ ### Added
6
+
7
+ - Add design notes for the `0X0` source-order numbering scheme used by structured writing sample books.
8
+ - Add a reference note on book structure, front matter, body matter, and back matter for authors modeling AsciiDoc books.
9
+ - Expand the structured writing conventions sample with heading containment, generated projection IRI, stable address label, and xref edge examples.
10
+
11
+ ### Changed
12
+
13
+ - Use the same three-digit `0X0` numbering format for structured writing sample Part directories and Chapter files.
14
+ - Clarify when authors should declare stable IDs versus relying on globally unique, stable title text as the xref target.
15
+ - Tighten the sample guidance for role vocabularies, rel predicates, heading level continuity, pass macros, callouts, and large-scope xrefs.
16
+
3
17
  ## 0.1.8 - 2026-06-14
4
18
 
5
19
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-asciidoc-multi-book-workspace",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Create a complete AsciiDoc multi-book workspace.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -5,37 +5,41 @@
5
5
  |写法 |含义
6
6
 
7
7
  |`= 书名`
8
- |Document title(文档标题)。在 book 文档类型中作为整本书标题。
8
+ |文档大标题(Document Title)。作为整本书的根节点,只能位于文档首行。
9
9
 
10
- |`= 部标题`
11
- |Document title 之后的 Level 0 Section。在 book 文档类型中可作为 Part(部)。
10
+ |`= 卷/部`
11
+ |0级章节(Level 0)。位于大标题之后的正文中,代表书籍的“卷/部”(Part)。
12
12
 
13
- |`== 章 / 标题`
14
- |Level 1 Section(一级章节)。创建书稿阅读结构,在 book 文档类型中通常作为 Chapter(章)。
13
+ |`== 章`
14
+ |1级章节(Level 1)。代表书籍的“章”(Chapter)。
15
15
 
16
16
  |`=== 节`
17
- |Level 2 Section(二级章节 / 节)。
17
+ |2级章节(Level 2)。代表章内部的“节”(Section)。
18
18
 
19
19
  |`==== 小节`
20
- |Level 3 Section(三级章节 / 小节)。
20
+ |3级章节(Level 3)。代表“小节”(Subsection)。
21
21
 
22
22
  |`===== 次小节`
23
- |Level 4 Section(四级章节)。
23
+ |4级章节(Level 4)。代表“次小节”。
24
24
 
25
- |`====== 最底层级`
26
- |Level 5 Section(五级章节)。AsciiDoc 支持的最深层级。
25
+ |`====== 最底层标题`
26
+ |5级章节(Level 5)。AsciiDoc 引擎支持的最深物理层级。
27
27
 
28
- |`parts/100-topic/`
29
- |part 目录的源文件编排号。
28
+ |`parts/010-topic/`
29
+ |Part 目录的源文件编排号。使用统一的三位数 `0X0` 格式。`X` 为顺序号,首个 `0` 为前导零,末尾 `0` 为插入预留。
30
30
 
31
31
  |`010-opening.adoc`
32
- |chapter 文件的源文件编排号。
32
+ |Chapter 文件的源文件编排号。规则与 Part 目录编排号一致。
33
33
 
34
34
  |`[#stable-id]`
35
- |为重要标题声明稳定 ID。
35
+ |为标题声明一个稳定的引用地址。稳定 ID 仅当以下两个条件同时满足时才需显式声明:
36
+ (1) 该标题被至少一个 `xref` 交叉引用;
37
+ (2) 标题文本本身可能变更或在全书范围内可能重复。
38
+ 若标题本身已是领域内唯一且稳定的标识符(如专有名词、唯一实体名、标准化编号),即使被交叉引用,也无需额外声明稳定 ID——标题文本即地址。
36
39
 
37
40
  |`[#stable-id.concept]`
38
41
  |声明稳定 ID,并用 role 标明标题身份。
42
+ 需要能够回答: “这个标题在整本书的知识体系中扮演什么认知功能”
39
43
 
40
44
  |`[#example.example, owner=writing-team]`
41
45
  |role 声明标题身份;named attributes 保留附加字段。
@@ -53,6 +57,8 @@
53
57
  |正文隐藏索引词。
54
58
  |===
55
59
 
60
+ 全书标题需要保持 `标题层级连续`。
61
+
56
62
  role 描述标题身份。rel 描述 xref 边上的关系谓词。named attributes 是附加字段。
57
63
 
58
64
  `[appendix]`、`[glossary]`、`[bibliography]` 和 `[index]` 是 section style。它们改变紧随其后 section 的语义;标题层级仍由 `=` 数量决定。
@@ -61,4 +67,10 @@ role 描述标题身份。rel 描述 xref 边上的关系谓词。named attribut
61
67
 
62
68
  你可以在主文档的开头定义一个变量(比如 `:book-b-dir:`),后续引用时通过 `{book-b-dir}` 来调用它。
63
69
 
64
- 如果你的建模中存在需要对一段区域精准指向、提及的情况,优先考虑使用 **更小一级/更小一节** 的标题把这段区域划分出来,之后就可以继续使用 `xref` 进行交叉引用。
70
+ 如果你的建模中存在需要对一段区域精准指向、提及的情况,可以考虑使用 **更小一级/更小一节** 的标题把这段区域划分出来,之后就可以继续使用 `xref` 进行交叉引用。
71
+
72
+ 在 Asciidoc 中使用 pass:[] 宏可以表达透传,不会被解析,使用反引号包裹可以获得字体样式。
73
+
74
+ 如果遇到“代码/日志”与其“文字解释”需要分离的场景,可以考虑使用 Asciidoc 的 Callouts。
75
+
76
+ TIP: 在你写作的过程中,你可以思考有哪些 Asciidoc 语法/表达 适合你当前的所撰写的对象,然后选择合适的并应用。
@@ -2,8 +2,12 @@
2
2
 
3
3
  本术语表记录结构化书写约定中的核心术语。
4
4
 
5
+ [glossary]
5
6
  heading:: 使用等号标题创建的书稿结构单位。
6
- stable ID:: 作者声明的稳定引用地址,例如 `#stable-heading`。
7
+ stable ID:: 作者为标题显式声明的稳定引用地址,语法为 `[#id]`。
8
+ 仅当标题被交叉引用、且标题文本自身不能保证全局唯一和不变时才需使用。
9
+ 若标题文本已是领域内唯一的稳定标识符(如实体名称、标准化编号),
10
+ 标题文本本身即承担 stable ID 的寻址功能,无需额外声明。
7
11
  source-order notation:: 写在源文件路径表面的排序符号。
8
12
  role:: 标题身份标记,例如 `.concept` 或 `.rule`。
9
13
  ordinary reference:: 普通 xref。投影时使用默认谓词 `aat:references`。
@@ -34,4 +34,5 @@ Asciidoctor 的内置 HTML5 转换器不会自动生成索引目录。`[index]`
34
34
  indexterm2:[role]
35
35
  indexterm:[relation predicate]
36
36
  indexterm:[源文件编排号]
37
+ indexterm:[中间值插入]
37
38
  ----
@@ -32,31 +32,31 @@ include::frontmatter/acknowledgments.adoc[]
32
32
  = 从源文档看结构
33
33
 
34
34
  [partintro]
35
- include::parts/100-source-surface/_partintro.adoc[]
35
+ include::parts/010-source-surface/_partintro.adoc[]
36
36
 
37
- include::parts/100-source-surface/010-source-and-projection.adoc[]
37
+ include::parts/010-source-surface/010-source-and-projection.adoc[]
38
38
 
39
- include::parts/100-source-surface/020-default-semantics.adoc[]
39
+ include::parts/010-source-surface/020-default-semantics.adoc[]
40
40
 
41
- include::parts/100-source-surface/030-source-order-notation.adoc[]
41
+ include::parts/010-source-surface/030-source-order-notation.adoc[]
42
42
 
43
43
  = 给标题和引用加意图
44
44
 
45
45
  [partintro]
46
- include::parts/200-identity-and-relation/_partintro.adoc[]
46
+ include::parts/020-identity-and-relation/_partintro.adoc[]
47
47
 
48
- include::parts/200-identity-and-relation/010-role-identity.adoc[]
48
+ include::parts/020-identity-and-relation/010-role-identity.adoc[]
49
49
 
50
- include::parts/200-identity-and-relation/020-relation-predicate.adoc[]
50
+ include::parts/020-identity-and-relation/020-relation-predicate.adoc[]
51
51
 
52
52
  = 字段、索引与术语
53
53
 
54
54
  [partintro]
55
- include::parts/300-fields-and-lookup/_partintro.adoc[]
55
+ include::parts/030-fields-and-lookup/_partintro.adoc[]
56
56
 
57
- include::parts/300-fields-and-lookup/010-surface-fields.adoc[]
57
+ include::parts/030-fields-and-lookup/010-surface-fields.adoc[]
58
58
 
59
- include::parts/300-fields-and-lookup/020-index-and-glossary.adoc[]
59
+ include::parts/030-fields-and-lookup/020-index-and-glossary.adoc[]
60
60
 
61
61
  [appendix]
62
62
  include::backmatter/appendix-a.adoc[]
@@ -1,3 +1,3 @@
1
1
  == 摘要
2
2
 
3
- 本书会通过展示标题、稳定 ID、role、xref、rel 和 named attributes 如何形成可读、可维护、可投影的源文档,让你能够理解,你可以有这样一种表达方式,按照某种约定,能够提升你书籍的质量,能够让下游的工具链继续消费你的书。 你可以参考你当前写书所需要的结构,合适的结构能够提升书籍的可阅读,可维护性。你可以按写作目的选择其中写法。
3
+ 本书展示标题、稳定 ID、role、xref、rel 和 named attributes 形成可读、可维护、可投影的源文档的方式。作者可按写作目的选择其中写法。
@@ -1,7 +1,14 @@
1
1
  == 前言
2
2
 
3
- 这本标本书按源文档写法组织。阅读时先看源文档片段和投影片段,再对照后续章节理解每个标记承担的职责。
3
+ 这本书按源文档写法组织。阅读时先看源文档片段和投影片段,再对照后续章节理解每个标记承担的职责。
4
4
 
5
- 实际书稿按写作目的选择这些写法。长期引用的标题使用稳定 ID;带有明确身份的标题使用 role;表达关系的引用使用 rel;随源稿保留的字段使用 named attributes。
5
+ 实际书稿按写作目的选择这些写法。
6
+ 长期引用且标题文本可能变更的标题使用稳定 ID;
7
+ 若标题本身已是唯一且稳定的实体名称,标题文本直接作为引用地址。
8
+ 带有明确身份的标题使用 role;表达关系的引用使用 rel;
9
+ 随源稿保留的字段使用 named attributes。
6
10
 
7
11
  业务含义由书稿自己的约定承载。本书展示同一份 AsciiDoc 源文本如何同时服务阅读、维护和工具链投影。
12
+
13
+ 通过展示标题、稳定 ID、role、xref、rel 和 named attributes 如何形成可读、可维护、可投影的源文档,让你能够理解,你可以拥有一种这样的表达方式,可以按照某种约定,就能够提升你书籍的质量,能够让下游的工具链继续消费你的书。 你可以参考本书里你所需要的结构。
14
+ 合适的结构能够提升书籍的可阅读、可维护性。你可以按写作目的选择其中写法。
@@ -0,0 +1,83 @@
1
+ [#source-and-projection]
2
+ == 源文本与投影
3
+
4
+ 本章用一段示例展示结构化书写约定。Turtle 片段列出关键投影事实;完整投影还会保留 raw、路径、行号和边证据。
5
+ 希望你能通过本章节的演示来理解你写下的文字能够给未来的你提供稳定的查询与导航结构。
6
+
7
+ [source,asciidoc]
8
+ ----
9
+ = 结构化写作样例
10
+
11
+ [#regular-heading.concept]
12
+ == 常规标题
13
+
14
+ 常规标题提供可引用的阅读单位。
15
+
16
+ [#basic-syntax.example]
17
+ === 基本语法
18
+
19
+ 基本语法是常规标题下的直接子标题。
20
+
21
+ [#xref-rule.rule]
22
+ == 引用规则
23
+
24
+ 引用规则参见 xref:regular-heading[常规标题]。
25
+ 引用规则依赖 xref:regular-heading[常规标题, rel=depends-on, weight=strong]。
26
+ ----
27
+
28
+ 源文档把 `常规标题` 写成可引用的阅读单位,在其下写出 `基本语法` 子标题,把 `引用规则` 写成规则说明,并在正文里写出参见和依赖两种引用。
29
+
30
+ Turtle 示例中的 `<urn:aat:doc:...#heading-*>` 和 `<urn:aat:doc:...#xref-edge-*>` 表示投影生成的 IRI;`aat:addressLabel` 保留源文档中的寻址 label。
31
+
32
+ [source,turtle]
33
+ ----
34
+ <urn:aat:doc:...#heading-l3-o0> a aat:Heading ;
35
+ aat:headline "常规标题" ;
36
+ aat:addressLabel "regular-heading" ;
37
+ aat:role "concept" ;
38
+ aat:containsDirectly <urn:aat:doc:...#heading-l8-o0> .
39
+
40
+ <urn:aat:doc:...#heading-l8-o0> a aat:Heading ;
41
+ aat:headline "基本语法" ;
42
+ aat:addressLabel "basic-syntax" ;
43
+ aat:role "example" .
44
+
45
+ <urn:aat:doc:...#heading-l13-o0> a aat:Heading ;
46
+ aat:headline "引用规则" ;
47
+ aat:addressLabel "xref-rule" ;
48
+ aat:role "rule" ;
49
+ aat:references <urn:aat:doc:...#heading-l3-o0> ;
50
+ rel:depends-on <urn:aat:doc:...#heading-l3-o0> .
51
+
52
+ <urn:aat:doc:...#xref-edge-l17-c8-o0> a aat:XrefEdge ;
53
+ aat:rel "depends-on" ;
54
+ aat:weight "strong" .
55
+ ----
56
+
57
+ 读者看源文档,能直接看到 [.concept]#常规标题# 是被引用的阅读单位,`基本语法` 是它的下级标题, [.rule]#引用规则# 说明引用写法。投影读取同一份源文档,为标题生成 IRI,并在标题节点上保留 `aat:headline`、`aat:addressLabel` 和 `aat:role`;标题层级投影为 `aat:containsDirectly`,xref 投影为 `aat:references` 和 `rel:depends-on`。
58
+
59
+ [source,asciidoc]
60
+ ----
61
+ [.concept]
62
+ == 林黛玉
63
+
64
+ 林黛玉是……她与 xref:贾宝玉[rel=love] 有木石前盟。
65
+ ----
66
+
67
+ 此处的 `pass:[xref:贾宝玉]` 直接使用标题文本作为寻址地址,
68
+ 因为“贾宝玉”在本书范围内唯一且不会变更为其他名称。
69
+ 交叉引用宏语法是 `pass:[xref:target-id[optional-display-text]]` ,所以这里省略了别名,渲染引擎默认会展示标题文字。
70
+
71
+ '''
72
+
73
+ 再来看看这样的场景: 标题是编号型标识符,且被交叉引用
74
+
75
+ 例如: `REQ-2024-0088`、`TC-AUTH-032`、`ADR-2024-015`,他们的标题本身就是编号,是人为设计的全局唯一标识符, 需要尊重他的原来的结构与语义。
76
+
77
+ [source,asciidoc]
78
+ ----
79
+ [.requirement, category=性能]
80
+ == REQ-2024-0088
81
+ ----
82
+
83
+ 引用时可以这样: `pass:[xref:REQ-2024-0088[REQ-2024-0088, rel=constrains]]`
@@ -0,0 +1,48 @@
1
+ [#heading-and-xref]
2
+ == 标题与引用
3
+
4
+ 等号行声明标题和层级。标题前的 attrlist 承载地址、role 和字段。
5
+
6
+ [source,asciidoc]
7
+ ----
8
+ [#regular-heading.concept]
9
+ == 常规标题
10
+ ----
11
+
12
+ `[#regular-heading]` 声明一个稳定地址。 `.concept` 标明标题身份。 `常规标题` 是标题文本。
13
+
14
+ [source,asciidoc]
15
+ ----
16
+ 引用规则参见 xref:regular-heading[常规标题]。
17
+ ----
18
+
19
+ 该 xref 投影为 `aat:references`,即默认引用谓词。
20
+
21
+ [source,asciidoc]
22
+ ----
23
+ 引用规则依赖 xref:regular-heading[常规标题, rel=depends-on]。
24
+ ----
25
+
26
+ `rel=depends-on` 声明从当前标题到目标标题的依赖关系,投影为 `rel:depends-on`。
27
+
28
+ [TIP]
29
+ ====
30
+ 1. 需要保证全书里所有出现的稳定地址都最少有1个 `xref` 消费,也就是说可以在需要进行交叉引用时,判断引用目标当前在全书中是否已经有稳定的标识,再确认是否需要手动添加上稳定地址。详细判断规则见 xref:附录 A:结构化写法速查[]。
31
+ 2. 按照书籍结构,跨越 `= 书名`、`= 卷/部`、`== 章` 这些大跨度的指代均需要使用 `xref` 手动标注,平衡隐式上下文的阅读压力。
32
+ ====
33
+
34
+ 标题声明角色后,其下级标题默认属于同一角色范围。下级标题可声明不同角色以切换语境。
35
+
36
+ 例如:
37
+
38
+ [source,asciidoc]
39
+ ----
40
+ [.rule]
41
+ == 引用规则
42
+
43
+ === 基本语法
44
+
45
+ [.example]
46
+ === 一个完整示例
47
+ ----
48
+
@@ -0,0 +1,36 @@
1
+ [#source-order-notation]
2
+ == 源文件编排号
3
+
4
+ 源文件编排号写在 part 目录名和 chapter 文件名前部。indexterm:[源文件编排号]
5
+
6
+ Part 目录和 Chapter 文件统一使用三位数 `0X0` 格式进行编排。
7
+
8
+ * 初始序列以 `10` 为步长:`010`、`020`、`030`……
9
+ * 十位数字(`X`)用于线性递增,以追加新内容。
10
+ * 个位数字(`0`)预留空间用于中间插入。
11
+
12
+ [source,text]
13
+ ----
14
+ parts/010-source-surface/
15
+ parts/015-new-topic/ <1>
16
+ parts/020-identity-and-relation/
17
+
18
+ 010-opening.adoc
19
+ 015-new-context.adoc <2>
20
+ 020-main-flow.adoc
21
+ ----
22
+ <1> 使用 `015` 在 `010` 和 `020` 两个 Part 之间插入。
23
+ <2> 使用 `015` 在 `010` 和 `020` 两个 Chapter 之间插入。
24
+
25
+ **操作规则:**
26
+
27
+ 作者需要两个原子操作:
28
+
29
+ . **末尾追加**:取当前最大编号,将其十位数字加 `1`,个位保持 `0`。例如,`090` 之后是 `100`。
30
+ . **中间插入**:在 A 与 B 之间插入时,新编号取 A 和 B 的**算术中间值**。例如,在 `010` 与 `020` 之间插入,使用 `015`。此策略可确保插入后仍为后续插入保留最大空间。
31
+
32
+ 使用三位数 `0X0` 格式,能够解决书籍动态维护过程中编号格式的稳定。
33
+
34
+ 标题文本保留语义名称。长期引用的标题使用显式 ID。
35
+
36
+ 编排号帮助维护者观察源文件顺序;显式 ID 帮助读者和工具链稳定引用标题。
@@ -0,0 +1,35 @@
1
+ [#role-identity]
2
+ == role 身份
3
+
4
+ role 写在标题 attrlist 的点号 token 位置。
5
+
6
+ [source,asciidoc]
7
+ ----
8
+ [#regular-heading.concept]
9
+ == 常规标题
10
+
11
+ [#xref-rule.rule]
12
+ == 引用规则
13
+ ----
14
+
15
+ `#regular-heading` 和 `#xref-rule` 是稳定 ID, `.concept` 和 `.rule` 是 indexterm2:[role], 标明标题身份。
16
+
17
+ [cols="1,2", options="header"]
18
+ |===
19
+ |写法 |读者看到的身份
20
+
21
+ |`[.concept]`
22
+ |标记概念说明。
23
+
24
+ |`[.rule]`
25
+ |标记规则说明。
26
+
27
+ |`[.example]`
28
+ |标记示例。
29
+ |===
30
+
31
+ role 的职责,是在全书范围内保持身份含义的稳定。
32
+
33
+ 一本书使用的 role 种类和数量,取决于该领域的概念结构。每种 role 的语义在全书中保持唯一。
34
+
35
+ 读者和工具链可以依据 role 进行导航文本和提取结构。
@@ -0,0 +1,24 @@
1
+ [#relation-predicate]
2
+ == rel 关系谓词
3
+
4
+ indexterm:[relation predicate] `rel` 是 xref 边上的关系谓词。包含 xref 的标题是关系起点,xref 指向的标题是关系终点。本书把这两个位置称为 source heading 和 target heading。
5
+
6
+ [source,asciidoc]
7
+ ----
8
+ 引用规则参见 xref:regular-heading[常规标题]。
9
+ 引用规则依赖 xref:regular-heading[常规标题, rel=depends-on]。
10
+ ----
11
+
12
+ 第一行投影为 `aat:references`,即默认引用谓词。第二行声明 `rel=depends-on`,投影为 `rel:depends-on`。
13
+
14
+ `rel` 可以被读者和工具当作关系谓词,所以在全书范围内,每种 `rel` 谓词的语义需要保持唯一且不变。
15
+
16
+ [horizontal]
17
+ depends-on:: 当前标题的判断、规则或操作以目标标题为依据。阅读顺序和先读建议使用普通 xref 表达。
18
+ illustrates:: 当前标题提供目标标题的示例。
19
+ defines:: 当前标题给出目标标题所代表对象的定义。
20
+ constrains:: 当前标题对目标标题的合法写法或范围施加约束。
21
+
22
+ 关系谓词描述标题之间的边。标题自身的身份使用 role 表达。
23
+
24
+ 标题之间的阅读顺序和先读建议,使用普通 xref(默认 `aat:references`)表达。
@@ -0,0 +1 @@
1
+ 本部展示标题身份和引用关系。role 标明标题身份;rel 标明引用关系。 在书籍中,你需要主动根据你当前所建模的概念结构对各类词表进行建模与约定,需要专门的词表约定章节清晰的写出你需要使用的受控词表,方便后续的使用。
@@ -8,7 +8,7 @@ named attributes 是写在源文档表面的字段。
8
8
  [#example.example, owner=writing-team]
9
9
  == 示例
10
10
 
11
- 示例说明 xref:stable-heading[稳定标题, rel=illustrates, weight=strong]。
11
+ 示例说明 xref:regular-heading[常规标题, rel=illustrates, weight=strong]。
12
12
  ----
13
13
 
14
14
  `.example` 是 role。`owner=writing-team` 是标题附加字段。`weight=strong` 是 xref 边证据上的附加字段。
@@ -1,44 +0,0 @@
1
- [#source-and-projection]
2
- == 源文本与投影
3
-
4
- 本章用一段示例展示结构化书写约定。Turtle 片段列出关键投影事实;完整投影还会保留 raw、路径、行号和边证据。
5
- 希望你能通过本章节的演示来理解你写下的文字能够给未来的你提供稳定的查询与导航结构。
6
-
7
- [source,asciidoc]
8
- ----
9
- = 结构化写作样例
10
-
11
- [#stable-heading.concept]
12
- == 稳定标题
13
-
14
- 稳定标题提供可引用的阅读单位。
15
-
16
- [#xref-rule.rule]
17
- == 引用规则
18
-
19
- 引用规则参见 xref:stable-heading[稳定标题]。
20
- 引用规则依赖 xref:stable-heading[稳定标题, rel=depends-on, weight=strong]。
21
- ----
22
-
23
- 源文档把 `稳定标题` 写成可引用的阅读单位,把 `引用规则` 写成规则说明,并在正文里写出参见和依赖两种引用。
24
-
25
- [source,turtle]
26
- ----
27
- :stable-heading a aat:Heading ;
28
- aat:headline "稳定标题" ;
29
- aat:addressLabel "stable-heading" ;
30
- aat:role "concept" .
31
-
32
- :xref-rule a aat:Heading ;
33
- aat:headline "引用规则" ;
34
- aat:addressLabel "xref-rule" ;
35
- aat:role "rule" ;
36
- aat:references :stable-heading ;
37
- rel:depends-on :stable-heading .
38
-
39
- :xref-edge-depends-on a aat:XrefEdge ;
40
- aat:rel "depends-on" ;
41
- aat:weight "strong" .
42
- ----
43
-
44
- 读者看源文档,能直接看到 [.concept]#稳定标题# 是被引用的阅读单位, [.rule]#引用规则# 说明引用写法。下游投影工具链读取同一份源文档,得到 `aat:Heading`、`aat:addressLabel`、`aat:role`、`aat:references` 和 `rel:depends-on`。
@@ -1,26 +0,0 @@
1
- [#heading-and-xref]
2
- == 标题与引用
3
-
4
- 等号行是标题。标题前一行的 attrlist 承载地址和 role。
5
-
6
- [source,asciidoc]
7
- ----
8
- [#stable-heading.concept]
9
- == 稳定标题
10
- ----
11
-
12
- `#stable-heading` 给标题一个稳定地址;`.concept` 标明标题身份;`稳定标题` 是读者看到的标题文本。
13
-
14
- [source,asciidoc]
15
- ----
16
- 引用规则参见 xref:stable-heading[稳定标题]。
17
- ----
18
-
19
- 这条 xref 表示参见目标标题。投影时,这条引用使用默认谓词 `aat:references`。
20
-
21
- [source,asciidoc]
22
- ----
23
- 引用规则依赖 xref:stable-heading[稳定标题, rel=depends-on]。
24
- ----
25
-
26
- 写入 `rel=depends-on` 时,作者声明当前标题到目标标题的依赖关系。投影时,这条关系使用 `rel:depends-on`。
@@ -1,23 +0,0 @@
1
- [#source-order-notation]
2
- == 源文件编排号
3
-
4
- 源文件编排号写在 part 目录名和 chapter 文件名前部。indexterm:[源文件编排号]
5
-
6
- part 目录使用 `100-`、`200-`、`300-`。chapter 文件在所属 part 内使用 `010-`、`020-`、`030-`。
7
-
8
- 中间插入新文件时,使用相邻编号之间的空位。
9
-
10
- [source,text]
11
- ----
12
- parts/100-source-surface/
13
- parts/150-new-topic/
14
- parts/200-identity-and-relation/
15
-
16
- 010-opening.adoc
17
- 015-new-context.adoc
18
- 020-main-flow.adoc
19
- ----
20
-
21
- 标题文本保留语义名称。长期引用的标题使用显式 ID。
22
-
23
- 编排号帮助维护者观察源文件顺序;显式 ID 帮助读者和工具链稳定引用标题。
@@ -1,37 +0,0 @@
1
- [#role-identity]
2
- == role 身份
3
-
4
- `[#xref-rule.rule]` 里的 `.rule` 是 indexterm2:[role]。它把这个标题标成规则说明。
5
-
6
- role 写在标题 attrlist 的点号 token 位置。
7
-
8
- [source,asciidoc]
9
- ----
10
- [#stable-heading.concept]
11
- == 稳定标题
12
-
13
- [#xref-rule.rule]
14
- == 引用规则
15
- ----
16
-
17
- `#stable-heading` 和 `#xref-rule` 是稳定 ID。`.concept` 和 `.rule` 标明标题身份。
18
-
19
- [cols="1,2", options="header"]
20
- |===
21
- |写法 |读者看到的身份
22
-
23
- |`[.concept]`
24
- |标记概念说明。
25
-
26
- |`[.rule]`
27
- |标记规则说明。
28
-
29
- |`[.example]`
30
- |标记示例。
31
- |===
32
-
33
- role 的职责,是在全书范围内保持身份含义的稳定。
34
-
35
- 一旦一个 role 被定义——例如 `.rule` 代表规则说明——它在全书任何地方都只能代表这个身份,不能产生歧义。一本书需要多少种 role,取决于它所要描述的领域固有的本质复杂度。无论三种还是十种,每一种都必须是确定的。
36
-
37
- 读者和工具链依赖这种稳定理解来导航文本和提取结构。
@@ -1,22 +0,0 @@
1
- [#relation-predicate]
2
- == rel 关系谓词
3
-
4
- indexterm:[relation predicate] `rel` 是 xref 边上的关系谓词。xref 写在哪个标题下面,哪个标题就是关系起点;xref 指向哪个标题,哪个标题就是关系终点。本书把这两个位置称为 source heading 和 target heading。
5
-
6
- [source,asciidoc]
7
- ----
8
- 引用规则参见 xref:stable-heading[稳定标题]。
9
- 引用规则依赖 xref:stable-heading[稳定标题, rel=depends-on]。
10
- ----
11
-
12
- 第一行表示参见 `稳定标题`,投影为 `aat:references`。第二行写入 `rel=depends-on`,声明 `引用规则` 到 `稳定标题` 的依赖关系,投影为 `rel:depends-on`。
13
-
14
- `rel` 会被读者和工具当作关系谓词。同一本书使用 rel 时,应保持谓词含义稳定。
15
-
16
- [horizontal]
17
- depends-on:: 当前标题的判断、规则或操作以目标标题为依据。阅读顺序和先读建议使用普通 xref 表达。
18
- illustrates:: 当前标题提供目标标题的示例。
19
- defines:: 当前标题给出目标标题所代表对象的定义。
20
- constrains:: 当前标题对目标标题的合法写法或范围施加约束。
21
-
22
- 关系谓词描述标题之间的边。标题自身的身份使用 role 表达。
@@ -1 +0,0 @@
1
- 本部展示标题身份和引用关系。role 标明标题身份;rel 标明引用关系。 你应该在自己书籍里增加各类词表约定的章节。