-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from cjsheets/dev
rewrite dropdown logic
- Loading branch information
Showing
11 changed files
with
163 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
language: python | ||
python: | ||
- '2.7' | ||
script: | ||
- touch foo | ||
deploy: | ||
provider: pypi | ||
user: cjsheets | ||
password: | ||
secure: w/ma9MlBTjsF4cstbIVyPNfEqOdo52P6PSvP/apn8wzRVgHwqW6FnUYrkpVM1Jxu80ReeIzy34P9bt43ihsoWc/NnvTSm2Zfer2QR0xKUXW+lg0yVQbSaqznp7eBY/9stAAYU1lCoK/EhuyGLxbErMk3F9OaSi42RrC19XahkjpHPIyCPhZ/a71ADgdbhusEvaavaqEfJKfQ4+RT49AZCJnt87nMtmqmSgNe3N2xLD7kfig/9VJlmC7gDBHEIXOP3kphAStngknxQ+UMRnTqr/K34+yOFlDzfrM+AEmHbSeOl9a9Ung3KuVnz9mdlwRQUmUwW06b1nYNUW7QGdXG1LaybLbLY5p8CFMggXS97o7YXbHLyJdF0pyxMWkP2rhaeAXDJAbKtz/i5DCd1P7tEPjf4q+potqkp/LGq7T+lCLxnA6tN8zfuCHyMmTcSbvWpm06RiSZsXTw+LvevCcIeAq36jzaI6/kkc5mwVVLI6P+r8Raf2s9iIEStaG5o2rDyetiP/228So6fIdAhn+ZqG3DxLSVx0ULXevB8cW6jskDw0uKaTUEcdqsc9ndsHGiS+B9kbKPF85XBSPnZviUsYaKA8u7+y59sn59COQ31j4npf0+ukf1i+kouT2lpFX6bwMiBWu7ZrJhD7KvMO0JGb83L26zE6iEclprj5zvH2E= | ||
on: | ||
tags: true | ||
branch: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#git+http://github.com/cjsheets/mkdocs.git@dev#egg=mkdocs | ||
mkdocs | ||
#mkdocs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{%- set navlevel = navlevel + 1%} | ||
<li class="{% if nav_item.active%}current{%endif%} toctree-l{{navlevel}}"> | ||
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}" | ||
class="{% if nav_item.active%}current{%endif%}"> | ||
{{ nav_item.title }} | ||
</a> | ||
|
||
{#| Children are only added to the currently selected root item |#} | ||
{% if nav_item.active %} | ||
{% if nav_item.children %} | ||
<ul class="{% if nav_item.active%}current{%endif%} subnav"> | ||
{% for nav_item in nav_item.children %} | ||
{% include "nav-item.html" %} | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
{% if not nav_item.children %} | ||
{% include "toc.html" %} | ||
{% endif %} | ||
{% endif %} | ||
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,63 @@ | ||
{%- set child_url = '' %} {#| Target of the current link |#} | ||
|
||
|
||
{%- if nav_item.children %} | ||
{%- if nav_item.children[0].input_path %} | ||
{%- set urlList = nav_item.children[0].input_path.split('.') %} | ||
{%- else %} | ||
{%- if nav_item.children[0].children[0].input_path %} | ||
{%- set urlList = nav_item.children[0].children[0].input_path.split('.') %} | ||
{#| Loop over the major, root-level groups |#} | ||
{% for nav_item in nav %} | ||
|
||
{#| Determine the full path of the root-level link |#} | ||
{%- set nav_item_children = nav_item.children %} | ||
{%- set nav_ns = namespace(url_list=false) %} | ||
|
||
{%- if nav_item.children is defined %} | ||
{% for _ in range(1, 6) %} | ||
{%- if nav_item_children is defined %} | ||
{%- if nav_item_children[0].input_path is defined %} | ||
{%- set nav_ns.url_list = nav_item_children[0].input_path.split('.') %} | ||
{%- else %} | ||
{%- set nav_item_children = nav_item_children[0].children %} | ||
{%- endif %} | ||
{%- endif %} | ||
{% endfor %} | ||
{%- if nav_ns.url_list %} | ||
{%- set fileName = nav_ns.url_list.pop() %} | ||
{%- set child_url = '.'.join(nav_ns.url_list) %} | ||
{%- endif %} | ||
{%- endif %} | ||
{%- set fileName = urlList.pop() %} | ||
{%- set child_url = '.'.join(urlList) %} | ||
{%- endif %} | ||
|
||
|
||
{%- if navlevel == 1 and child_url == '' %} | ||
<ul class="{% if nav_item.active%}current{%endif%}" href="{{ nav_item.url }}"> | ||
<li class="toctree-l{{ navlevel }}{% if nav_item.active %} current{%endif%}"> | ||
{%- endif %} | ||
{%- if child_url is not defined %} | ||
{#| There are no children, only a root-level item |#} | ||
{%- set child_url = nav_item.abs_url %} | ||
{%- endif %} | ||
|
||
{%- if navlevel == 1 and child_url != '' %} | ||
{%- set navlevel = 0 %} | ||
{% if nav_item.children %} | ||
<p class="caption">{{ nav_item.title }}</p> | ||
{%- elif child_url == '' %} | ||
<a class="{% if nav_item.active%}current{%endif%}" href="{{ nav_item.url }}">{{ nav_item.title }}</a> | ||
{%- else %} | ||
<a class="{% if nav_item.active%}current{%endif%}" href="/{{ child_url }}">{{ nav_item.title }}</a> | ||
{%- endif %} | ||
|
||
{% endif %} | ||
|
||
{%- if navlevel == 1 and child_url != '' %} | ||
<ul class="{% if nav_item.active%}current{%endif%}"> | ||
{%- if nav_item == page %} | ||
{% include 'toc.html' %} | ||
{%- endif %} | ||
{%- if nav_item.children %} | ||
{%- for nav_item in nav_item.children %} | ||
<li class="toctree-l1{% if nav_item.active%} current{%endif%}"> | ||
{%- set navlevel = navlevel + 1%} | ||
{% include 'nav.html' %} | ||
{%- set navlevel = navlevel - 1%} | ||
</li> | ||
{%- endfor %} | ||
{%- endif %} | ||
</ul> | ||
{% elif nav_item.active and (nav_item == page or nav_item.children) %} | ||
<ul class="subnav"> | ||
{%- if nav_item == page %} | ||
{% include 'toc.html' %} | ||
{%- endif %} | ||
{%- if nav_item.children %} | ||
{%- set navlevel = navlevel + 1%} | ||
{%- for nav_item in nav_item.children %} | ||
<li class="toctree-l2{% if nav_item.active%} current{%endif%} 1"> | ||
{% include 'nav.html' %} | ||
</li> | ||
{%- endfor %} | ||
{%- set navlevel = navlevel - 1%} | ||
<ul class="{% if nav_item.active%}current{%endif%}" href="{{ child_url }}"> | ||
{% if nav_item.children %} | ||
{% for nav_item in nav_item.children %} | ||
{% include "nav-item.html" %} | ||
{% endfor %} | ||
{%- else %} | ||
{#| Rendering toc directly for root-level items prevents double-title |#} | ||
{% if nav_item.active %} | ||
<li class="{% if nav_item.active%}current{%endif%} toctree-l1"> | ||
<a class="{% if nav_item.active%}current{%endif%}" href="{{ child_url }}">{{ nav_item.title }}</a> | ||
{%- set navlevel = navlevel + 1 %} | ||
{% include "toc.html" %} | ||
</li> | ||
{%- else %} | ||
<li class="{% if nav_item.active%}current{%endif%} toctree-l1"> | ||
<a class="{% if nav_item.active%}current{%endif%}" href="{{ child_url }}">{{ nav_item.title }}</a> | ||
</li> | ||
{%- endif %} | ||
</ul> | ||
{%- endif %} | ||
{%- endif %} | ||
</ul> | ||
|
||
<!-- | ||
| This is a hacky way to pass setting from the template generator to the | ||
| javascript that drives the dropdown functionality | ||
--> | ||
<div style="width: 1px; height: 1px; visibility: none;"> | ||
|
||
</div> | ||
|
||
{%- if navlevel == 1 and child_url == '' %} | ||
</li></ul> | ||
{%- endif %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{%- set toclevel = toclevel + 1 %} | ||
|
||
{#| Support collapse-by-default setting |#} | ||
{% if toc_item.active and (toc_ns.top_level_headings == 1 or not | ||
(config.theme is defined and config.theme.collapse_by_default)) %} | ||
{%- set class_is_active = 'current' %} | ||
{% endif %} | ||
|
||
{% if toc_item.children is defined and toc_item.children | length > 0 and toclevel < 2 %} | ||
<li class="{{class_is_active}} toctree-l{{navlevel + 1}}"> | ||
{% if toc_ns.top_level_headings is defined and toc_ns.top_level_headings > 1 %} | ||
<a href="{{ toc_item.url }}" title="{{ nav_item.title }}" | ||
class="{{class_is_active}}"> | ||
{{ toc_item.title }} | ||
</a> | ||
{% endif %} | ||
<ul class="{% if toc_item.active%}current{%endif%} subnav"> | ||
{% for toc_item in toc_item.children %} | ||
{% include "toc-item.html" %} | ||
{% endfor %} | ||
</ul> | ||
</li> | ||
{% else %} | ||
<li class="toctree-l{{navlevel + 1}} toc-item"> | ||
<a href="{{ toc_item.url }}" title="{{ nav_item.title }}">{{ toc_item.title }}</a> | ||
</li> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
{% for toc_item in page.toc %} | ||
<li class="toctree-l2 {% if toc_item.active%}current{%endif%}"> | ||
{% if nav_item.title != toc_item.title %} | ||
<a class="{% if toc_item.active%}current{%endif%}" href="{{ toc_item.url }}">{{ toc_item.title }}</a> | ||
{% endif %} | ||
{% if toc_item.children %} | ||
<ul class="{% if not toc_item.active%} submenu-toc{%endif%}"> | ||
{% for toc__item in toc_item.children %} | ||
<li class="toctree-l3{% if navlevel > 1%} toc-item{%endif%}" > | ||
<a class="toctree-l3" href="{{ toc__item.url }}">{{ toc__item.title }}</a> | ||
</li> | ||
{% if page.toc %} | ||
|
||
{%- set toc_ns = namespace(top_level_headings=0) %} | ||
{% for toc_item in page.toc %} | ||
{%- set toc_ns.top_level_headings = toc_ns.top_level_headings + 1 %} | ||
{% endfor %} | ||
|
||
{%- set toclevel = 0 %} | ||
<ul class="{% if nav_item.active%}current{%endif%} subnav"> | ||
{% for toc_item in page.toc %} | ||
{% include "toc-item.html" %} | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters