Skip to content

Commit

Permalink
Merge pull request #23 from Jieiku/master
Browse files Browse the repository at this point in the history
Update for Higher Lighthouse & Observatory Scores
  • Loading branch information
Keats committed May 6, 2023
2 parents b084ece + ab02a4f commit 627ec13
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 70 deletions.
66 changes: 12 additions & 54 deletions content/chapter1/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,62 +5,20 @@ sort_by = "weight"
insert_anchor_links = "right"
+++

Testing every `elements` you can find in [CommonMark](http://commonmark.org).
A theme based on [Gitbook](https://www.gitbook.com/), to write documentation or books.
<!-- more -->

Quisque viverra a eros id auctor. Proin id nibh ut nisl dignissim pellentesque et ac mi. Nullam mattis urna quis consequat bibendum. Donec pretium dui elit, a semper purus tristique et. Mauris euismod nisl eu vehicula facilisis. Maecenas facilisis non massa non scelerisque. Integer malesuada cursus erat eu viverra. Duis ligula mi, eleifend vel justo id, laoreet porttitor ex. Etiam ultricies lacus lorem, sed aliquam nulla blandit in. Maecenas vel facilisis neque, vitae fringilla eros. In justo nibh, pellentesque sed faucibus nec, varius sit amet risus.
Book will generate a book from the files you place in the `content` directory. Your book
can have two levels of hierarchy: chapters and subchapters.

> This is a quote
Each chapter should be a `section` within the Gutenberg site and should have an `_index.md`
file that sets its `weight` front-matter variable to its chapter number. For example,
chapter 2 should have `weight = 2`. Additionally, each chapter should also set the
`sort_by = "weight"` in its front matter.

- a
- bullet
- point
Each subchapter should be a `page` and should have its `weight` variable set to the subchapter
number. For example, subchapter 3.4 should have `weight = 4`.

## Some code

```rust
fn main() {
let greetings = ["Hello", "Hola", "Bonjour",
"Ciao", "こんにちは", "안녕하세요",
"Cześć", "Olá", "Здравствуйте",
"Chào bạn", "您好", "Hallo",
"Hej", "Ahoj", "سلام"];

for (num, greeting) in greetings.iter().enumerate() {
print!("{} : ", greeting);
match num {
0 => println!("This code is editable and runnable!"),
1 => println!("¡Este código es editable y ejecutable!"),
2 => println!("Ce code est modifiable et exécutable !"),
3 => println!("Questo codice è modificabile ed eseguibile!"),
4 => println!("このコードは編集して実行出来ます!"),
5 => println!("여기에서 코드를 수정하고 실행할 수 있습니다!"),
6 => println!("Ten kod można edytować oraz uruchomić!"),
7 => println!("Este código é editável e executável!"),
8 => println!("Этот код можно отредактировать и запустить!"),
9 => println!("Bạn có thể edit và run code trực tiếp!"),
10 => println!("这段代码是可以编辑并且能够运行的!"),
11 => println!("Dieser Code kann bearbeitet und ausgeführt werden!"),
12 => println!("Den här koden kan redigeras och köras!"),
13 => println!("Tento kód můžete upravit a spustit"),
14 => println!("این کد قابلیت ویرایش و اجرا دارد!"),
_ => {},
}
}
}
```

## A table

| a | table | in | markdown | !! |
|----|-------|----|----------|---------------------------------|
| 1 | 2 | 3 | 4 | 5 |
| 1 | we | ew | we | with a longish column inside it |

## An image

![a cat](https://i.imgur.com/t6nPdY8.jpg "A cat")

## An iframe

{{ youtube(id="dQw4w9WgXcQ") }}
Finally, you should create an `_index.md` file and set the `redirect_to` front-matter variable
to redirect to the first section of your content. For example, if your first section has the
slug `introduction`, then you would set `redirect_to = "introduction"`.
62 changes: 62 additions & 0 deletions content/chapter1/page2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
+++
title = "Page 2"
weight = 2
sort_by = "weight"
insert_anchor_links = "right"
+++

Testing every `elements` you can find in [CommonMark](http://commonmark.org).
<!-- more -->

Quisque viverra a eros id auctor. Proin id nibh ut nisl dignissim pellentesque et ac mi. Nullam mattis urna quis consequat bibendum. Donec pretium dui elit, a semper purus tristique et. Mauris euismod nisl eu vehicula facilisis. Maecenas facilisis non massa non scelerisque. Integer malesuada cursus erat eu viverra. Duis ligula mi, eleifend vel justo id, laoreet porttitor ex. Etiam ultricies lacus lorem, sed aliquam nulla blandit in. Maecenas vel facilisis neque, vitae fringilla eros. In justo nibh, pellentesque sed faucibus nec, varius sit amet risus.

> This is a quote
- a
- bullet
- point

## Some code

```rust
fn main() {
let greetings = ["Hello", "Hola", "Bonjour",
"Ciao", "こんにちは", "안녕하세요",
"Cześć", "Olá", "Здравствуйте",
"Chào bạn", "您好", "Hallo",
"Hej", "Ahoj", "سلام"];

for (num, greeting) in greetings.iter().enumerate() {
print!("{} : ", greeting);
match num {
0 => println!("This code is editable and runnable!"),
1 => println!("¡Este código es editable y ejecutable!"),
2 => println!("Ce code est modifiable et exécutable !"),
3 => println!("Questo codice è modificabile ed eseguibile!"),
4 => println!("このコードは編集して実行出来ます!"),
5 => println!("여기에서 코드를 수정하고 실행할 수 있습니다!"),
6 => println!("Ten kod można edytować oraz uruchomić!"),
7 => println!("Este código é editável e executável!"),
8 => println!("Этот код можно отредактировать и запустить!"),
9 => println!("Bạn có thể edit và run code trực tiếp!"),
10 => println!("这段代码是可以编辑并且能够运行的!"),
11 => println!("Dieser Code kann bearbeitet und ausgeführt werden!"),
12 => println!("Den här koden kan redigeras och köras!"),
13 => println!("Tento kód můžete upravit a spustit"),
14 => println!("این کد قابلیت ویرایش و اجرا دارد!"),
_ => {},
}
}
}
```

## A table

| a | table | in | markdown | !! |
|----|-------|----|----------|---------------------------------|
| 1 | 2 | 3 | 4 | 5 |
| 1 | we | ew | we | with a longish column inside it |

## An image

![a cat](https://i.imgur.com/t6nPdY8.jpg "A cat")
14 changes: 12 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@
command = "zola build"

[build.environment]
ZOLA_VERSION = "0.16.0"
ZOLA_VERSION = "0.17.2"

[context.deploy-preview]
command = "zola build --base-url $DEPLOY_PRIME_URL"
command = "zola build --base-url $DEPLOY_PRIME_URL"

[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
X-Content-Type-Options = "nosniff"
X-XSS-Protection = "1; mode=block"
Referrer-Policy = "strict-origin-when-cross-origin"
Strict-Transport-Security = "max-age=63072000; includeSubdomains"
Content-Security-Policy = "default-src 'none'; frame-ancestors 'none'; object-src 'none'; base-uri 'self'; manifest-src 'self'; connect-src 'self'; form-action 'self'; script-src 'self'; img-src 'self' data: cdn.cloudflare.com; frame-src 'self' www.youtube-nocookie.com player.vimeo.com; media-src 'self' data: cdn.cloudflare.com www.youtube-nocookie.com player.vimeo.com; font-src 'self' cdn.cloudflare.com cdn.jsdelivr.net fonts.gstatic.com; style-src 'self' cdn.cloudflare.com cdn.jsdelivr.net fonts.googleapis.com;"
4 changes: 2 additions & 2 deletions sass/_content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
transition: 0.5s;

.zola-anchor {
color: #4183c4;
color: #357aba;
padding-left: 10px;
text-decoration: none;
font-weight: initial;
Expand All @@ -25,7 +25,7 @@

&__content {
a {
color: #4183c4;
color: #357aba;
text-decoration: none;

&:hover {
Expand Down
2 changes: 1 addition & 1 deletion sass/_navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
}

li.active > a {
color: #008cff;
color: #0053bc;
text-decoration: none;
}

Expand Down
15 changes: 12 additions & 3 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@
<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, maximum-scale=1">
<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>

Expand Down Expand Up @@ -33,15 +42,15 @@
{% set subsection = get_section(path=s) %}
<li {% if current_path == subsection.path %}class="active"{% endif %}>
{% set chapter_num = loop.index %}
<a href="{{ subsection.permalink }}">
<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 }}">
<a href="{{ page.permalink | safe }}">
{% if config.extra.book_number_chapters %}<strong>{{ chapter_num }}.{{ loop.index }}.</strong>{% endif %}
{{ page.title }}
</a>
Expand Down
8 changes: 4 additions & 4 deletions templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ <h1>{{ page.title }}</h1>

{% block prev_link %}
{% if page.smaller %}
<a class="previous" href="{{ page.smaller.permalink }}"><</a>
<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 }}"><</a>
<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 }}">></a>
<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 }}">></a>
<a class="next" href="{{ subsection.permalink | safe }}">></a>
{# no break #}
{% set_global found_current = false %}
{% endif %}
Expand Down
8 changes: 4 additions & 4 deletions templates/section.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ <h1>{{ section.title }}</h1>
{% if found_current %}
{% if subsection.pages %}
{% set last_page = subsection.pages | last %}
<a class="previous" href="{{ last_page.permalink }}"><</a>
<a class="previous" href="{{ last_page.permalink | safe }}"><</a>
{% else %}
<a class="previous" href="{{ subsection.permalink }}"><</a>
<a class="previous" href="{{ subsection.permalink | safe }}"><</a>
{% endif %}
{# no break #}
{% set_global found_current = false %}
Expand All @@ -32,15 +32,15 @@ <h1>{{ section.title }}</h1>
{% block next_link %}
{% if section.pages %}
{% set next_page = section.pages | first %}
<a class="next" href="{{ next_page.permalink }}">></a>
<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 }}">></a>
<a class="next" href="{{ subsection.permalink | safe }}">></a>
{# no break #}
{% set_global found_current = false %}
{% endif %}
Expand Down

0 comments on commit 627ec13

Please sign in to comment.