summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2013-07-20 00:34:49 +0200
committerDerek Jones <derek.jones@ellislab.com>2013-07-20 00:34:49 +0200
commit1e617c9b0cab036cff4de14f36ba9a2903462e51 (patch)
treea63e12eb2d76b07d0ff9bc3ae7b7eac056c97dc8 /user_guide_src/source
parente7dfb679cf4f1a683d837aaea94b5b5125204779 (diff)
Allowing creation of dynamic local ToC for method / function names
Diffstat (limited to 'user_guide_src/source')
-rw-r--r--user_guide_src/source/_themes/eldocs/layout.html12
-rw-r--r--user_guide_src/source/_themes/eldocs/static/asset/js/method-toc.js44
2 files changed, 51 insertions, 5 deletions
diff --git a/user_guide_src/source/_themes/eldocs/layout.html b/user_guide_src/source/_themes/eldocs/layout.html
index 7f2fe1a34..535c2f194 100644
--- a/user_guide_src/source/_themes/eldocs/layout.html
+++ b/user_guide_src/source/_themes/eldocs/layout.html
@@ -31,7 +31,7 @@
{%- for cssfile in css_files %}
<link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
{%- endfor %}
-
+
{%- if not embedded %}
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
@@ -46,11 +46,13 @@
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
{%- endfor %}
+ <script type="text/javascript" src="{{ pathto('_static/asset/js/method-toc.js', 1) }}"></script>
+
{%- if favicon %}
<link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
{%- endif %}
{%- endif %}
-
+
{%- block linktags %}
{%- if hasdoc('about') %}
<link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" />
@@ -96,7 +98,7 @@
{%- block rootrellink %}
<li><a href="{{ pathto(master_doc) }}">User Guide Home</a>{%- if pagename != 'index' %}&nbsp;&nbsp;{{ reldelim1 }}{%- endif %}</li>
{%- endblock %}
-
+
{%- for parent in parents %}
<li><a href="{{ parent.link|e }}" {% if loop.last %}{{ accesskey("U") }}{% endif %}>{{ parent.title }}</a>&nbsp;&nbsp; {{ reldelim1 }}</li>
{%- endfor %}
@@ -117,8 +119,8 @@
{% if pagename not in exclude_comments -%}
<!-- {user_guide_comments} -->
{% endif %}
-
- {%- block footer %}
+
+ {%- block footer %}
<div id="footer">
<p class="top"><a href="#header" title="Return to top">Return to top</a></p>
<p><a href="http://{{ project_domain }}/">{{ project }}</a> &ndash; Copyright &copy; {{ copyright }}</a></p>
diff --git a/user_guide_src/source/_themes/eldocs/static/asset/js/method-toc.js b/user_guide_src/source/_themes/eldocs/static/asset/js/method-toc.js
new file mode 100644
index 000000000..92024c70a
--- /dev/null
+++ b/user_guide_src/source/_themes/eldocs/static/asset/js/method-toc.js
@@ -0,0 +1,44 @@
+/* modified from http://stackoverflow.com/a/12459801 */
+$(function (){
+ var createList = function(selector){
+
+ var ul = $('<ul>');
+ 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 = $('<a>');
+ a.attr('href',l.attr('href')).attr('title', 'Link to this definition');
+
+ a.append(p).append(n);
+
+ var entry = $('<li>').append(a);
+ ul.append(entry);
+ });
+ return ul;
+ }
+
+ var c = $('<div>');
+
+ var ul0 = c.clone().append($('.submodule-index'))
+
+ customIndex = $('.custom-index');
+ customIndex.empty();
+ customIndex.append(ul0);
+
+ var l = createList('dl.method > dt');
+ if (l) {
+ var ul = c.clone()
+ .append('<h3>Methods / Function</h3>')
+ .append(l);
+ }
+ customIndex.append(ul);
+}); \ No newline at end of file