Nicolas Massé 4 years ago
parent
commit
b5458a6750
  1. 1
      assets/css/.gitignore
  2. 95
      assets/css/itix.css
  3. 8
      i18n/en.yaml
  4. 8
      i18n/fr.yaml
  5. 2
      layouts/partials/article-headline.html
  6. 44
      layouts/partials/head.html
  7. 4
      layouts/partials/icons/en.svg
  8. 6
      layouts/partials/icons/fr.svg
  9. 5
      layouts/partials/icons/label.svg
  10. 5
      layouts/partials/icons/link.svg
  11. 6
      layouts/partials/icons/schedule.svg
  12. 5
      layouts/partials/icons/search.svg
  13. 5
      layouts/partials/icons/vertical_align_top.svg
  14. 9
      layouts/partials/menu.html
  15. 8
      layouts/partials/post-metadata.html
  16. 4
      layouts/partials/toolbar.html
  17. 7
      layouts/shortcodes/highlightFile.html
  18. 2
      static/icons/fr.svg

1
assets/css/.gitignore

@ -0,0 +1 @@
chroma.css

95
static/css/itix.css → assets/css/itix.css

@ -2,7 +2,7 @@
/*
* Theme colors
*/
--main-color: #1976d2;
--main-color: #1870c9; /* Adjusted to ensure a 4.5:1 contrast ratio for accessibility */
--main-background-color: #fcfcfc;
--alternate-text-color: #145ca4;
--main-text-color: #092949; /* 50% darker than main-color */
@ -29,9 +29,9 @@
/*
* Fonts
*/
--default-font-list: "Source Serif Pro";
--default-font-list: "Source Serif Pro", serif;
--mono-font-list: "JetBrains Mono", monospace;
--sans-preferred-font-list: "Source Sans Pro";
--sans-preferred-font-list: "Source Sans Pro", sans-serif;
}
@ -45,6 +45,13 @@
url('/fonts/JetBrainsMono-Regular.ttf') format('truetype');
font-weight: 400;
font-style: normal;
/*
* Core Web Vitals / Cumulative Layout Shift.
*
* Avoid showing invisible text while custom fonts load.
*/
font-display: swap;
}
@font-face{
@ -52,6 +59,13 @@
src: url('/fonts/SourceSerifPro-Regular.ttf') format('truetype');
font-weight: 400;
font-style: normal;
/*
* Core Web Vitals / Cumulative Layout Shift.
*
* Avoid showing invisible text while custom fonts load.
*/
font-display: swap;
}
@font-face{
@ -59,32 +73,13 @@
src: url('/fonts/SourceSansPro-Regular.ttf') format('truetype');
font-weight: 400;
font-style: normal;
}
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url('/fonts/material-icons.woff2') format('woff2'),
url('/fonts/material-icons.ttf') format('truetype');
}
/*
* The Google "Material Icons" font is used to render the tag icons, the
* "back to top" link, etc.
*/
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-moz-font-feature-settings: 'liga';
-moz-osx-font-smoothing: grayscale;
/*
* Core Web Vitals / Cumulative Layout Shift.
*
* Avoid showing invisible text while custom fonts load.
*/
font-display: swap;
}
/*
@ -260,6 +255,15 @@ pre {
/* Do not wrap lines of code */
overflow-x: hidden;
/* Hide scrollbar for IE, Edge and Firefox */
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
/* Hide scrollbar for Chrome, Safari and Opera */
pre::-webkit-scrollbar {
display: none;
}
/* Inline code (single backticks in markdown) */
@ -281,6 +285,30 @@ pre code {
padding: 0;
}
/*
* Highlighted file has a wrapping div. Some properties are redefined for it
* and reset to their default value for its children.
*/
.highlightedFile {
background: var(--codeblock-background-color);
border-radius: 5px;
}
.highlightedFile .filename {
border-bottom: 2px solid var(--hover-menu-border-color);
font-family: var(--sans-preferred-font-list) !important;
font-size: larger;
padding: 12px 15px;
}
.highlightedFile pre {
background: inherit;
border-radius: inherit;
padding: 12px 15px;
margin: 0;
}
pre:hover {
/* Show the horizontal scroll bar when hovering code (if needed) */
overflow-x: auto;
@ -290,7 +318,6 @@ pre:hover {
* i18n
*/
.tiny-flag {
height: 0.9rem;
vertical-align: middle;
margin-left: 5px;
margin-right: 5px;
@ -352,6 +379,7 @@ pre:hover {
vertical-align: sub;
margin-right: 3px;
margin-left: 5px;
max-height: 1rem;
}
.post-metadata time {
@ -387,7 +415,6 @@ article p {
article header {
padding-bottom: 30px;
font-weight: 600;
font-style: normal;
line-height: 1.5em;
@ -612,7 +639,8 @@ article header h4 {
}
.actions .material-icons {
font-size: 2em;
height: 2rem;
width: auto;
}
/*
@ -740,10 +768,11 @@ mjx-container {
.menu .menu-content {
width: 300px;
left: -300px;
height: 100vh;
background-color: var(--main-background-color);
position: fixed;
transform: translate(-300px, 0);
transform: none;
transition: transform 0.2s linear;
}
@ -769,7 +798,7 @@ mjx-container {
* the overlay that hides the article content.
*/
.menu input.hamburger-menu:checked ~ .menu-content {
transform: none;
transform: translate(300px, 0);
}
.menu input.hamburger-menu:checked ~ .menu-overlay {

8
i18n/en.yaml

@ -10,8 +10,8 @@
translation: Top of the page
- id: minutes
translation:
one: '{{ .Count }} minute'
other: '{{ .Count }} minutes'
one: '{{ .Count }} minute'
other: '{{ .Count }} minutes'
- id: continue_reading
translation: Continue reading
- id: articles_related_to
@ -34,3 +34,7 @@
translation: Speaking
- id: type_page
translation: Misc.
- id: show_menu
translation: Show the menu
- id: file
translation: 'File "%s"'

8
i18n/fr.yaml

@ -10,8 +10,8 @@
translation: Retour en haut de la page
- id: minutes
translation:
one: '{{ .Count }} minute'
other: '{{ .Count }} minutes'
one: '{{ .Count }} minute'
other: '{{ .Count }} minutes'
- id: continue_reading
translation: Continuer la lecture
- id: articles_related_to
@ -34,3 +34,7 @@
translation: Conférence
- id: type_page
translation: Divers
- id: show_menu
translation: Afficher le menu
- id: file
translation: 'Fichier "%s"'

2
layouts/partials/article-headline.html

@ -3,7 +3,7 @@
<h4><a href="{{ .current.RelPermalink }}">{{ .current.Title }}
{{- partial "lang-detection.html" .current -}}
{{ if .current.Scratch.Get "en_article_in_fr_site" }}
<img src="/icons/en.svg" class="tiny-flag" alt="en flag">
{{- partial "icons/en.svg" . -}}
{{ end }}
</a></h4>
{{- partial "post-metadata.html" . -}}

44
layouts/partials/head.html

@ -2,10 +2,42 @@
<title>{{.Title}}</title>
<meta charset="utf-8">
{{ if .IsHome -}}
<meta name="description" content="{{ .Site.Params.description }}">
{{- else -}}
<meta name="description" content="{{ .Params.description }}">
<!--
-- Package all CSS files together and minify them.
-- The page loading time should improve.
-->
{{ $chroma := resources.Get "css/chroma.css" }}
{{ $itix := resources.Get "css/itix.css" }}
{{ $css := slice $chroma $itix | resources.Concat "css/itix.css" | resources.Minify | resources.Fingerprint "sha512" }}
<link rel="stylesheet" href="{{ $css.RelPermalink }}" integrity="{{ $css.Data.Integrity }}">
<!--
-- Core Web Vitals / Cumulative Layout Shift.
--
-- Preload all fonts and images to reduce layout shifts.
-->
<link rel="preload" href="/fonts/JetBrainsMono-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="/fonts/JetBrainsMono-Regular.woff" as="font" type="font/woff" crossorigin="anonymous">
<link rel="preload" href="/fonts/JetBrainsMono-Regular.ttf" as="font" type="font/ttf" crossorigin="anonymous">
<link rel="preload" href="/fonts/SourceSerifPro-Regular.ttf" as="font" type="font/ttf" crossorigin="anonymous">
<link rel="preload" href="/fonts/SourceSansPro-Regular.ttf" as="font" type="font/ttf" crossorigin="anonymous">
<!--
-- Ensure the <meta name=description> tag is never empty since it is used
-- in the SEO score.
-->
{{- if .IsHome }}
{{- with .Site.Params.description }}
<meta name="description" content="{{ . }}">
{{- else }}
<meta name="description" content="{{ .Title }}">
{{- end }}
{{- else }}
{{- with .Params.description }}
<meta name="description" content="{{ . }}">
{{- else }}
<meta name="description" content="{{ .Title }}">
{{- end }}
{{- end }}
<!-- Tell IE to use the Edge engine -->
@ -30,10 +62,6 @@
{{ template "_internal/opengraph.html" . }}
{{ template "_internal/twitter_cards.html" . }}
<!-- The chroma syntax highlighter needs a separate CSS that can be generated using "hugo gen chromastyles --style=your-style > static/css/chroma.css" -->
<link rel="stylesheet" href="/css/chroma.css">
<link rel="stylesheet" href="/css/itix.css">
<!-- The search page is the only one to require Javascript -->
{{ if eq .Type "search" }}
<!--

4
static/icons/en.svg → layouts/partials/icons/en.svg

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 30" width="1200" height="600">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 30" width="28" height="14" class="tiny-flag">
<title>British flag</title>
<clipPath id="s">
<path d="M0,0 v30 h60 v-30 z"/>
</clipPath>

Before

Width:  |  Height:  |  Size: 672 B

After

Width:  |  Height:  |  Size: 676 B

6
layouts/partials/icons/fr.svg

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="21" height="14" class="tiny-flag">
<title>French flag</title>
<rect width="21" height="14" fill="#ED2939"/>
<rect width="14" height="14" fill="#fff"/>
<rect width="7" height="14" fill="#002395"/>
</svg>

After

Width:  |  Height:  |  Size: 249 B

5
layouts/partials/icons/label.svg

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" class="material-icons">
<title>label</title>
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12l-4.37-6.16z"/>
</svg>

After

Width:  |  Height:  |  Size: 317 B

5
layouts/partials/icons/link.svg

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" class="material-icons">
<title>link</title>
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/>
</svg>

After

Width:  |  Height:  |  Size: 395 B

6
layouts/partials/icons/schedule.svg

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" class="material-icons">
<title>schedule</title>
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/>
<path d="M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"/>
</svg>

After

Width:  |  Height:  |  Size: 384 B

5
layouts/partials/icons/search.svg

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" class="material-icons">
<title>search</title>
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
</svg>

After

Width:  |  Height:  |  Size: 420 B

5
layouts/partials/icons/vertical_align_top.svg

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" class="material-icons">
<title>back to top</title>
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M8 11h3v10h2V11h3l-4-4-4 4zM4 3v2h16V3H4z"/>
</svg>

After

Width:  |  Height:  |  Size: 232 B

9
layouts/partials/menu.html

@ -4,13 +4,16 @@
-- A fake / hidden checkbox is used as click reciever,
-- so you can use the :checked selector on it.
-->
<input type="checkbox" class="hamburger-menu" />
<input type="checkbox" class="hamburger-menu" id="show-menu" />
<!-- Some spans to draw a hamburger. -->
<div class="hamburger-menu"></div>
<div class="hamburger-menu"></div>
<div class="hamburger-menu"></div>
<!-- Add a label for accessibility -->
<label class="hamburger-menu" for="show-menu" style="display: none;" >{{ i18n "show_menu" }}</label>
<!-- And the site title for the mobile browsers -->
<div class="mobile-title">{{- .Site.Title -}}</div>
@ -43,12 +46,12 @@
{{- if .IsTranslated -}}
<!-- Try to redirect the user to the translated page if possible -->
{{- range .AllTranslations }}
<a href="{{ .RelPermalink }}"><img src="/icons/{{ .Lang }}.svg" class="tiny-flag" alt="{{ .Lang }} flag"></a>
<a href="{{ .RelPermalink }}">{{- partial (printf "icons/%s.svg" .Lang) . -}}</a>
{{- end -}}
{{- else -}}
<!-- Otherwise, redirect it to the homepage -->
{{- range site.Sites }}
<a href="{{ .Home.RelPermalink }}"><img src="/icons/{{ .Language.Lang }}.svg" class="tiny-flag" alt="{{ .Language.Lang }} flag"></a>
<a href="{{ .Home.RelPermalink }}">{{- partial (printf "icons/%s.svg" .Language.Lang) . -}}</a>
{{- end -}}
{{- end }}
</div>

8
layouts/partials/post-metadata.html

@ -12,8 +12,7 @@
<!-- Skip the item if we are on the term page presenting this item -->
{{- if or (not $.parent.Data.topic) (ne . $.parent.Data.Term) }}
<span class="topic">
<i class="material-icons" aria-hidden="true">link</i><a href="{{ "/topics/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
&nbsp;
{{- partial "icons/link.svg" . -}}<a href="{{ "/topics/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
</span>
{{- end -}}
{{- end }}
@ -23,8 +22,7 @@
<!-- Skip the item if we are on the term page presenting this item -->
{{- if or (not $.parent.Data.opensource) (ne . $.parent.Data.Term) }}
<span class="opensource">
<i class="material-icons" aria-hidden="true">label</i><a href="{{ "/opensource/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
&nbsp;
{{- partial "icons/label.svg" . -}}<a href="{{ "/opensource/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
</span>
{{- end -}}
{{- end }}
@ -35,7 +33,7 @@
-->
{{- if eq .current.Type "blog" }}
<span class="reading-time">
<i class="material-icons" aria-hidden="true">schedule</i>
{{- partial "icons/schedule.svg" . -}}
{{- $minutes := .current.ReadingTime -}}
{{- if gt $minutes 0 -}}
{{- i18n "minutes" $minutes -}}

4
layouts/partials/toolbar.html

@ -9,10 +9,10 @@
{{- end }}
<div class="actions">
<a href="#top" class="action" title="{{ i18n "back_to_top" }}">
<i class="material-icons" aria-hidden="true">vertical_align_top</i>
{{- partial "icons/vertical_align_top.svg" . -}}
</a>
<a href="{{ relref . "/search/index.md" }}" class="action" title="{{ i18n "search" }}">
<i class="material-icons" aria-hidden="true">search</i>
{{- partial "icons/search.svg" . -}}
</a>
</div>
</aside>

7
layouts/shortcodes/highlightFile.html

@ -0,0 +1,7 @@
<!-- This shortcode renders an code block prefixed by a filename -->
<div class="highlightedFile">
{{- with .Get 0 -}}
<div class="filename">{{ printf (i18n "file") . | safeHTML }}</div>
{{- end -}}
{{- highlight (trim .Inner "\n") (.Get 1) (.Get 2) -}}
</div>

2
static/icons/fr.svg

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="900" height="600"><rect width="900" height="600" fill="#ED2939"/><rect width="600" height="600" fill="#fff"/><rect width="300" height="600" fill="#002395"/></svg>

Before

Width:  |  Height:  |  Size: 248 B

Loading…
Cancel
Save