View Single Post
Old 06-15-2017, 11:53 AM   #12
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,094
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
If you use the approach recommended here the auto-toc ("Generate Table Of Contents Ctrl+T") function of Sigil will create a toc.ncx out of the following html example but all of your h6.hx tags will only be nested to the 6th level. You would need to manually adjust the nesting (as simple as highlighting and dragging into the previous navpoint). To nest varying levels would only require one to drag the lower-level navpoint inside the previous higher level navpoint.

example html:
Spoiler:
Code:
<body>
<h1>level 1</h1>
<h2>level 2</h2>
<h3>level 3</h3>
<h4>level 4</h4>
<h5>level 5</h5>
<h6>level 6</h6>
<h6 class="h7">level 7</h6>
<h6 class="h8">level 8</h6>
<h6 class="h9">level 9</h6>
<h5>level 5</h5>
<h4>level 4</h4>
<h3>level 3</h3>
<h2>level 2</h2>
</body>
The auto toc will detect all the hx tags up to level h6 as shown in the 1st attached image:

auto created .ncx:
Spoiler:
Code:
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
  <head>
    <meta name="dtb:uid" content="urn:uuid:bfea96a5-cd70-48c3-896b-c6861ae9b526"/>
    <meta name="dtb:depth" content="6"/>
    <meta name="dtb:totalPageCount" content="0"/>
    <meta name="dtb:maxPageNumber" content="0"/>
  </head>
  <docTitle>
    <text>[No data]</text>
  </docTitle>
  <navMap>
    <navPoint id="navPoint-1" playOrder="1">
      <navLabel>
        <text>level 1</text>
      </navLabel>
      <content src="Text/Section0001.xhtml"/>
      <navPoint id="navPoint-2" playOrder="2">
        <navLabel>
          <text>level 2</text>
        </navLabel>
        <content src="Text/Section0001.xhtml#sigil_toc_id_1"/>
        <navPoint id="navPoint-3" playOrder="3">
          <navLabel>
            <text>level 3</text>
          </navLabel>
          <content src="Text/Section0001.xhtml#sigil_toc_id_2"/>
          <navPoint id="navPoint-4" playOrder="4">
            <navLabel>
              <text>level 4</text>
            </navLabel>
            <content src="Text/Section0001.xhtml#sigil_toc_id_3"/>
            <navPoint id="navPoint-5" playOrder="5">
              <navLabel>
                <text>level 5</text>
              </navLabel>
              <content src="Text/Section0001.xhtml#sigil_toc_id_4"/>
              <navPoint id="navPoint-6" playOrder="6">
                <navLabel>
                  <text>level 6</text>
                </navLabel>
                <content src="Text/Section0001.xhtml#sigil_toc_id_5"/>
              </navPoint>
              <navPoint id="navPoint-7" playOrder="7">
                <navLabel>
                  <text>level 7</text>
                </navLabel>
                <content src="Text/Section0001.xhtml#sigil_toc_id_6"/>
              </navPoint>
              <navPoint id="navPoint-8" playOrder="8">
                <navLabel>
                  <text>level 8</text>
                </navLabel>
                <content src="Text/Section0001.xhtml#sigil_toc_id_7"/>
              </navPoint>
              <navPoint id="navPoint-9" playOrder="9">
                <navLabel>
                  <text>level 9</text>
                </navLabel>
                <content src="Text/Section0001.xhtml#sigil_toc_id_8"/>
              </navPoint>
            </navPoint>
            <navPoint id="navPoint-10" playOrder="10">
              <navLabel>
                <text>level 5</text>
              </navLabel>
              <content src="Text/Section0001.xhtml#sigil_toc_id_9"/>
            </navPoint>
          </navPoint>
          <navPoint id="navPoint-11" playOrder="11">
            <navLabel>
              <text>level 4</text>
            </navLabel>
            <content src="Text/Section0001.xhtml#sigil_toc_id_10"/>
          </navPoint>
        </navPoint>
        <navPoint id="navPoint-12" playOrder="12">
          <navLabel>
            <text>level 3</text>
          </navLabel>
          <content src="Text/Section0001.xhtml#sigil_toc_id_11"/>
        </navPoint>
      </navPoint>
      <navPoint id="navPoint-13" playOrder="13">
        <navLabel>
          <text>level 2</text>
        </navLabel>
        <content src="Text/Section0001.xhtml#sigil_toc_id_12"/>
      </navPoint>
    </navPoint>
  </navMap>
</ncx>
The auto created .ncx will appear as shown in the 2nd attached image.

manually corrected .ncx:
Spoiler:
Code:
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
  <head>
    <meta name="dtb:uid" content="urn:uuid:bfea96a5-cd70-48c3-896b-c6861ae9b526"/>
    <meta name="dtb:depth" content="6"/>
    <meta name="dtb:totalPageCount" content="0"/>
    <meta name="dtb:maxPageNumber" content="0"/>
  </head>
  <docTitle>
    <text>[No data]</text>
  </docTitle>
  <navMap>
    <navPoint id="navPoint-1" playOrder="1">
      <navLabel>
        <text>level 1</text>
      </navLabel>
      <content src="Text/Section0001.xhtml"/>
      <navPoint id="navPoint-2" playOrder="2">
        <navLabel>
          <text>level 2</text>
        </navLabel>
        <content src="Text/Section0001.xhtml#sigil_toc_id_1"/>
        <navPoint id="navPoint-3" playOrder="3">
          <navLabel>
            <text>level 3</text>
          </navLabel>
          <content src="Text/Section0001.xhtml#sigil_toc_id_2"/>
          <navPoint id="navPoint-4" playOrder="4">
            <navLabel>
              <text>level 4</text>
            </navLabel>
            <content src="Text/Section0001.xhtml#sigil_toc_id_3"/>
            <navPoint id="navPoint-5" playOrder="5">
              <navLabel>
                <text>level 5</text>
              </navLabel>
              <content src="Text/Section0001.xhtml#sigil_toc_id_4"/>
              <navPoint id="navPoint-6" playOrder="6">
                <navLabel>
                  <text>level 6</text>
                </navLabel>
                <content src="Text/Section0001.xhtml#sigil_toc_id_5"/>
                <navPoint id="navPoint-7" playOrder="7">
                  <navLabel>
                    <text>level 7</text>
                  </navLabel>
                  <content src="Text/Section0001.xhtml#sigil_toc_id_6"/>
                  <navPoint id="navPoint-8" playOrder="8">
                    <navLabel>
                      <text>level 8</text>
                    </navLabel>
                    <content src="Text/Section0001.xhtml#sigil_toc_id_7"/>
                    <navPoint id="navPoint-9" playOrder="9">
                      <navLabel>
                        <text>level 9</text>
                      </navLabel>
                      <content src="Text/Section0001.xhtml#sigil_toc_id_8"/>
                    </navPoint>
                  </navPoint>
                </navPoint>              
              </navPoint>
            </navPoint>
            <navPoint id="navPoint-10" playOrder="10">
              <navLabel>
                <text>level 5</text>
              </navLabel>
              <content src="Text/Section0001.xhtml#sigil_toc_id_9"/>
            </navPoint>
          </navPoint>
          <navPoint id="navPoint-11" playOrder="11">
            <navLabel>
              <text>level 4</text>
            </navLabel>
            <content src="Text/Section0001.xhtml#sigil_toc_id_10"/>
          </navPoint>
        </navPoint>
        <navPoint id="navPoint-12" playOrder="12">
          <navLabel>
            <text>level 3</text>
          </navLabel>
          <content src="Text/Section0001.xhtml#sigil_toc_id_11"/>
        </navPoint>
      </navPoint>
      <navPoint id="navPoint-13" playOrder="13">
        <navLabel>
          <text>level 2</text>
        </navLabel>
        <content src="Text/Section0001.xhtml#sigil_toc_id_12"/>
      </navPoint>
    </navPoint>
  </navMap>
</ncx>
The manually corrected .ncx will appear as shown in the 3rd attached image. (note: this is how it appears in Sigil - no guarantee how other devices/apps will display it)

Once the .ncx is manually corrected then you could use the "Create HTML Table Of Contents" tool from Sigil and it will create a correctly organized/tagged html file.

auto generated HTML-TOC:
Spoiler:
Code:
<body>
  <div class="sgc-toc-title">
    Table of Contents
  </div>

  <div class="sgc-toc-level-1">
    <a href="../Text/Section0001.xhtml">level 1</a> 

    <div class="sgc-toc-level-2">
      <a href="../Text/Section0001.xhtml#sigil_toc_id_1">level 2</a> 

      <div class="sgc-toc-level-3">
        <a href="../Text/Section0001.xhtml#sigil_toc_id_2">level 3</a> 

        <div class="sgc-toc-level-4">
          <a href="../Text/Section0001.xhtml#sigil_toc_id_3">level 4</a> 

          <div class="sgc-toc-level-5">
            <a href="../Text/Section0001.xhtml#sigil_toc_id_4">level 5</a> 

            <div class="sgc-toc-level-6">
              <a href="../Text/Section0001.xhtml#sigil_toc_id_5">level 6</a> 

              <div class="sgc-toc-level-7">
                <a href="../Text/Section0001.xhtml#sigil_toc_id_6">level 7</a> 

                <div class="sgc-toc-level-8">
                  <a href="../Text/Section0001.xhtml#sigil_toc_id_7">level 8</a> 

                  <div class="sgc-toc-level-9">
                    <a href="../Text/Section0001.xhtml#sigil_toc_id_8">level 9</a>
                  </div>
                </div>
              </div>
            </div>
          </div>

          <div class="sgc-toc-level-5">
            <a href="../Text/Section0001.xhtml#sigil_toc_id_9">level 5</a>
          </div>
        </div>

        <div class="sgc-toc-level-4">
          <a href="../Text/Section0001.xhtml#sigil_toc_id_10">level 4</a>
        </div>
      </div>

      <div class="sgc-toc-level-3">
        <a href="../Text/Section0001.xhtml#sigil_toc_id_11">level 3</a>
      </div>
    </div>

    <div class="sgc-toc-level-2">
      <a href="../Text/Section0001.xhtml#sigil_toc_id_12">level 2</a>
    </div>
  </div>
</body>

You would then need to manually change the additional levels to indent/format them further by adjusting the css file created for the html toc.("sgc-toc.css")

example sgc-toc.css:
Spoiler:
Code:
div.sgc-toc-title {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 1em;
    text-align: center; font-family:serif
}

div.sgc-toc-level-1 {margin-left: 0em;}

div.sgc-toc-level-2 {margin-left: 2em;}

div.sgc-toc-level-3 {margin-left: 4em;}

div.sgc-toc-level-4 {margin-left: 6em;}

div.sgc-toc-level-5 {margin-left: 8em;}

div.sgc-toc-level-6 {margin-left: 10em;}

/* Additional levels  */

div.sgc-toc-level-7 {margin-left: 12em;}
div.sgc-toc-level-8 {margin-left: 14em;}
div.sgc-toc-level-9 {margin-left: 16em;}


Of course, you would also have to style/format these classes in your regular css sheet so that they display properly within your document.

sample css:
Spoiler:
Code:
h1, h2, h3, h4, h5, h6 {display:block; text-align:center; text-indent:0; margin:1em 0; page-break-after:avoid; font-style:normal; font-weight:bold; font-family:sans-serif}

h1    {font-size:1.7em; margin-top:0; text-transform:uppercase}
h2    {font-size:1.4em; text-transform:uppercase}
h3    {font-size:1.3em}
h4    {font-size:1.1em; font-weight:normal; font-style:italic}
h5    {font-size:1.1em; font-style:italic}
h6    {font-size:1.1em}
h6.h7 {font-size:1.1em; text-decoration:underline}
h6.h8 {font-size:1.1em; text-decoration:underline; color:red}
h6.h9 {font-size:1.1em; text-decoration:underline; color:blue}


Cheers,
Attached Thumbnails
Click image for larger version

Name:	Capture.JPG
Views:	252
Size:	38.8 KB
ID:	157324   Click image for larger version

Name:	Capture2.JPG
Views:	210
Size:	18.1 KB
ID:	157325   Click image for larger version

Name:	Capture3.JPG
Views:	234
Size:	19.5 KB
ID:	157326  

Last edited by Turtle91; 06-15-2017 at 11:56 AM.
Turtle91 is offline   Reply With Quote