Suppressing link of some TOC entries ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Suppressing link of some TOC entries ?

jnilo
Here is my problem: I am creating a .chm file trough htmlhelp stylesheet applied to an xml file generated by asciidoctor.
My files are chuncked with: use.id.as.filename=1 chunk.first.sections=1 chunk.section.depth=3
But I would like to avoid displaying an empty right panel when opening the .chm file (i.e. display content only if the leaf is non empty).
For example if I have the test file
= Documentation

== Chapter 1

Lorem ipsum chapter 1

=== Section 1

==== Sub section 1

Lorem ipsum sub section 1
Section 1 will show up in TOC and appear only with its title in the .chm right panel since there is no content associated with Section 1.
Here are my ideas:
1/ Is there some way to suppress the _section_1 (automatically generated) link while keeping the "Section 1" label in TOC ?
2/ Alternatively I see the part of hhc.entry template in htmlhelp-common.xsl that I should skip in order to
avoid the generation in test.hhc of:
<LI><OBJECT type="text/sitemap">
<param name="Name" value="Section 1">
<param name="Local" value="_section_1.html"></OBJECT></LI>
<UL>
If I suppress:
<param name="Local" value="_section_1.html">
that will do the trick. This is where the job is done at the end of hhc.entry template:
  <LI><OBJECT type="text/sitemap">&lf;
    <param name="Name">
      <xsl:attribute name="value">
          <xsl:value-of select="normalize-space($title)"/>
      </xsl:attribute>
    </param>&lf;
    <param name="Local">
      <xsl:attribute name="value">
          <xsl:call-template name="href.target.with.base.dir"/>
      </xsl:attribute>
    </param>
  </OBJECT></LI>&lf;
</xsl:template>
Is there some trick (special tags for example) that I could put in my asciidoctor code and that I could use to skip that part of the stylesheet.
Any other suggestion are welcome !
Jacques
Reply | Threaded
Open this post in threaded view
|

Re: Suppressing link of some TOC entries ?

mojavelinux
Administrator
This looks like a DocBook toolchain question, since Asciidoctor itself doesn't create htmlhelp output. Therefore, my only advice is to customize the XSL templates that the DocBook toolchain uses.

If you are trying to pass information through the DocBook on to those XSL templates, then you could use a role on the section.

[.empty]
=== Section 1

You could add that role automatically based on whether the section has any non-section blocks using a Treeprocessor. See https://github.com/asciidoctor/asciidoctor-extensions-lab.

I hope that helps a little!

Cheers,

-Dan

On Mon, Jul 13, 2015 at 10:31 AM, jnilo [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Here is my problem: I am creating a .chm file trough htmlhelp stylesheet applied to an xml file generated by asciidoctor.
My files are chuncked with: use.id.as.filename=1 chunk.first.sections=1 chunk.section.depth=3
But I would like to avoid displaying an empty right panel when opening the .chm file (i.e. display content only if the leaf is non empty).
For example if I have the test file
= Documentation

== Chapter 1

Lorem ipsum chapter 1

=== Section 1

==== Sub section 1

Lorem ipsum sub section 1
Section 1 will show up in TOC and appear only with its title in the .chm right panel since there is no content associated with Section 1.
Here are my ideas:
1/ Is there some way to suppress the _section_1 (automatically generated) link while keeping the "Section 1" label in TOC ?
2/ Alternatively I see the part of hhc.entry template in htmlhelp-common.xsl that I should skip in order to
avoid the generation in test.hhc of:
<LI><OBJECT type="text/sitemap">
<param name="Name" value="Section 1">
<param name="Local" value="_section_1.html"></OBJECT></LI>
<UL>
If I suppress:
<param name="Local" value="_section_1.html">
that will do the trick. This is where the job is done at the end of hhc.entry template:
  <LI><OBJECT type="text/sitemap">&lf;
    <param name="Name">
      <xsl:attribute name="value">
          <xsl:value-of select="normalize-space($title)"/>
      </xsl:attribute>
    </param>&lf;
    <param name="Local">
      <xsl:attribute name="value">
          <xsl:call-template name="href.target.with.base.dir"/>
      </xsl:attribute>
    </param>
  </OBJECT></LI>&lf;
</xsl:template>
Is there some trick (special tags for example) that I could put in my asciidoctor code and that I could use to skip that part of the stylesheet.
Any other suggestion are welcome !
Jacques


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Suppressing-link-of-some-TOC-entries-tp3499.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--