ggrossetie / asciidoctor-web-pdf

Convert AsciiDoc documents to PDF using web technologies
https://asciidoctor.org
MIT License
455 stars 92 forks source link

Cross references pointing to files that contain tags do not function properly #625

Closed patrickluoyu closed 2 years ago

patrickluoyu commented 2 years ago

Assume the following files:

|--chapter.adoc
|--chapters
    |--chapter-1.adoc
    |--chapter-2.adoc
    |--chapter-2
        |--first-steps.adoc

chapter.doc

= Book Title
:doctype: book

include::chapters/chapter-1.adoc[]

include::chapters/chapter-2.adoc[]

chapter-1.adoc

== Chapter 1

We cover a little bit here.
The rest you can find in <<chapters/chapter-2.adoc#_chapter_2,Chapter 2>>.

chapter-2.adoc

== Chapter 2

Prepare to be educated.
This chapter has it all!

To begin, jump to <<chapters/chapter-2/first-steps.adoc#_first_steps,first steps>>.

// tag::test[]

test

// end::test[]

<<<

include::chapter-2/first-steps.adoc[]

first-steps.adoc

=== First Steps

Let's start small.

include::../chapter-2.adoc[tags=test]

If we convert chapter.adoc into a PDF file, the cross reference <<chapters/chapter-2.adoc#_chapter_2,Chapter 2>> in chapter-1.adoc is faulty. However, if we remove the tag statements in chapter-2.adoc or remove include::../chapter-2.adoc[tags=test] in first-steps.adoc, everything works fine.

Please help resolve the problem. Thanks!

ggrossetie commented 2 years ago

Since I can reproduce this behavior using asciidoctor CLI, I assume that this is not specific to asciidoctor-web-pdf`` (which relies onasciidoctor`).

I'm also unsure if this is the intended behavior or not. Please ask your question in the #users stream of the community chat at asciidoctor.zulipchat.com. Thanks!