diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-05-26 17:31:35 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-05-26 17:31:35 +0200 |
commit | 8b7abbd6f489c71f9c3b657d2a989b00fcdb09b7 (patch) | |
tree | 5a77faf1838801348643e4e2395dfe0dba690eee | |
parent | f228f646ebea7209bfa8b418853948ef62f92b97 (diff) | |
download | gitbook-8b7abbd6f489c71f9c3b657d2a989b00fcdb09b7.zip gitbook-8b7abbd6f489c71f9c3b657d2a989b00fcdb09b7.tar.gz gitbook-8b7abbd6f489c71f9c3b657d2a989b00fcdb09b7.tar.bz2 |
Render articles of level > 2 in summary
-rw-r--r-- | theme/templates/includes/book/summary.html | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/theme/templates/includes/book/summary.html b/theme/templates/includes/book/summary.html index b4859fc..697cce8 100644 --- a/theme/templates/includes/book/summary.html +++ b/theme/templates/includes/book/summary.html @@ -1,3 +1,22 @@ +{% macro articles(_articles) %} + {% for item in _articles %} + <li class="chapter {% if item._path == _input %}active{% endif %}" data-level="{{ item.level }}" {% if item.path %}data-path="{{ item.path|mdLink }}"{% endif %}> + {% if item.path %} + <a href="{{ basePath }}/{{ item.path|mdLink }}"> + <i class="fa fa-check"></i> <b>{{ item.level }}.</b> {{ item.title }} + </a> + {% else %} + <span><b>{{ item.level }}.</b> {{ item.title }}</span> + {% endif %} + {% if item.articles.length > 0 %} + <ul class="articles"> + {{ articles(item.articles) }} + </ul> + {% endif %} + </li> + {% endfor %} +{% endmacro %} + <div class="book-summary"> <div class="book-search"> <input type="text" placeholder="Search" class="form-control" /> @@ -32,32 +51,7 @@ <li data-level="0" data-path="index.html"> <a href="{{ basePath }}/"><i class="fa fa-check"></i> Introduction</a> </li> - {% for item in summary.chapters %} - <li class="chapter {% if item._path == _input %}active{% endif %}" data-level="{{ item.level }}" {% if item.path %}data-path="{{ item.path|mdLink }}"{% endif %}> - {% if item.path %} - <a href="{{ basePath }}/{{ item.path|mdLink }}"> - <i class="fa fa-check"></i> <b>{{ item.level }}.</b> {{ item.title }} - </a> - {% else %} - <span><b>{{ item.level }}.</b> {{ item.title }}</span> - {% endif %} - {% if item.articles.length > 0 %} - <ul class="articles"> - {% for article in item.articles %} - <li {% if article._path == _input %}class="active"{% endif %} data-level="{{ article.level }}" {% if article.path %}data-path="{{ article.path|mdLink }}"{% endif %}> - {% if article.path %} - <a href="{{ basePath }}/{{ article.path|mdLink }}"> - <i class="fa fa-check"></i> <b>{{ article.level }}.</b> {{ article.title }} - </a> - {% else %} - <span><b>{{ article.level }}.</b> {{ article.title }}</span> - {% endif %} - </li> - {% endfor %} - </ul> - {% endif %} - </li> - {% endfor %} + {{ articles(summary.chapters) }} {% if options.links.gitbook !== false %} <li class="divider"></li> |