Menu

HTML Bubble TOC

2014-09-20
2015-01-16
  • Stefan Quandt

    Stefan Quandt - 2014-09-20

    Hi,
    DAPS generated HTML supports a wonderful scrollable table of contents, which is shown as overlay box when hovering over "Show Contents".

    Unfortunately due to a bug in the template rule matching <chapter> elements in the autobubbletoc.xsl stylesheet, entries for this TOC are only generated for top-level elements (chapters) of a book (<section> and <sect1> elements are not propagated in call to template bubble-subtoc).

    After correcting this, the generated HTML contains all TOC entries as nested <ol> elements, but when viewing the result in a browser, still only top level chapters appear.

    Is this a problem of item filtering in Javascript?
    How can this be fixed?

     
  • Thomas Schraitle

    Hi Stefan,

    sorry for the late reply.

    I'm not sure if I understand what you mean. What did you change? Could you elaborate please?

    Thanks!

     
  • Stefan Quandt

    Stefan Quandt - 2014-09-24

    I'm generating single page HTML with
    STYLEROOT="/opt/daps-trunk/daps/suse/daps2013/"

    In the template rule matching <chapter> elements in
    daps/suse/suse2013/xhtml/autobubbletoc.xsl
    I extended the 'select' attribute to include section elements (to be passed as param "nodes" in calling template bubble-subtoc):

    <xsl:template match="preface|chapter|appendix|topic" mode="bubble-toc">
      <xsl:param name="toc-context" select="."/>
    
      <xsl:call-template name="bubble-subtoc">
        <xsl:with-param name="toc-context" select="$toc-context"/>
        <xsl:with-param name="nodes"
          select="section|sect1|topic|refentry|glossary|bibliography|index|
          bridgehead[$bridgehead.in.toc != 0]"/>
      </xsl:call-template>
    </xsl:template>
    

    As consequence the generated HTML then contains a full recursive TOC of nested <ol> elements introduced by

    <div class="active-contents bubble">
      <div class="bubble-container">
        <div id="_bubble-toc">
    

    Unfortunately, rendering of the "bubble" TOC in a browser still shows only top-level chapter headings (no sections at all).

     

    Last edit: Stefan Quandt 2014-09-24
  • Anonymous

    Anonymous - 2014-09-24

    Pardon,
    there are still some pieces of information missing:

    First off, I am authoring a Docbook 5 document of type <book> with sections nesting up to level 4.
    Of course a prerequisite for getting a hierachical HTML "bubble TOC" is to
    set appropriate parameters in daps/suse/suse2013/xhtml/param.xsl, as in

    <xsl:param name="bubbletoc.section.depth">4</xsl:param>
    <xsl:param name="bubbletoc.max.depth">4</xsl:param>
    

    Then the DAPS documentation (Docbook 4) sources getting hierarchical bubble TOC from was possible, but not before unconditionally setting the value of xsl:param "bubbletoc.max.depth.shallow" to zero (in param.xsl).
    I.e. these variable setitngs were sufficient to get a hierarchical bubble TOC with Docbook 4 XML sources and there is no need to patch autobubbletoc.xsl for this purpose.
    Also, the bubble TOC also gets rendered properly when viewing in a browser (with some alignment and line break issues though).

    Contrary to that, in the case of my Docbook 5 book, it turned that additionally patching of autobubbletoc.xsl is required to resolve the issue of HTML TOC generation which i initially described.

    Thanks in advance
    Stefan

     
  • Stefan Quandt

    Stefan Quandt - 2014-09-24

    Pardon,
    there are still some pieces of information missing:

    First off, I am authoring a Docbook 5 document of type <book> with sections nesting up to level 4.
    Of course a prerequisite for getting a hierachical HTML "bubble TOC" is to
    set appropriate parameters in daps/suse/suse2013/xhtml/param.xsl, as in

    <xsl:param name="bubbletoc.section.depth">4</xsl:param>
    <xsl:param name="bubbletoc.max.depth">4</xsl:param>
    

    Then it was possible to generate HTML docs with hierarchical bubble TOC from the DAPS documentation (Docbook 4) sources, but not before unconditionally setting the value of xsl:param bubbletoc.max.depth.shallow" to zero (in param.xsl).
    I.e. these variable settings are sufficient to get a hierarchical bubble TOC from Docbook 4 XML sources and in this case there is no need to patch autobubbletoc.xsl.
    Also, the bubble TOC gets rendered properly when viewing in a browser (with some alignment and line break issues though).

    Contrary to that, in the case of my Docbook 5 book, it turned out that additionally patching of autobubbletoc.xsl is required to resolve the issue of HTML TOC generation which i initially described.

    Thanks in advance
    Stefan

     

    Last edit: Stefan Quandt 2014-09-24
  • Thomas Schraitle

    Hi Stefan,

    thanks for the detailed report.

    First off, I am authoring a Docbook 5 document of type <book> with sections nesting up to level 4.

    Currently, we don't support DocBook 5 ATM. So I guess, that's the reason why it doesn't work. You could transform your DocBook 5 to DocBook 4 and see if things work. Or you could remove the DocBook 5 namespace.

    Sorry, today and tomorrow I will have no time to investigate it further, but I hope I will catch up next week.

    Thanks again!

     
  • Stefan Quandt

    Stefan Quandt - 2014-09-26

    Hi Thomas,
    thanks for your response.

    I also think that the cause is some XSL stylesheet not descending on chapters in case of Docbook 5 XML sources.

    Migrating back to Docbook 4 is not really an option, since we already made the switch to Docbook 5 back in 2011.
    But since my patches in param.xsl and autobubbletoc.xsl turned out to work around the issue, this no longer is a showstopper for me.

    Thus the next step for me would be to improve on the usability of the bubble TOC in case of books with sections nesting more than two levels.
    E.g.
    - when clicking expandable TOC items of level two and higher for the first time, there children will not become visible before closing the TOC window and opening again
    - TOC items of level two which are expandable have wrong width so that they overlap into the TOC column to the right.
    Unfortunately my Javascript skills are limited, so that I would like to submit a ticket for this.

    Best regards
    Stefan

     

    Last edit: Stefan Quandt 2014-09-26
    • Thomas Schraitle

      Migrating back to Docbook 4 is not really an option, since we already made the switch to Docbook 5 back in 2011.

      In the (hopefully not so far) future DAPS will support DocBook 5 directly.

      But since my patches in param.xsl and autobubbletoc.xsl turned out to work around the issue, this no longer is a showstopper for me.

      Great!

      Unfortunately, my Javascript skills are also limitied.

      Best regards,
      Tom

       

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.