Question : Relation between Document and Section blocks (slideshow)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Question : Relation between Document and Section blocks (slideshow)

ch007m
Hi,

What is the relation between a block document (document.html.slim) and section (section.html.slim)? Do we have a one to one relation or 1 to many ? I suppose that the response is YES (one to many)

Why this question ? When we generate a slideshow (Revealjs, DeckJS, ...) the HTML generated is a collection of slides which are in fact a collection of <section id=""></section> blocks. That means that for each title (level 2), the section block of slim (or haml, ...) is called (yes or no) ? If this assertion is true, how can we manage by example to display a title or not for a specific slide when the asciidoc file looks like that

:data-uri:
:icons: font
:last-update-label!:
:source-highlighter: coderay

== Title 2

text of slide 2 - title should be displayed

[notitle: true]
== Title 3

text of slide 3 - title should not be displayed

Charles Moulliard
Apache Committer / Technologist Evangelist / Blogger / MiddleWare Specialist
Twitter : @cmoulliard
Reply | Threaded
Open this post in threaded view
|

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

ch007m
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
Reply | Threaded
Open this post in threaded view
|

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

ch007m
Additonal info. If I do this test without the index file (= where we have include::) the values displayed are correct

***********************************
Title :1. Title should not be displayed
Document attr Key retrieved :true
          Att Key retrieved :false
***********************************
>>        Dir of html: /Users/chmoulli/Temp/test_asciidoctor/generated_content_ilt/.
>> File to be rendered : /Users/chmoulli/Temp/test_asciidoctor/doc2.ad
***********************************
Title :1. Title should be displayed
Document attr Key retrieved :false
          Att Key retrieved :false
***********************************

So the issue comes from the file + include:: directive and inheritance.
Charles Moulliard
Apache Committer / Technologist Evangelist / Blogger / MiddleWare Specialist
Twitter : @cmoulliard