Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>jQuery turned out to be the easy way to do this.</p> <p>I added this to the raw rst file where I wanted the index:</p> <pre><code>.. container:: custom-index .. raw:: html &lt;script type="text/javascript" src='_static/pymunk.js'&gt;&lt;/script&gt; </code></pre> <p>This way a div is inserted into the html output so that the script can be put in all files where I wanted this index and have a header on top. </p> <p>Then in pymunk.js I extracted the class, function and data tags and put into the index. </p> <p>The downside with a javascript approach to this problem is that it would be hard to have a complete class index in the TOC sidebar as now it just picks the items to be included in the index from the current page. It is also a bit of work to create the index on each page load, maybe if its a big module it will feel slow in some browsers.</p> <p>Full js code below:</p> <pre><code>$(function (){ var createList = function(selector){ var ul = $('&lt;ul&gt;'); var selected = $(selector); if (selected.length === 0){ return; } selected.clone().each(function (i,e){ var p = $(e).children('.descclassname'); var n = $(e).children('.descname'); var l = $(e).children('.headerlink'); var a = $('&lt;a&gt;'); a.attr('href',l.attr('href')).attr('title', 'Link to this definition'); a.append(p).append(n); var entry = $('&lt;li&gt;').append(a); ul.append(entry); }); return ul; } var c = $('&lt;div style="float:left; min-width: 300px;"&gt;'); var ul0 = c.clone().append($('.submodule-index')) customIndex = $('.custom-index'); customIndex.empty(); customIndex.append(ul0); var x = []; x.push(['Classes','dl.class &gt; dt']); x.push(['Functions','dl.function &gt; dt']); x.push(['Variables','dl.data &gt; dt']); x.forEach(function (e){ var l = createList(e[1]); if (l) { var ul = c.clone() .append('&lt;p class="rubric"&gt;'+e[0]+'&lt;/p&gt;') .append(l); } customIndex.append(ul); }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload