first commit
This commit is contained in:
commit
13c1ed7b2a
35 changed files with 3330 additions and 0 deletions
130
templates/index.html
Normal file
130
templates/index.html
Normal file
|
@ -0,0 +1,130 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
|
||||
<!-- Enable responsiveness on mobile devices-->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
{% if page %}
|
||||
{% if page.description %}
|
||||
<meta name="description" content="{{ page.description }}" />
|
||||
{% elif config.description %}
|
||||
<meta name="description" content="{{ config.description }}" />
|
||||
{% endif %}
|
||||
{% elif config.description %}
|
||||
<meta name="description" content="{{ config.description }}" />
|
||||
{% endif %}
|
||||
|
||||
<title>{% block title %}{{ config.title }}{% endblock title %}</title>
|
||||
|
||||
{% block js %}
|
||||
{% endblock js %}
|
||||
|
||||
<!-- CSS -->
|
||||
{% block css %}
|
||||
<link rel="stylesheet" href="{{ get_url(path="book.css") | safe }}">
|
||||
{% endblock css %}
|
||||
|
||||
{% block extra_head %}
|
||||
{% endblock extra_head %}
|
||||
<script>
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
inlineMath: [['$', '$'], ['\\(', '\\)']]
|
||||
},
|
||||
svg: {
|
||||
fontCache: 'global'
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script async src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||||
<script async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="menu">
|
||||
{% block before_menu %}
|
||||
{% endblock before_menu %}
|
||||
<nav role="navigation">
|
||||
<ul>
|
||||
{% block menu %}
|
||||
{% set index = get_section(path="_index.md") %}
|
||||
{% for s in index.subsections %}
|
||||
{% set subsection = get_section(path=s) %}
|
||||
<li {% if current_path == subsection.path %}class="active"{% endif %}>
|
||||
{% set chapter_num = loop.index %}
|
||||
<a href="{{ subsection.permalink | safe }}">
|
||||
{% if config.extra.book_number_chapters %}<strong>{{ chapter_num }}.</strong>{% endif %}
|
||||
{{ subsection.title }}
|
||||
</a>
|
||||
{% if subsection.pages %}
|
||||
<ul>
|
||||
{% for page in subsection.pages %}
|
||||
<li {% if current_path == page.path %}class="active"{% endif %}>
|
||||
<a href="{{ page.permalink | safe }}">
|
||||
{% if config.extra.book_number_chapters %}<strong>{{ chapter_num }}.{{ loop.index }}.</strong>{% endif %}
|
||||
{{ page.title }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endblock menu %}
|
||||
</ul>
|
||||
</nav>
|
||||
{% block after_menu %}
|
||||
{% endblock after_menu %}
|
||||
</div>
|
||||
|
||||
<div class="page">
|
||||
<div class="page__header">
|
||||
<div class="menu-icon">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</div>
|
||||
{% if config.build_search_index %}
|
||||
<span class="search-icon">🔎</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="page__content">
|
||||
{% if config.build_search_index %}
|
||||
<div class="search-container">
|
||||
<input id="search" type="search" placeholder="Search..">
|
||||
<div class="search-results">
|
||||
<div class="search-results__header"></div>
|
||||
<ul class="search-results__items"></ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="book-content">
|
||||
{% block content %}
|
||||
{% endblock content %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="prev-link">
|
||||
{% block prev_link %}
|
||||
{% endblock prev_link %}
|
||||
</div>
|
||||
|
||||
<div class="next-link">
|
||||
{% block next_link %}
|
||||
{% endblock next_link %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% block js_body %}
|
||||
{% if config.build_search_index %}
|
||||
<script type="text/javascript" src="{{ get_url(path="elasticlunr.min.js") | safe }}"></script>
|
||||
<script type="text/javascript" src="{{ get_url(path="search_index.en.js") | safe }}"></script>
|
||||
{% endif %}
|
||||
<script type="text/javascript" src="{{ get_url(path="book.js") | safe }}"></script>
|
||||
{% endblock js_body %}
|
||||
</body>
|
||||
|
||||
</html>
|
40
templates/page.html
Normal file
40
templates/page.html
Normal file
|
@ -0,0 +1,40 @@
|
|||
{% extends "index.html" %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ page.title }}</h1>
|
||||
{{ page.content | safe }}
|
||||
{% endblock content %}
|
||||
|
||||
{% block prev_link %}
|
||||
{% if page.smaller %}
|
||||
<a class="previous" href="{{ page.smaller.permalink | safe }}"><</a>
|
||||
{% else %}
|
||||
{# No page before, find the link for the section it's in if there is one #}
|
||||
{% set parent = get_section(path=page.ancestors | reverse | first) %}
|
||||
<a class="previous" href="{{ parent.permalink | safe }}"><</a>
|
||||
{% endif %}
|
||||
{% endblock prev_link %}
|
||||
|
||||
{% block next_link %}
|
||||
{% if page.higher %}
|
||||
<a class="next" href="{{ page.higher.permalink | safe }}">></a>
|
||||
{% else %}
|
||||
{# No page after, find the link for the following section #}
|
||||
{% set index = get_section(path="_index.md") %}
|
||||
{% set found_current = false %}
|
||||
{% for s in index.subsections %}
|
||||
{% set subsection = get_section(path=s) %}
|
||||
{% if found_current %}
|
||||
<a class="next" href="{{ subsection.permalink | safe }}">></a>
|
||||
{# no break #}
|
||||
{% set_global found_current = false %}
|
||||
{% endif %}
|
||||
{% for p in subsection.pages %}
|
||||
{% if p.permalink == page.permalink %}
|
||||
{% set_global found_current = true %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endblock next_link %}
|
52
templates/section.html
Normal file
52
templates/section.html
Normal file
|
@ -0,0 +1,52 @@
|
|||
{% extends "index.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ section.title }}</h1>
|
||||
{{ section.content | safe }}
|
||||
{% endblock content %}
|
||||
|
||||
{% block prev_link %}
|
||||
{# need to find the last page of the previous section or the previous section directly
|
||||
if there isn't any pages in it #}
|
||||
{% set index = get_section(path="_index.md") %}
|
||||
{% set found_current = false %}
|
||||
{% for s in index.subsections | reverse %}
|
||||
{% set subsection = get_section(path=s) %}
|
||||
{% if subsection.permalink == section.permalink %}
|
||||
{% set_global found_current = true %}
|
||||
{% else %}
|
||||
{% if found_current %}
|
||||
{% if subsection.pages %}
|
||||
{% set last_page = subsection.pages | last %}
|
||||
<a class="previous" href="{{ last_page.permalink | safe }}"><</a>
|
||||
{% else %}
|
||||
<a class="previous" href="{{ subsection.permalink | safe }}"><</a>
|
||||
{% endif %}
|
||||
{# no break #}
|
||||
{% set_global found_current = false %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock prev_link %}
|
||||
|
||||
{% block next_link %}
|
||||
{% if section.pages %}
|
||||
{% set next_page = section.pages | first %}
|
||||
<a class="next" href="{{ next_page.permalink | safe }}">></a>
|
||||
{% else %}
|
||||
{# No page in the section, find the link for the following section #}
|
||||
{% set index = get_section(path="_index.md") %}
|
||||
{% set found_current = false %}
|
||||
{% for s in index.subsections %}
|
||||
{% set subsection = get_section(path=s) %}
|
||||
{% if found_current %}
|
||||
<a class="next" href="{{ subsection.permalink | safe }}">></a>
|
||||
{# no break #}
|
||||
{% set_global found_current = false %}
|
||||
{% endif %}
|
||||
{% if subsection.permalink == section.permalink %}
|
||||
{% set_global found_current = true %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endblock next_link %}
|
Loading…
Add table
Add a link
Reference in a new issue