Login  Register

Re: Question : Relation between Document and Section blocks (slideshow)

Posted by ch007m on Mar 06, 2014; 4:08pm
URL: https://discuss.asciidoctor.org/Question-Relation-between-Document-and-Section-blocks-slideshow-tp1584p1587.html

I forget to mention in my previous post that the project consists in a asciidoc file (containing include:: directive) and some asciidoc file. So the asciidoctor 0.1.4 will start to read the contain of the asciidoc file (= index) and merge the asciidoc files.

Here is the code used :

Index file
== Index

include::doc1.ad[]
include::doc2.ad[]
 
doc1.ad
:notitle: true

== 1. Title should not be displayed

Title should not be displayed
 
doc2.ad
:notitle: false

== 1. Title should be displayed

Title should be displayed

When I do the rendering using this backend section template

- a_t = @attributes.key?('notitle') ? false : true
- d_t = @document.attributes.key?('notitle') ? false: true

- puts "***********************************" 

- puts "Title :" + title
- puts "Document attr Key retrieved :" + @document.attributes.key?('notitle').to_s
- puts "          Att Key retrieved :" + @attributes.key?('notitle').to_s
/- puts "Documents attributes        :" + @document.attributes.inspect
/- puts "Attributes                  :" + @attributes.inspect  

- puts "***********************************"  

we can verify which 'notitle' key is retrieved from the @Document or @Attributes

***********************************
Title :Index
Document attr Key retrieved :false
          Att Key retrieved :false
***********************************
***********************************
Title :1. Title should not be displayed
Document attr Key retrieved :true
          Att Key retrieved :false
***********************************
***********************************
Title :1. Title should be displayed
Document attr Key retrieved :true
          Att Key retrieved :false

But the result is for me until now incomprehensible !
- Is it due to an issue with the include:: directive that we have in the index parent file ?
- As you can also see if I place a :notitle: true in the doc1.ad, this Document.attr key does not change with :notitle: false defined in document doc2.ad. So I'm really perplex here.
- Which variable should I use @document.attributes.key?('notitle') OR @attributes.key?('notitle')

Regards,


Charles Moulliard
Apache Committer / Technologist Evangelist / Blogger / MiddleWare Specialist
Twitter : @cmoulliard