Comments (9)
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.
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.
Yes! Thank you and that solves it 👍
from asciidoctor-multipage.
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.
@owenh000 Thanks for the follow-up.
from asciidoctor-multipage.
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.
@bostrt, thanks for sharing the example.
from asciidoctor-multipage.
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)
- Add option to generate ToC child links without the .html extension for servers like GitHub pages that automatically remove those extension HOT 6
- Make the split page heading larger, either making it a h1 or h2 or via styles HOT 3
- Preamble affects included attributes HOT 2
- Error in multiparts documents when partnums attribute is specified HOT 1
- Use --out-file break the links to home HOT 1
- Custom `toclevels` / option to keep full TOC HOT 4
- Clarify usage of Cross-References HOT 2
- ToC generated inside block level (a) table cells with toc2 attr set on command line HOT 5
- Wrong numeration of appendix chapters HOT 4
- source highlight style does not extract to a file HOT 6
- Do not generate the configurate theme style file for Rouge highlighter HOT 2
- The tags which are in the section title are escaped HOT 1
- The appendix section number is wrong. HOT 4
- Variables not substituted in TOC HOT 3
- How do I prevent asciidoctor-multipage from resetting the latex equation counter after every HTML Page? HOT 3
- Error: "Failed to execute goal de.saumya.mojo:gem-maven-plugin" HOT 4
- wrong permissions on /var/lib/gems/3.0.0/gems/asciidoctor-multipage-0.0.16/bin/asciidoctor-multipage ? HOT 1
- Using output file name for first page (--out-file FILE is not supported) HOT 1
- Cannot disable stylesheets across all pages HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asciidoctor-multipage.