Giter Club home page Giter Club logo

Comments (9)

owenh000 avatar owenh000 commented on June 22, 2024 1

I guess I expect the asciidoc to build the same no matter if I am using multipage or not.

Well, that seems reasonable, but it's not perfect. (And we are also literally expecting it to not build the same, in that we want it to generate multiple HTML output pages rather than just one.)

Does the workaround you mentioned have to do with a technical limitation of the asciidoctor API you extend and the point at which attributes are able to be inherited?

I suppose so, but I cannot answer that for sure. I do know that asciidoctor-multipage works by taking the single, entire Asciidoctor::Document object (of which there is normally only one) and creates multiple Asciidoctor::Document objects (one for each page) from the document tree. Perhaps the earlier include:: is not processed at all in the scope of the later child pages, leaving the attributes missing.

from asciidoctor-multipage.

owenh000 avatar owenh000 commented on June 22, 2024

This will work if you define the attributes in the document header, like this:

= My page
include::data/shared-metadata.adoc[]

{metadata_0}

== Page 1
{metadata_1}

== Page 2
{metadata_2}

from asciidoctor-multipage.

bostrt avatar bostrt commented on June 22, 2024

Yes! Thank you and that solves it 👍

from asciidoctor-multipage.

bostrt avatar bostrt commented on June 22, 2024

Apologies, but after some more testing, I tend to see defining the attributes include in document header was a workaround to the root issue. I guess I expect the asciidoc to build the same no matter if I am using multipage or not.

Does the workaround you mentioned have to do with a technical limitation of the asciidoctor API you extend and the point at which attributes are able to be inherited?

from asciidoctor-multipage.

bostrt avatar bostrt commented on June 22, 2024

@owenh000 Thanks for the follow-up.

from asciidoctor-multipage.

bostrt avatar bostrt commented on June 22, 2024

Just by chance, I found that if I only mention in the include in the top level section then multipage renders as I would expect. Internally, this may be acting the same as the workaround you already mentioned. So the following works and renders correctly no matter the placement of the include:

= My page

include::testing.adoc[]

== Page 1

{metadata_0}

{metadata_1}

== Page 2
{metadata_2}

from asciidoctor-multipage.

owenh000 avatar owenh000 commented on June 22, 2024

@bostrt, thanks for sharing the example.

from asciidoctor-multipage.

gabriel-rh avatar gabriel-rh commented on June 22, 2024

It would appear that this is a specific instance of the more general #23

Here is what works and what fails for me:

FAILS - Content in preamble

= test issue #23

include::attributes.adoc[]

If this preamble is removed, the attribute below (in Chapter) will work.

== Chapter

This should be *myvalue*: {myattr}

WORKS - No content in preamble

= test issue #23

include::attributes.adoc[]

//If this preamble is removed, the attribute below (in Chapter) will work.

== Chapter

This should be *myvalue*: {myattr}

WORKS - Move attributes definitions into header

= test issue #23
include::attributes.adoc[]

If this preamble is removed, the attribute below (in Chapter) will work.

== Chapter

This should be *myvalue*: {myattr}

WORKS - Move title into preamble

include::attributes.adoc[]

= test issue #23

If this preamble is removed, the attribute below (in Chapter) will work.

== Chapter

This should be *myvalue*: {myattr}

from asciidoctor-multipage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.