This is an automated email from the ASF dual-hosted git repository.

sewen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit c64e167b8003b7379545c1b83e54d9491164b7a8
Author: Nico Kruber <n...@ververica.com>
AuthorDate: Mon Aug 19 23:48:57 2019 +0200

    [FLINK-13791][docs] Speed up sidenav by using group_by
    
    _includes/sidenav.html parses through pages_by_language over and over again
    trying to find children when building the (recursive) side navigation. By 
doing
    this once with a group_by, we can gain considerable savings in building the
    docs via `./build_docs.sh` without any change to the generated HTML pages:
    
    This closes #9487
---
 docs/_includes/sidenav.html | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/docs/_includes/sidenav.html b/docs/_includes/sidenav.html
index 1073d99..70a24a7 100644
--- a/docs/_includes/sidenav.html
+++ b/docs/_includes/sidenav.html
@@ -69,7 +69,9 @@ level is determined by 'nav-pos'.
 {%- assign posStack = site.array -%}
 
 {%- assign elements = site.array -%}
-{%- assign children = (site.pages_by_language[page.language] | where: 
"nav-parent_id" , "root" | sort: "nav-pos") -%}
+{%- assign all_pages_by_nav_parent = (site.pages_by_language[page.language] | 
where_exp: "item", "item.nav-parent_id != nil" | group_by: "nav-parent_id") -%}
+{%- assign children = (all_pages_by_nav_parent | where: "name" , "root") -%}
+{%- assign children = (children[0].items | sort: "nav-pos") -%}
 {%- if children.size > 0 -%}
   {%- assign elements = elements | push: children -%}
 {%- endif -%}
@@ -111,8 +113,9 @@ level is determined by 'nav-pos'.
 
     {%- assign pos = pos | plus: 1 -%}
     {%- if this.nav-id -%}
-      {%- assign children = (site.pages_by_language[page.language] | where: 
"nav-parent_id" , this.nav-id | sort: "nav-pos") -%}
+      {%- assign children = (all_pages_by_nav_parent | where: "name" , 
this.nav-id) -%}
       {%- if children.size > 0 -%}
+        {%- assign children = (children[0].items | sort: "nav-pos") -%}
         {%- capture collapse_target -%}"#collapse-{{ i }}" 
data-toggle="collapse"{%- if active -%} class="active"{%- endif -%}{%- 
endcapture -%}
         {%- capture expand -%}{%- unless active -%} <i class="fa fa-caret-down 
pull-right" aria-hidden="true" style="padding-top: 4px"></i>{%- endunless 
-%}{%- endcapture %}
 <li><a href={{ collapse_target }}>{{ title }}{{ expand }}</a><div 
class="collapse{% if active %} in{% endif %}" id="collapse-{{ i }}"><ul>

Reply via email to