You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ut...@apache.org on 2019/04/09 18:54:07 UTC

[mynewt-site] branch master updated: Fix syntax for new Mkdocs/Jinja2

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

utzig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-site.git


The following commit(s) were added to refs/heads/master by this push:
     new ced92bc  Fix syntax for new Mkdocs/Jinja2
     new 4c7191e  Merge pull request #512 from utzig/fix-mkdocs-syntax
ced92bc is described below

commit ced92bcdf2e9e73550be989719dd7ff33a1b24bb
Author: Fabio Utzig <ut...@apache.org>
AuthorDate: Tue Apr 9 15:40:11 2019 -0300

    Fix syntax for new Mkdocs/Jinja2
---
 custom-theme/breadcrumbs.html    | 12 ++++++------
 custom-theme/fix_up_content.html |  2 +-
 custom-theme/main.html           | 38 +++++++++++++++++++-------------------
 custom-theme/quick-start.html    |  1 -
 mkdocs.yml                       |  6 +++---
 5 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/custom-theme/breadcrumbs.html b/custom-theme/breadcrumbs.html
index 8076a9e..506d846 100644
--- a/custom-theme/breadcrumbs.html
+++ b/custom-theme/breadcrumbs.html
@@ -1,19 +1,19 @@
 <div role="navigation" aria-label="breadcrumbs navigation">
   <ul class="wy-breadcrumbs">
     <li><a href="/documentation/">Docs</a></li>
-    {% if current_page %}
-    {% for doc in current_page.ancestors %}
-        {% if doc.children[0].url and doc.children[0].url != current_page.url %}
+    {% if page %}
+    {% for doc in page.ancestors %}
+        {% if doc.children[0].url and doc.children[0].url != page.url %}
           <li>&raquo; <a href="{{ doc.children[0].url|e }}">{{ doc.title }}</a></li>
         {% else %}
           <li>&raquo; {{ doc.title }}</li>
         {% endif %}
       {% endfor %}
-      {% if current_page.title != "toc" %}
-        <li>&raquo; {{ current_page.title }}</li>
+      {% if page.title != "toc" %}
+        <li>&raquo; {{ page.title }}</li>
       {% endif %}
     {% endif %}
-    {% if repo_url %}
+    {% if config.repo_url %}
       <li class="wy-breadcrumbs-aside">
         {%- block repo %}
         {% if page and page.edit_url %}
diff --git a/custom-theme/fix_up_content.html b/custom-theme/fix_up_content.html
index 177cdca..b451a9b 100644
--- a/custom-theme/fix_up_content.html
+++ b/custom-theme/fix_up_content.html
@@ -1 +1 @@
-{% if config.extra.version == 'none' %}{{ content|replace("/DOCSLINK/", "/") }}{% else %}{{ content|replace("/DOCSLINK/", "/latest/") }}{% endif %}
+{% if config.extra.version == 'none' %}{{ page.content|replace("/DOCSLINK/", "/") }}{% else %}{{ page.content|replace("/DOCSLINK/", "/latest/") }}{% endif %}
diff --git a/custom-theme/main.html b/custom-theme/main.html
index eb29d22..c685c3b 100644
--- a/custom-theme/main.html
+++ b/custom-theme/main.html
@@ -4,14 +4,14 @@
         <meta charset="utf-8">
         <meta http-equiv="X-UA-Compatible" content="IE=edge">
         <meta name="viewport" content="width=device-width, initial-scale=1.0">
-        {% if page_description %}<meta name="description" content="{{ page_description }}">{% endif %}
-        {% if site_author %}<meta name="author" content="{{ site_author }}">{% endif %}
+        {% if config.site_description %}<meta name="description" content="{{ config.site_description }}">{% endif %}
+        {% if config.site_author %}<meta name="author" content="{{ config.site_author }}">{% endif %}
         <!-- This is broken by doc revisioning.
         {% if canonical_url %}<link rel="canonical" href="{{ canonical_url }}">{% endif %} -->
         {% if favicon %}<link rel="shortcut icon" href="{{ favicon }}">
         {% else %}<link rel="shortcut icon" href="{{ base_url }}/img/favicon.ico">{% endif %}
 
-	    <title>{% if page_title %}{{ page_title }} - {% endif %}{{ site_name }}</title>
+        <title>{% if page.title != 'Home' %}{{ page.title }} - {% endif %}{{ config.site_name }}</title>
 
         <link href="{{ base_url }}/css/bootstrap-3.0.3.min.css" rel="stylesheet">
         <link rel="stylesheet" href="{{ base_url }}/css/highlight.css">
@@ -20,7 +20,7 @@
         <link href="{{ base_url }}/css/v2.css" rel="stylesheet">
         <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
         <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
-        {%- for path in extra_css %}
+        {%- for path in config.extra_css %}
         <link href="{{ path }}" rel="stylesheet">
         {%- endfor %}
 
@@ -30,7 +30,7 @@
             <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
         <![endif]-->
 
-        {% if google_analytics %}
+        {% if config.google_analytics %}
             <script>
             (function(i, s, o, g, r, a, m) {
     i["GoogleAnalyticsObject"] = r;
@@ -46,14 +46,14 @@
     m.parentNode.insertBefore(a, m);
 })(window, document, "script", "//www.google-analytics.com/analytics.js", "ga");
 
-ga("create", "{{ google_analytics[0] }}", "{{ google_analytics[1] }}");
+ga("create", "{{ config.google_analytics[0] }}", "{{ config.google_analytics[1] }}");
 ga("send", "pageview");
 </script>
         {% endif %}
     </head>
 
-{% if page_title != None %}
-    <body class="{{ page_title }}">
+{% if page.title != None %}
+    <body class="{{ page.title }}">
 {% else %}
     <body class="home">
 {% endif %}
@@ -65,23 +65,23 @@ ga("send", "pageview");
         {% set full_width_page_titles = [None, 'Quick Start', 'About', 'Talks', 'Documentation', 'Download', 'Community', 'Events'] %}
 
         <div class="container">
-            {% if page_title == None %}
+            {% if page.title == 'Home' %}
                 {% include "landing.html" %}
             {% elif meta and meta.html %}
                 {% include meta.html[0] %}
-            {% elif page_title == 'About' %}
+            {% elif page.title == 'About' %}
                 {% include "about.html" %}
-            {% elif page_title == 'Talks' %}
+            {% elif page.title == 'Talks' %}
                 {% include "talks.html" %}
-            {% elif page_title == 'Quick Start' %}
+            {% elif page.title == 'Quick Start' %}
                 {% include "quick-start.html" %}
-            {% elif page_title == 'Documentation' %}
+            {% elif page.title == 'Documentation' %}
                 {% include "documentation.html" %}
-            {% elif page_title == 'Download' %}
+            {% elif page.title == 'Download' %}
                 {% include "download.html" %}
-            {% elif page_title == 'Community' %}
+            {% elif page.title == 'Community' %}
                 {% include "community.html" %}
-            {% elif page_title == 'Events' %}
+            {% elif page.title == 'Events' %}
                 {% include "events.html" %}
             {% else %}
                 <div class="row">
@@ -103,7 +103,7 @@ ga("send", "pageview");
                           {% endif %}
                         {% endfor %}
                         {% block content %}
-                            {{ content }}
+                            {{ page.content }}
                         {% endblock %}
                         <div class="row">
                             {% include 'next_prev_links.html' %}
@@ -112,7 +112,7 @@ ga("send", "pageview");
                     </div>
                 </div>
             {% endif %}
-            {% if page_title in full_width_page_titles or (meta and meta.html) %}
+            {% if page.title in full_width_page_titles or (meta and meta.html) %}
                 {% include 'footer.html' %}
             {% endif %}
         </div>
@@ -123,7 +123,7 @@ ga("send", "pageview");
         <script src="{{ base_url }}/js/base.js"></script>
         <script src="{{ base_url }}/js/custom.js"></script>
 
-        {%- for path in extra_javascript %}
+        {%- for path in config.extra_javascript %}
             <script src="{{ path }}"></script>
         {%- endfor %}
 
diff --git a/custom-theme/quick-start.html b/custom-theme/quick-start.html
index 118a2f8..1ed15a7 100644
--- a/custom-theme/quick-start.html
+++ b/custom-theme/quick-start.html
@@ -1,5 +1,4 @@
 <div class="v2-quick-start">
-
  <div class="small-no-padding">
     <div class="row">
         <div class="col-md-12 content">
diff --git a/mkdocs.yml b/mkdocs.yml
index 8ba8f1b..0dbbbee 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -10,9 +10,9 @@ theme:
 nav:
     - Home: "index.md"
     - Pages:
-          - Bluetooth Low Energy 4.2: "pages/ble.md"
-          - Security Lifecycle: "pages/securitybullets.md"
-    - Quick Start: "quick-start.md"
+          - "Bluetooth Low Energy 4.2": "pages/ble.md"
+          - "Security Lifecycle": "pages/securitybullets.md"
+    - "Quick Start": "quick-start.md"
     - About: "about.md"
     - Talks: "talks.md"
     - Download: "download.md"