diff options
author | Thomas Letan <lthms@soap.coffee> | 2020-11-17 11:52:10 +0100 |
---|---|---|
committer | Thomas Letan <lthms@soap.coffee> | 2020-11-17 11:52:10 +0100 |
commit | 69b2e9981be525cef6afe3917f5605bd4222bdb7 (patch) | |
tree | 9105269fe65a1b0a8be7776830648490b7796afd | |
parent | Add a description field in Book.toml schema (diff) |
Update templates
-rw-r--r-- | lib/src/wstatic.rs | 1 | ||||
-rw-r--r-- | templates/static/chapter.html | 29 | ||||
-rw-r--r-- | templates/static/index.html | 23 | ||||
-rw-r--r-- | templates/static/style.css | 3 |
4 files changed, 28 insertions, 28 deletions
diff --git a/lib/src/wstatic.rs b/lib/src/wstatic.rs index 43f61be..3c2ab0c 100644 --- a/lib/src/wstatic.rs +++ b/lib/src/wstatic.rs @@ -69,6 +69,7 @@ impl Static { let mut ctx = Context::new(); ctx.insert("chapters", &chaps); + ctx.insert("numbering", &project.numbering); ctx.insert("language", &project.language); ctx.insert("title", &project.title); ctx.insert("body_only", &self.body_only); diff --git a/templates/static/chapter.html b/templates/static/chapter.html index 32d731a..edbc040 100644 --- a/templates/static/chapter.html +++ b/templates/static/chapter.html @@ -32,38 +32,17 @@ <h1> {% if numbering %} - – {{ number }} – - <span class="title"> - {% filter upper %}{{ chapter.title }}{% endfilter %} + <span class="title-number"> + – {{ number }} – </span> - {% else %} - {% filter upper %}{{ chapter.title }}{% endfilter %} {% endif %} + {{ chapter.title }} + </span> </h1> <article class="ogmarkup"> {{ chapter.content | safe }} </article> - - <nav> - {% if 1 < number %} - <a href="{{ number - 2 }}.html" class="nav_item"> - <i class="fa fa-arrow-left" aria-hidden="true"></i> - </a> - {% else %} - <div class="nav_item"></div> - {% endif %} - <a href="index.html" class="nav_item"> - <i class="fa fa-home" aria-hidden="true"></i> - </a> - {% if number < chapters_number %} - <a href="{{ number }}.html" class="nav_item"> - <i class="fa fa-arrow-right" aria-hidden="true"></i> - </a> - {% else %} - <div class="nav_item"></div> - {% endif %} - </nav> {% if not body_only %} </body> </html> diff --git a/templates/static/index.html b/templates/static/index.html index 9c88832..31e3d54 100644 --- a/templates/static/index.html +++ b/templates/static/index.html @@ -9,10 +9,27 @@ </head> <body> {% endif %} - <h1>{{ title | upper }}</h1> - <ul> + <h1>{{ title }}</h1> + + {% if description %} + <p class="description"> + {{ description | safe }} + </p> + {% endif %} + + <ul class="toc"> {% for info in chapters %} - <li><a href="{{info.index}}.html">{{ info.index + 1 }}. {{ info.title }}</a></li> + <li> + <a href="{{info.index}}.html"> + {% if numbering and info.title %} + Chapitre {{ info.index + 1 }}. {{ info.title }} + {% elif not info.title %} + Chapitre {{ info.index + 1 }} + {% else %} + {{ info.title }} + {% endif %} + </a> + </li> {% endfor %} </ul> {% if not body_only %} diff --git a/templates/static/style.css b/templates/static/style.css index 5b3c548..09a74fc 100644 --- a/templates/static/style.css +++ b/templates/static/style.css @@ -76,6 +76,9 @@ nav { display: flex; margin-top: 1rem; margin-bottom: 1rem; + position: sticky; + top: 0; + background: white; } .nav_item { |