【问题标题】:Generating table of contents for multi-file asciidoc book为多文件 asciidoc 书生成目录
【发布时间】:2020-03-29 11:07:02
【问题描述】:

我是 asciidoc 的初学者。我已将我的项目结构化为模块化文件,因此更易于管理。而且我能够使用 asciidoctor 生成 pdf。但是,目录不包括它通过include 指令获得的文件列表。

这里是主文件:

= Booktitle
Vinay <email>
:sectnums:
:toc:
:toclevels:

:leveloffset: 1

include::chapters/chapter_00.adoc
include::chapters/chapter_01.adoc
include::chapters/chapter_02.adoc

:leveloffset: 0
Index
======

这里是 chapter_01.adoc:

= The First Chapter

This is the first chapter.

目录仅包含指向索引的链接。我做错了什么?

我使用的命令是:asciidoctor-pdf book.adoc

【问题讨论】:

    标签: asciidoc asciidoctor asciidoctor-pdf


    【解决方案1】:

    您的包含缺少一对方括号。对于具有标题页的书,您可能希望将doctype 属性设置为book。属性toclevel 应设置为一个数字,指示您要在目录中列出的标题级别。如果您将其留空,则目录将为空。

    使用 Asciidoctor 2.0.10 使用 Asciidoctor PDF 1.5.3 进行测试,以下对我有用:

    = Booktitle
    Vinay <email>
    :sectnums:
    :toc:
    :toclevels: 2
    :doctype: book
    
    :leveloffset: 1
    
    include::chapters/chapter_00.adoc[]
    include::chapters/chapter_01.adoc[]
    include::chapters/chapter_02.adoc[]
    
    :leveloffset: 0
    
    [Index]
    = Index
    

    【讨论】:

    • 看来必须使用[index](小写)才能使索引正常工作。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-01
    • 1970-01-01
    • 2012-02-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多