Fix website and check in the custom mkdocs theme.

This commit is contained in:
Francois Chollet 2018-11-30 20:43:05 -08:00
parent 29cf97dcb9
commit ca65b96508
18 changed files with 503 additions and 4 deletions

1
.gitignore vendored

@ -7,7 +7,6 @@ build/*
keras/datasets/data/*
keras/datasets/temp/*
docs/site/*
docs/theme/*
docs/sources/*
tags
Keras.egg-info

@ -1,6 +1,20 @@
site_name: Keras Documentation
theme: readthedocs
# theme_dir: theme
theme:
name: null
custom_dir: theme
static_templates:
- 404.html
include_search_page: true
search_index_only: false
highlightjs: true
hljs_languages: []
include_homepage_in_sidebar: true
prev_next_buttons_location: bottom
navigation_depth: 4
titles_only: false
sticky_navigation: true
collapse_navigation: true
docs_dir: sources
repo_url: http://github.com/keras-team/keras
site_url: http://keras.io/

@ -1,5 +1,5 @@
# Keras: The Python Deep Learning library
<img src='https://s3.amazonaws.com/keras.io/img/keras-logo-2018-large-1200.png', style='max-width: 600px;'>
<img src='https://s3.amazonaws.com/keras.io/img/keras-logo-2018-large-1200.png', style='max-width: 600px; width: 90%;'>
{{autogenerated}}

9
docs/theme/404.html vendored Normal file

@ -0,0 +1,9 @@
{% extends "base.html" %}
{% block content %}
<h1 id="404-page-not-found">404</h1>
<p><strong>Page not found</strong></p>
{% endblock %}

168
docs/theme/base.html vendored Normal file

@ -0,0 +1,168 @@
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
{%- block site_meta %}
<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 and page.is_homepage %}<meta name="description" content="{{ config.site_description }}">{% endif %}
{% if config.site_author %}<meta name="author" content="{{ config.site_author }}">{% endif %}
{% if page and page.canonical_url %}<link rel="canonical" href="{{ page.canonical_url }}">{% endif %}
{% if config.site_favicon %}<link rel="shortcut icon" href="{{ config.site_favicon|url }}">
{% else %}<link rel="shortcut icon" href="{{ 'img/favicon.ico'|url }}">{% endif %}
{%- endblock %}
{%- block htmltitle %}
<title>{% if page and page.title and not page.is_hompage %}{{ page.title }} - {% endif %}{{ config.site_name }}</title>
{%- endblock %}
{%- block styles %}
<link href='https://fonts.googleapis.com/css?family=Lato:400,700|Source+Sans+Pro:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="{{ 'css/theme.css'|url }}" type="text/css" />
<link rel="stylesheet" href="{{ 'css/theme_extra.css'|url }}" type="text/css" />
{%- if config.theme.highlightjs %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css">
{%- endif %}
{%- for path in config['extra_css'] %}
<link href="{{ path|url }}" rel="stylesheet">
{%- endfor %}
{%- endblock %}
{%- block libs %}
{% if page %}
<script>
// Current page data
var mkdocs_page_name = {{ page.title|tojson|safe }};
var mkdocs_page_input_path = {{ page.file.src_path|string|tojson|safe }};
var mkdocs_page_url = {{ page.abs_url|tojson|safe }};
</script>
{% endif %}
<script src="{{ 'js/jquery-2.1.1.min.js'|url }}" defer></script>
<script src="{{ 'js/modernizr-2.8.3.min.js'|url }}" defer></script>
{%- if config.theme.highlightjs %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
{%- for lang in config.theme.hljs_languages %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/{{lang}}.min.js"></script>
{%- endfor %}
<script>hljs.initHighlightingOnLoad();</script>
{%- endif %}
{%- endblock %}
{%- block extrahead %} {% endblock %}
{%- block analytics %}
{% if config.google_analytics %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{ config.google_analytics[0] }}', '{{ config.google_analytics[1] }}');
ga('send', 'pageview');
</script>
{% endif %}
{%- endblock %}
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
{# SIDE NAV, TOGGLES ON MOBILE #}
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
<div class="wy-side-scroll">
<a href="{{ homepage_url }}">
<div class="keras-logo">
<img src="/img/keras-logo-small.jpg" class="keras-logo-img">
Keras Documentation
</div>
</a>
<div class="wy-side-nav-search">
{%- block search_button %}
{% if 'search' in config['plugins'] %}{% include "searchbox.html" %}{% endif %}
{%- endblock %}
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
{%- block site_nav %}
{%- set navlevel = 1 %}
{%- for nav_item in nav %}
{%- if nav_item.is_section %}
<p class="caption"><span class="caption-text">{{ nav_item.title }}</span></p>
<ul{% if nav_item.active %} class="current"{% endif %}>
{%- for nav_item in nav_item.children %}
<li class="toctree-l{{ navlevel }}{% if nav_item.active %} current{% endif %}">
{%- include 'nav.html' %}
</li>
{%- endfor %}
</ul>
{%- elif config.theme.include_homepage_in_sidebar or (not nav_item == nav.homepage) %}
<ul{% if nav_item.active %} class="current"{% endif %}>
<li class="toctree-l{{ navlevel }}{% if nav_item.active %} current{% endif %}">
{%- include 'nav.html' %}
</li>
</ul>
{%- endif %}
{%- endfor %}
{%- endblock %}
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
{# MOBILE NAV, TRIGGLES SIDE NAV ON TOGGLE #}
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="{{ nav.homepage.url|url }}">{{ config.site_name }}</a>
</nav>
{# PAGE CONTENT #}
<div class="wy-nav-content">
<div class="rst-content">
{% include "breadcrumbs.html" %}
<div role="main">
<div class="section">
{% block content %}
{{ page.content }}
{% endblock %}
</div>
</div>
{%- block footer %}
{% include "footer.html" %}
{% endblock %}
</div>
</div>
</section>
</div>
{% include "versions.html" %}
{%- block scripts %}
<script>var base_url = '{{ base_url }}';</script>
<script src="{{ 'js/theme.js'|url }}" defer></script>
{%- for path in config['extra_javascript'] %}
<script src="{{ path|url }}" defer></script>
{%- endfor %}
<script type="text/javascript" defer>
window.onload = function () {
SphinxRtdTheme.Navigation.enable({{ 'true' if config.theme.sticky_navigation else 'false' }});
};
</script>
{%- endblock %}
</body>
</html>
{% if page and page.is_homepage %}
<!--
MkDocs version : {{ mkdocs_version }}
Build Date UTC : {{ build_date_utc }}
-->
{% endif %}

41
docs/theme/breadcrumbs.html vendored Normal file

@ -0,0 +1,41 @@
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="{{ nav.homepage.url|url }}">Docs</a> &raquo;</li>
{% if page %}
{% for doc in page.ancestors %}
{% if doc.link %}
<li><a href="{{ doc.link|e }}">{{ doc.title }}</a> &raquo;</li>
{% else %}
<li>{{ doc.title }} &raquo;</li>
{% endif %}
{% endfor %}
{% endif %}
{% if page %}<li>{{ page.title }}</li>{% endif %}
<li class="wy-breadcrumbs-aside">
{%- block repo %}
{% if page and page.edit_url %}
<a href="{{ page.edit_url }}"
{%- if config.repo_name|lower == 'github' %}
class="icon icon-github"
{%- elif config.repo_name|lower == 'bitbucket' %}
class="icon icon-bitbucket"
{%- elif config.repo_name|lower == 'gitlab' %}
class="icon icon-gitlab"
{% endif %}> Edit on {{ config.repo_name }}</a>
{% endif %}
{%- endblock %}
</li>
</ul>
{% if config.theme.prev_next_buttons_location|lower in ['top', 'both']
and page and (page.next_page or page.previous_page) %}
<div class="rst-breadcrumbs-buttons" role="navigation" aria-label="breadcrumb navigation">
{%- if page.next_page %}
<a href="{{ page.next_page.url|url }}" class="btn btn-neutral float-right" title="{{ page.next_page.title }}">Next <span class="icon icon-circle-arrow-right"></span></a>
{%- endif %}
{%- if page.previous_page %}
<a href="{{ page.previous_page.url|url }}" class="btn btn-neutral" title="{{ page.previous_page.title }}"><span class="icon icon-circle-arrow-left"></span> Previous</a>
{%- endif %}
</div>
{% endif %}
<hr/>
</div>

14
docs/theme/css/theme.css vendored Normal file

File diff suppressed because one or more lines are too long

147
docs/theme/css/theme_extra.css vendored Normal file

@ -0,0 +1,147 @@
/*
* Wrap inline code samples otherwise they shoot of the side and
* can't be read at all.
*
* https://github.com/mkdocs/mkdocs/issues/313
* https://github.com/mkdocs/mkdocs/issues/233
* https://github.com/mkdocs/mkdocs/issues/834
*/
.rst-content code {
white-space: pre-wrap;
word-wrap: break-word;
padding: 2px 5px;
}
/**
* Make code blocks display as blocks and give them the appropriate
* font size and padding.
*
* https://github.com/mkdocs/mkdocs/issues/855
* https://github.com/mkdocs/mkdocs/issues/834
* https://github.com/mkdocs/mkdocs/issues/233
*/
.rst-content pre code {
white-space: pre;
word-wrap: normal;
display: block;
padding: 12px;
font-size: 12px;
}
/*
* Fix link colors when the link text is inline code.
*
* https://github.com/mkdocs/mkdocs/issues/718
*/
a code {
color: #2980B9;
}
a:hover code {
color: #3091d1;
}
a:visited code {
color: #9B59B6;
}
/*
* The CSS classes from highlight.js seem to clash with the
* ReadTheDocs theme causing some code to be incorrectly made
* bold and italic.
*
* https://github.com/mkdocs/mkdocs/issues/411
*/
pre .cs, pre .c {
font-weight: inherit;
font-style: inherit;
}
/*
* Fix some issues with the theme and non-highlighted code
* samples. Without and highlighting styles attached the
* formatting is broken.
*
* https://github.com/mkdocs/mkdocs/issues/319
*/
.rst-content .no-highlight {
display: block;
padding: 0.5em;
color: #333;
}
/*
* Additions specific to the search functionality provided by MkDocs
*/
.search-results {
margin-top: 23px;
}
.search-results article {
border-top: 1px solid #E1E4E5;
padding-top: 24px;
}
.search-results article:first-child {
border-top: none;
}
form .search-query {
width: 100%;
border-radius: 50px;
padding: 6px 12px; /* csslint allow: box-model */
border-color: #D1D4D5;
}
/*
* Improve inline code blocks within admonitions.
*
* https://github.com/mkdocs/mkdocs/issues/656
*/
.rst-content .admonition code {
color: #404040;
border: 1px solid #c7c9cb;
border: 1px solid rgba(0, 0, 0, 0.2);
background: #f8fbfd;
background: rgba(255, 255, 255, 0.7);
}
/*
* Account for wide tables which go off the side.
* Override borders to avoid wierdness on narrow tables.
*
* https://github.com/mkdocs/mkdocs/issues/834
* https://github.com/mkdocs/mkdocs/pull/1034
*/
.rst-content .section .docutils {
width: 100%;
overflow: auto;
display: block;
border: none;
}
td, th {
border: 1px solid #e1e4e5 !important; /* csslint allow: important */
border-collapse: collapse;
}
/*Keras extras*/
.keras-logo {
max-height: 55px;
width: 100%;
background: #d00000;
font-size: 140%;
color: white;
font-family: "Source Sans Pro", "ff-tisa-web-pro", "Georgia", Arial, sans-serif;
}
.keras-logo-img {
max-width: 45px;
margin: 10px;
}
h1, h2, h3, h4, h5, h6, legend {
font-family: "Source Sans Pro", "ff-tisa-web-pro", "Georgia", Arial, sans-serif;,
}

26
docs/theme/footer.html vendored Normal file

@ -0,0 +1,26 @@
<footer>
{%- block next_prev %}
{% if config.theme.prev_next_buttons_location|lower in ['bottom', 'both']
and page and (page.next_page or page.previous_page) %}
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
{% if page.next_page %}
<a href="{{ page.next_page.url|url }}" class="btn btn-neutral float-right" title="{{ page.next_page.title }}">Next <span class="icon icon-circle-arrow-right"></span></a>
{% endif %}
{% if page.previous_page %}
<a href="{{ page.previous_page.url|url }}" class="btn btn-neutral" title="{{ page.previous_page.title }}"><span class="icon icon-circle-arrow-left"></span> Previous</a>
{% endif %}
</div>
{% endif %}
{%- endblock %}
<hr/>
<div role="contentinfo">
<!-- Copyright etc -->
{% if config.copyright %}
<p>{{ config.copyright }}</p>
{% endif %}
</div>
Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>

4
docs/theme/js/jquery-2.1.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
docs/theme/js/modernizr-2.8.3.min.js vendored Normal file

File diff suppressed because one or more lines are too long

3
docs/theme/js/theme.js vendored Normal file

@ -0,0 +1,3 @@
/* sphinx_rtd_theme version 0.4.1 | MIT license */
/* Built 20180727 10:07 */
require=function n(e,i,t){function o(s,a){if(!i[s]){if(!e[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(r)return r(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var u=i[s]={exports:{}};e[s][0].call(u.exports,function(n){var i=e[s][1][n];return o(i||n)},u,u.exports,n,e,i,t)}return i[s].exports}for(var r="function"==typeof require&&require,s=0;s<t.length;s++)o(t[s]);return o}({"sphinx-rtd-theme":[function(n,e,i){var jQuery="undefined"!=typeof window?window.jQuery:n("jquery");e.exports.ThemeNav={navBar:null,win:null,winScroll:!1,winResize:!1,linkScroll:!1,winPosition:0,winHeight:null,docHeight:null,isRunning:!1,enable:function(n){var e=this;void 0===n&&(n=!0),e.isRunning||(e.isRunning=!0,jQuery(function(i){e.init(i),e.reset(),e.win.on("hashchange",e.reset),n&&e.win.on("scroll",function(){e.linkScroll||e.winScroll||(e.winScroll=!0,requestAnimationFrame(function(){e.onScroll()}))}),e.win.on("resize",function(){e.winResize||(e.winResize=!0,requestAnimationFrame(function(){e.onResize()}))}),e.onResize()}))},enableSticky:function(){this.enable(!0)},init:function(n){n(document);var e=this;this.navBar=n("div.wy-side-scroll:first"),this.win=n(window),n(document).on("click","[data-toggle='wy-nav-top']",function(){n("[data-toggle='wy-nav-shift']").toggleClass("shift"),n("[data-toggle='rst-versions']").toggleClass("shift")}).on("click",".wy-menu-vertical .current ul li a",function(){var i=n(this);n("[data-toggle='wy-nav-shift']").removeClass("shift"),n("[data-toggle='rst-versions']").toggleClass("shift"),e.toggleCurrent(i),e.hashChange()}).on("click","[data-toggle='rst-current-version']",function(){n("[data-toggle='rst-versions']").toggleClass("shift-up")}),n("table.docutils:not(.field-list,.footnote,.citation)").wrap("<div class='wy-table-responsive'></div>"),n("table.docutils.footnote").wrap("<div class='wy-table-responsive footnote'></div>"),n("table.docutils.citation").wrap("<div class='wy-table-responsive citation'></div>"),n(".wy-menu-vertical ul").not(".simple").siblings("a").each(function(){var i=n(this);expand=n('<span class="toctree-expand"></span>'),expand.on("click",function(n){return e.toggleCurrent(i),n.stopPropagation(),!1}),i.prepend(expand)})},reset:function(){var n=encodeURI(window.location.hash)||"#";try{var e=$(".wy-menu-vertical"),i=e.find('[href="'+n+'"]');if(0===i.length){var t=$('.document [id="'+n.substring(1)+'"]').closest("div.section");0===(i=e.find('[href="#'+t.attr("id")+'"]')).length&&(i=e.find('[href="#"]'))}i.length>0&&($(".wy-menu-vertical .current").removeClass("current"),i.addClass("current"),i.closest("li.toctree-l1").addClass("current"),i.closest("li.toctree-l1").parent().addClass("current"),i.closest("li.toctree-l1").addClass("current"),i.closest("li.toctree-l2").addClass("current"),i.closest("li.toctree-l3").addClass("current"),i.closest("li.toctree-l4").addClass("current"))}catch(o){console.log("Error expanding nav for anchor",o)}},onScroll:function(){this.winScroll=!1;var n=this.win.scrollTop(),e=n+this.winHeight,i=this.navBar.scrollTop()+(n-this.winPosition);n<0||e>this.docHeight||(this.navBar.scrollTop(i),this.winPosition=n)},onResize:function(){this.winResize=!1,this.winHeight=this.win.height(),this.docHeight=$(document).height()},hashChange:function(){this.linkScroll=!0,this.win.one("hashchange",function(){this.linkScroll=!1})},toggleCurrent:function(n){var e=n.closest("li");e.siblings("li.current").removeClass("current"),e.siblings().find("li.current").removeClass("current"),e.find("> ul li.current").removeClass("current"),e.toggleClass("current")}},"undefined"!=typeof window&&(window.SphinxRtdTheme={Navigation:e.exports.ThemeNav,StickyNav:e.exports.ThemeNav}),function(){for(var n=0,e=["ms","moz","webkit","o"],i=0;i<e.length&&!window.requestAnimationFrame;++i)window.requestAnimationFrame=window[e[i]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e[i]+"CancelAnimationFrame"]||window[e[i]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(e,i){var t=(new Date).getTime(),o=Math.max(0,16-(t-n)),r=window.setTimeout(function(){e(t+o)},o);return n=t+o,r}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(n){clearTimeout(n)})}()},{jquery:"jquery"}]},{},["sphinx-rtd-theme"]);

1
docs/theme/main.html vendored Normal file

@ -0,0 +1 @@
{% extends "base.html" %}

22
docs/theme/nav.html vendored Normal file

@ -0,0 +1,22 @@
<a class="{% if not nav_item.is_link %}reference internal{% endif %}{% if nav_item.active%} current{%endif%}" href="{% if not nav_item.is_section %}{{ nav_item.url|url }}{% else %}#{% endif %}">{{ nav_item.title }}</a>
{%- set navlevel = navlevel + 1 %}
{%- if navlevel <= config.theme.navigation_depth
and ((nav_item.is_page and nav_item.toc.items
and (not config.theme.titles_only
and (nav_item == page or not config.theme.collapse_navigation)))
or (nav_item.is_section and nav_item.children)) %}
<ul{% if nav_item.active %} class="current"{% endif %}>
{%- if nav_item.is_page %}
{#- Skip first level of toc which is page title. #}
{%- set toc_item = nav_item.toc.items[0] %}
{%- include 'toc.html' %}
{%- elif nav_item.is_section %}
{%- for nav_item in nav_item.children %}
<li class="toctree-l{{ navlevel }}{% if nav_item.active%} current{%endif%}">
{%- include 'nav.html' %}
</li>
{%- endfor %}
{%- endif %}
</ul>
{%- endif %}
{%- set navlevel = navlevel - 1 %}

16
docs/theme/search.html vendored Normal file

@ -0,0 +1,16 @@
{% extends "base.html" %}
{% block content %}
<h1 id="search">Search Results</h1>
<form id="content_search" action="search.html">
<span role="status" aria-live="polite" class="ui-helper-hidden-accessible"></span>
<input name="q" id="mkdocs-search-query" type="text" class="search_input search-query ui-autocomplete-input" placeholder="Search the Docs" autocomplete="off" autofocus title="Type search term here">
</form>
<div id="mkdocs-search-results" class="search-results">
Searching...
</div>
{% endblock %}

5
docs/theme/searchbox.html vendored Normal file

@ -0,0 +1,5 @@
<div role="search">
<form id ="rtd-search-form" class="wy-form" action="{{ base_url }}/search.html" method="get">
<input type="text" name="q" placeholder="Search docs" title="Type search term here" />
</form>
</div>

12
docs/theme/toc.html vendored Normal file

@ -0,0 +1,12 @@
{%- for toc_item in toc_item.children %}
<li class="toctree-l{{ navlevel}}"><a class="reference internal" href="{% if not nav_item == page %}{{ nav_item.url|url }}{% endif %}{{ toc_item.url }}">{{ toc_item.title }}</a>
{%- set navlevel = navlevel + 1 %}
{%- if navlevel <= config.theme.navigation_depth and toc_item.children %}
<ul>
{%- include 'toc.html' %}
</ul>
{%- endif %}
{%- set navlevel = navlevel - 1 %}
</li>
{%- endfor %}

17
docs/theme/versions.html vendored Normal file

@ -0,0 +1,17 @@
<div class="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
{% if config.repo_name == 'GitHub' %}
<a href="{{ config.repo_url }}" class="fa fa-github" style="float: left; color: #fcfcfc"> GitHub</a>
{% elif config.repo_name == 'Bitbucket' %}
<a href="{{ config.repo_url }}" class="icon icon-bitbucket" style="float: left; color: #fcfcfc"> BitBucket</a>
{% elif config.repo_name == 'GitLab' %}
<a href="{{ config.repo_url }}" class="icon icon-gitlab" style="float: left; color: #fcfcfc"> GitLab</a>
{% endif %}
{% if page.previous_page %}
<span><a href="{{ page.previous_page.url|url }}" style="color: #fcfcfc;">&laquo; Previous</a></span>
{% endif %}
{% if page.next_page %}
<span style="margin-left: 15px"><a href="{{ page.next_page.url|url }}" style="color: #fcfcfc">Next &raquo;</a></span>
{% endif %}
</span>
</div>