feat: support of Hugo 0.22+ #51 #48 #11 #50

This commit is contained in:
matcornic 2017-07-27 21:42:07 +02:00
parent 27b99f0f18
commit b2ac8298bf
23 changed files with 498 additions and 388 deletions

View file

@ -1,11 +1,12 @@
--- ---
title: "Some Chapter title" title: "{{ replace .TranslationBaseName "-" " " | title }}"
weight: 0 date: {{ .Date }}
icon: "<b>X. </b>" # HTML code as prefix in the menu weight: 5
pre: "<b>X. </b>" # HTML code as prefix in the menu
draft: true
--- ---
### Chapter X ### Chapter X
# Some Chapter title Lorem Ipsum.
Notice `draft` is set to true.
Lorem ipsum

View file

@ -1,7 +1,9 @@
--- ---
title: "Some Title" title: "{{ replace .TranslationBaseName "-" " " | title }}"
date: {{ .Date }}
weight: 5 weight: 5
toc: true draft: true
--- ---
Lorem Ipsum Lorem Ipsum.
Notice `draft` is set to true.

32
i18n/en.toml Normal file
View file

@ -0,0 +1,32 @@
[Search-placeholder]
other = "Search..."
[Clear-History]
other = "Clear History"
[Page]
other = "Page"
[Next-Pages]
other = "Next Pages"
[Previous-Pages]
other = "Previous Pages"
[pagination-on]
other = "on"
[Attachments-label]
other = "Attachments"
[title-404]
other = "Error"
[message-404]
other = "Woops. Looks like this page doesn't exist."
[Go-to-homepage]
other = "Go to homepage"
[Edit-this-page]
other = "Edit page"

32
i18n/fr.toml Normal file
View file

@ -0,0 +1,32 @@
[Search-placeholder]
other = "Rechercher..."
[Clear-History]
other = "Supprimer l'historique"
[Page]
other = "Page"
[Next-Pages]
other = "Pages suivantes"
[Previous-Pages]
other = "Pages précédentes"
[pagination-on]
other = "sur"
[Attachments-label]
other = "Documents joints"
[title-404]
other = "Erreur"
[message-404]
other = "Oups. On dirait que cette page n'existe pas "
[Go-to-homepage]
other = "Vers la page d'accueil"
[Edit-this-page]
other = "Modifier la page"

32
i18n/nb.toml Normal file
View file

@ -0,0 +1,32 @@
[Search-placeholder]
other = "Søk..."
[Clear-History]
other = "Fjern historikk"
[Page]
other = "Side"
[Next-Pages]
other = "Neste"
[Previous-Pages]
other = "Forrige"
[pagination-on]
other = "av"
[Attachments-label]
other = "Vedlegg"
[title-404]
other = "Feil"
[message-404]
other = "Ups... Ser ikke ut som denne siden eksisterer."
[Go-to-homepage]
other = "Gå til hovedsiden"
[Edit-this-page]
other = "Editer"

View file

@ -5,13 +5,14 @@
<meta charset="utf-8"> {{ partial "meta.html" . }} {{ partial "favicon.html" . }} {{ .Scratch.Add "title" "" }}{{ if eq .Site.Data.titles .Title }}{{ .Scratch.Set "title" (index .Site.Data.titles .Title).title }}{{ else }}{{ .Scratch.Set "title" .Title}}{{end}} <meta charset="utf-8"> {{ partial "meta.html" . }} {{ partial "favicon.html" . }} {{ .Scratch.Add "title" "" }}{{ if eq .Site.Data.titles .Title }}{{ .Scratch.Set "title" (index .Site.Data.titles .Title).title }}{{ else }}{{ .Scratch.Set "title" .Title}}{{end}}
<title>{{ .Scratch.Get "title" }}</title> <title>{{ .Scratch.Get "title" }}</title>
{{ partial "style.html" . }} {{ partial "style.html" . }}
<link href="{{ .Site.BaseURL }}/css/nucleus.css" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/font-awesome.min.css" rel="stylesheet"> <link href="{{"css/nucleus.css" | relLangURL}}" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/hybrid.css" rel="stylesheet"> <link href="{{"css/font-awesome.min.css" | relLangURL}}" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/featherlight.min.css" rel="stylesheet"> <link href="{{"css/hybrid.css" | relLangURL}}" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/perfect-scrollbar.min.css" rel="stylesheet"> <link href="{{"css/featherlight.min.css" | relLangURL}}" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/theme.css" rel="stylesheet"> <link href="{{"css/perfect-scrollbar.min.css" | relLangURL}}" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/hugo-theme.css" rel="stylesheet"> <link href="{{"css/theme.css" | relLangURL}}" rel="stylesheet">
<link href="{{"css/hugo-theme.css" | relLangURL}}" rel="stylesheet">
<style type="text/css"> <style type="text/css">
:root #header + #content > #left > #rlblock_left { :root #header + #content > #left > #rlblock_left {
display: none !important; display: none !important;
@ -37,12 +38,12 @@
<div id="overlay"></div> <div id="overlay"></div>
<div id="chapter"> <div id="chapter">
<div id="body-inner"> <div id="body-inner">
<h1>Error </h1> <h1>{{T "title-404"}}</h1>
<p> <p>
</p> </p>
<p>Woops. Looks like this page doesn't exist.</p> <p>{{T "message-404"}}</p>
<p></p> <p></p>
<p><a href="{{.Site.BaseURL}}">Go to homepage</a></p> <p><a href="{{.Site.BaseURL}}">{{T "Go-to-homepage"}}</a></p>
<p><img src="{{ .Site.BaseURL }}/images/gopher-404.jpg" style="width:50%"></img></p> <p><img src="{{ .Site.BaseURL }}/images/gopher-404.jpg" style="width:50%"></img></p>
</div> </div>
</div> </div>

View file

@ -1,13 +1,29 @@
{{ if .Content }}
{{ partial "header.html" . }} {{ partial "header.html" . }}
{{ .Content }} {{ .Content }}
<footer class=" footline" >
{{with .Params.LastModifierDisplayName}}
<i class='fa fa-user'></i> <a href="mailto:{{ $.Params.LastModifierEmail }}">{{ . }}</a> {{with $.Date}} <i class='fa fa-calendar'></i> {{ .Format "02/01/2006" }}{{end}}
</div>
{{end}}
</footer>
{{if not .Content }}
{{ $paginator := .Paginator }}
<div class="extra-pagination inner">
{{ partial "pagination.html" $paginator }}
</div>
{{ range $index, $page := $paginator.Pages }}
{{ .Render "li" }}
{{ end }}
<div style="margin-bottom:2rem"></div>
{{ partial "pagination.html" $paginator }}
{{end}}
{{ partial "footer.html" . }} {{ partial "footer.html" . }}
{{ else }}
{{ with (index (index .Site.Sections .Section) 0) }}
{{ with .Page }}
{{ partial "header.html" . }}
{{ .Content }}
{{ partial "footer.html" . }}
{{ end }}
{{ end }}
{{ end }}

View file

@ -1,3 +1,13 @@
{{ partial "header.html" . }} {{ partial "header.html" . }}
{{ .Content }} {{ .Content }}
<footer class=" footline" >
{{with .Params.LastModifierDisplayName}}
<i class='fa fa-user'></i> <a href="mailto:{{ $.Params.LastModifierEmail }}">{{ . }}</a> {{with $.Date}} <i class='fa fa-calendar'></i> {{ .Format "02/01/2006" }}{{end}}
</div>
{{end}}
</footer>
{{ partial "footer.html" . }} {{ partial "footer.html" . }}

View file

@ -1,52 +1,30 @@
<!DOCTYPE html> {{ partial "header.html" . }}
<html lang="en" class="js csstransforms3d"> <span id="sidebar-toggle-span">
<head> <a href="#" id="sidebar-toggle" data-sidebar-toggle=""><i class="fa fa-bars"></i> navigation</a>
<meta charset="utf-8"> </span>
{{ partial "meta.html" . }}
{{ partial "favicon.html" . }}
{{ .Scratch.Add "title" "" }}{{ if isset .Site.Data.titles .Title }}{{ .Scratch.Set "title" (index .Site.Data.titles .Title).title }}{{ else }}{{ .Scratch.Set "title" .Title}}{{end}}
<title>{{ .Scratch.Get "title" }}</title>
{{ partial "style.html" . }}
<link href="{{ .Site.BaseURL }}/css/nucleus.css" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/font-awesome.min.css" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/hybrid.css" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/featherlight.min.css" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/perfect-scrollbar.min.css" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/theme.css" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/hugo-theme.css" rel="stylesheet">
<style type="text/css">
:root #header + #content > #left > #rlblock_left {
display:none !important;
}
p,li,ul { {{if .Site.Home.Content }}
text-align: center {{.Site.Home.Content}}
} {{else}}
{{if eq .Site.Language.Lang "fr"}}
ul <h1>Personaliser la page d'accueil</h1>
{ <p>
list-style-type: none; Le site fonctionne. Ne pas oublier de personaliser cette page avec votre propre contenu. 2 façons de faire :
} </p>
</style> <ul>
</head> <li><b>1. </b> Créer un fichier _index.md dans le dossier content</li>
<body> <li><b>2. </b> Configurer le serveur http pour rediriger automatiquement la homepage vers la page de votre choix dans le site</li>
<body class="" data-url="/"> </ul>
{{else}}
<section id="body" style="margin-left:0px;"> <h1>Customize your own home page</h1>
<div id="overlay"></div> <p>
The site is working. Don't forget to customize this homepage with your own. You typically have 2 choices :
<div class="padding highlightable"> </p>
<h1>Customize your own home page</h1> <ul>
<p> <li><b>1. </b> Create a _index.md document in content folder</li>
The site is working, change the URL in your browser to get to any custom page. But, don't forget to <a href="https://gohugo.io/themes/customizing/">overwrite this index.html</a> with your own. You typically have 3 choices : <li><b>2. </b> Configure your server to automatically redirect home page to one your documentation page</li>
</p> </ul>
<ul> {{end}}
<li><b>1. </b> Create an overview page for your project</li> <p><i class="fa fa-heart fa-4x"></i></p>
<li><b>2. </b> Create an empty html page with this code in the head tag to redirect to one of your documentation page : <code>&lt;meta http-equiv="refresh" content="0; url=http://example.com/"/&gt;</code> </li> {{ end }}
<li><b>3. </b> Configure your server to automatically redirect home page to one your documentation page</li> {{ partial "footer.html" . }}
</ul>
<p><i class="fa fa-heart fa-4x"></i></p>
</div>
</section>
</body>
</html>

12
layouts/index.json Normal file
View file

@ -0,0 +1,12 @@
[{{ range $index, $page := .Site.Pages }}
{{- if ne $page.Type "json" -}}
{{- if and $index (gt $index 0) -}},{{- end }}
{
"uri": "{{ $page.Permalink }}",
"title": "{{ htmlEscape $page.Title}}",
"tags": [{{ range $tindex, $tag := $page.Params.tags }}{{ if $tindex }}, {{ end }}"{{ $tag| htmlEscape }}"{{ end }}],
"description": "{{ htmlEscape .Description}}",
"content": {{$page.Plain | jsonify}}
}
{{- end -}}
{{- end -}}]

View file

@ -1,71 +1,67 @@
{{ if .Params.chapter }}
{{ $isChapter := .Params.chapter | default (eq .Kind "section")}} </div> <!-- end chapter-->
{{ if $isChapter }} {{ end }}
</div> <!-- end chapter--> </div>
{{ end }}
</div> </div>
</div>
{{ if $.Site.Params.autoNav }}
{{ $.Scratch.Set "_sectionpages" (slice) }}
{{ if $.Site.Params.menu }}
{{ range $sname := $.Site.Params.menu }}
{{ $.Scratch.Add "_sectionpages" ($.Site.GetPage "section" $sname) }}
{{ end }}
{{ else }}
{{ range $sname, $spages := .Site.Sections }}
{{ $.Scratch.Add "_sectionpages" ($.Site.GetPage "section" $sname) }}
{{ end }}
{{ $.Scratch.Set "_sectionpages" (sort ($.Scratch.Get "_sectionpages") "Weight") }}
{{ end }}
{{ $.Scratch.Set "_allpages" (slice) }}
{{ range $.Scratch.Get "_sectionpages" }}
{{ if .Content }}
{{ $.Scratch.Add "_allpages" . }}
{{ end }}
{{ range index $.Site.Sections .Section }}
{{ $.Scratch.Add "_allpages" .Page }}
{{ end }}
{{ end }}
{{ end }}
<div id="navigation"> <div id="navigation">
{{ if $.Site.Params.autoNav }} <!-- Next prev page -->
{{ $allpages := $.Scratch.Get "_allpages" }} {{ $currentNode := . }}
{{ range $index, $element := $allpages }}
{{if eq $element.UniqueID $.UniqueID }} {{ template "menu-nextprev" dict "menu" .Site.Home "currentnode" $currentNode }}
{{ if not (isset $.Params "prev") }}
{{ with index $allpages (sub $index 1) }} {{ define "menu-nextprev" }}
<a class="nav nav-prev" href="{{ .URL }}"> <i class="fa fa-chevron-left"></i></a> {{$currentNode := .currentnode }}
{{ end }} {{ if ne .menu.Params.hidden true}}
{{if hasPrefix $currentNode.URL .menu.URL }}
{{ $currentNode.Scratch.Set "NextPageOK" "OK" }}
{{ $currentNode.Scratch.Set "prevPage" ($currentNode.Scratch.Get "prevPageTmp") }}
{{else}}
{{if eq ($currentNode.Scratch.Get "NextPageOK") "OK"}}
{{ $currentNode.Scratch.Set "NextPageOK" nil }}
{{ $currentNode.Scratch.Set "nextPage" .menu }}
{{end}}
{{end}}
{{ $currentNode.Scratch.Set "prevPageTmp" .menu }}
{{ $currentNode.Scratch.Set "pages" .menu.Pages }}
{{ if .menu.IsHome}}
{{ $currentNode.Scratch.Set "pages" .menu.Sections }}
{{ else if .menu.Sections}}
{{ $currentNode.Scratch.Set "pages" (.menu.Pages | union .menu.Sections) }}
{{end}}
{{ $pages := ($currentNode.Scratch.Get "pages") }}
{{ range $pages.ByWeight }}
{{ template "menu-nextprev" dict "menu" . "currentnode" $currentNode }}
{{end}}
{{ end }} {{ end }}
{{ if not (isset $.Params "next") }}
{{ with index $allpages (add $index 1) }}
<a class="nav nav-next" href="{{ .URL }}" style="margin-right: 0px;"><i class="fa fa-chevron-right"></i></a>
{{ end }}
{{ end }}
{{ end }}
{{ end }} {{ end }}
{{ end }}
{{ with .Params.prev }}<a class="nav nav-prev" href="{{ . | relURL }}"> <i class="fa fa-chevron-left"></i></a>{{ end }}
{{ with .Params.next }}<a class="nav nav-next" href="{{ . | relURL }}" style="margin-right: 0px;"><i class="fa fa-chevron-right"></i></a>{{ end }} {{with ($.Scratch.Get "prevPage")}}
<a class="nav nav-prev" href="{{.URL}}" title="{{.Title}}"> <i class="fa fa-chevron-left"></i></a>
{{end}}
{{with ($.Scratch.Get "nextPage")}}
<a class="nav nav-next" href="{{.URL}}" title="{{.Title}}" style="margin-right: 0px;"><i class="fa fa-chevron-right"></i></a>
{{end}}
</div> </div>
</section> </section>
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"> <div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div> <div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
</div> </div>
<script src="{{ .Site.BaseURL }}/js/clipboard.min.js"></script> <script src="{{"js/clipboard.min.js" | relURL}}"></script>
<script src="{{ .Site.BaseURL }}/js/perfect-scrollbar.min.js"></script> <script src="{{"js/perfect-scrollbar.min.js" | relURL}}"></script>
<script src="{{ .Site.BaseURL }}/js/perfect-scrollbar.jquery.min.js"></script> <script src="{{"js/perfect-scrollbar.jquery.min.js" | relURL}}"></script>
<script src="{{ .Site.BaseURL }}/js/jquery.sticky-kit.min.js"></script> <script src="{{"js/jquery.sticky-kit.min.js" | relURL}}"></script>
<script src="{{ .Site.BaseURL }}/js/featherlight.min.js"></script> <script src="{{"js/featherlight.min.js" | relURL}}"></script>
<script src="{{ .Site.BaseURL }}/js/html5shiv-printshiv.min.js"></script> <script src="{{"js/html5shiv-printshiv.min.js" | relURL}}"></script>
<script src="{{ .Site.BaseURL }}/js/highlight.pack.js"></script> <script src="{{"js/highlight.pack.js" | relURL}}"></script>
<script>hljs.initHighlightingOnLoad();</script> <script>hljs.initHighlightingOnLoad();</script>
<script src="{{ .Site.BaseURL }}/js/modernizr.custom.71422.js"></script> <script src="{{"js/modernizr.custom.71422.js" | relURL}}"></script>
<script src="{{ .Site.BaseURL }}/js/learn.js"></script> <script src="{{"js/learn.js" | relURL}}"></script>
<script src="{{ .Site.BaseURL }}/js/hugo-learn.js"></script> <script src="{{"js/hugo-learn.js" | relURL}}"></script>
{{ partial "script.html" . }}
</body> </body>
</html> </html>

View file

@ -1,84 +1,83 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" class="js csstransforms3d"> <html lang="{{ .Page.Language | default "en" }}" class="js csstransforms3d">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
{{ .Hugo.Generator }} {{ .Hugo.Generator }}
{{ partial "meta.html" . }} {{ partial "meta.html" . }}
{{ partial "favicon.html" . }} {{ partial "favicon.html" . }}
{{ .Scratch.Add "title" "" }}{{ if eq .Site.Data.titles .Title }}{{ .Scratch.Set "title" (index .Site.Data.titles .Title).title }}{{ else }}{{ .Scratch.Set "title" .Title}}{{end}} <title>{{ .Title }} :: {{ .Site.Title }}</title>
<title>{{ .Scratch.Get "title" }}</title>
<link href="{{ .Site.BaseURL }}/css/nucleus.css" rel="stylesheet"> <link href="{{"css/nucleus.css" | relURL}}" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/font-awesome.min.css" rel="stylesheet"> <link href="{{"css/font-awesome.min.css" | relURL}}" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/hybrid.css" rel="stylesheet"> <link href="{{"css/hybrid.css" | relURL}}" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/featherlight.min.css" rel="stylesheet"> <link href="{{"css/featherlight.min.css" | relURL}}" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/perfect-scrollbar.min.css" rel="stylesheet"> <link href="{{"css/perfect-scrollbar.min.css" | relURL}}" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/horsey.css" rel="stylesheet"> <link href="{{"css/horsey.css" | relURL}}" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/theme.css" rel="stylesheet"> <link href="{{"css/theme.css" | relURL}}" rel="stylesheet">
<link href="{{ .Site.BaseURL }}/css/hugo-theme.css" rel="stylesheet"> <link href="{{"css/hugo-theme.css" | relURL}}" rel="stylesheet">
<script src="{{ .Site.BaseURL }}/js/jquery-2.x.min.js"></script> <script src="{{"js/jquery-2.x.min.js"| relURL}}"></script>
<style type="text/css">:root #header + #content > #left > #rlblock_left
{display:none !important;}</style> <style type="text/css">
:root #header + #content > #left > #rlblock_left{
display:none !important;
}
</style>
{{ partial "style.html" . }} {{ partial "style.html" . }}
</head> </head>
<body class="" data-url="{{ .RelPermalink }}"> <body class="" data-url="{{ .RelPermalink }}">
{{ $isChapter := .Params.chapter | default (eq .Kind "section")}}
{{ partial "menu.html" . }} {{ partial "menu.html" . }}
<section id="body"> <section id="body">
<div id="overlay"></div> <div id="overlay"></div>
<div class="padding highlightable">
<div class="padding highlightable sticky-parent"> {{if not .IsHome}}
<div class="sticky-spacer">
<div id="top-bar"> <div id="top-bar">
{{ if and .IsPage .Site.Params.editURL }} {{ if and (or .IsPage .IsSection) .Site.Params.editURL }}
{{ $File := .File }} {{ $File := .File }}
{{ $Site := .Site }} {{ $Site := .Site }}
{{with $File.Path }} {{with $File.Path }}
<div id="top-github-link"> <div id="top-github-link">
<a class="github-link" href="{{ $Site.Params.editURL }}{{ replace $File.Dir "\\" "/" }}{{ $File.LogicalName }}" target="blank"> <a class="github-link" href="{{ $Site.Params.editURL }}{{ replace $File.Dir "\\" "/" }}{{ $File.LogicalName }}" target="blank">
<i class="fa fa-code-fork"></i> <i class="fa fa-code-fork"></i>
Edit this page {{T "Edit-this-page"}}
</a> </a>
</div> </div>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{$toc := (and (not .Params.disableToc) (not .Params.chapter))}}
<div id="breadcrumbs" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"> <div id="breadcrumbs" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb">
<span id="sidebar-toggle-span"> <span id="sidebar-toggle-span">
<a href="#" id="sidebar-toggle" data-sidebar-toggle=""> <a href="#" id="sidebar-toggle" data-sidebar-toggle="">
<i class="fa fa-bars"></i> <i class="fa fa-bars"></i>
</a> </a>
</span> </span>
{{ if and (not $isChapter) (.Params.toc) }} {{ if $toc }}
<span id="toc-menu"><a href=""><i class="fa fa-list-alt"></i></a></span> <span id="toc-menu"><i class="fa fa-list-alt"></i></span>
{{ end }} {{ end }}
{{ if ne $.Section "" }} <span class="links">
{{ $section := index $.Site.Sections $.Section }} {{ template "breadcrumb" dict "page" . "value" .Title }}
{{ $sectionPage := $.Site.GetPage "section" $.Section }} </span>
{{ if $sectionPage.Content }}
{{ $first := $.Site.GetPage "section" $.Section }}
{{ if ne $first.UniqueID $.UniqueID }}
<a href="{{ $first.RelPermalink }}" itemprop="url"><span itemprop="title">{{ $first.Title }}</span></a> <i class="fa fa-angle-right"></i>
{{ end }}
{{ else if gt $section.Len 0 }}
{{ $first := (index $section 0).Page }}
{{ if ne $first.UniqueID $.UniqueID }}
<a href="{{ $first.RelPermalink }}" itemprop="url"><span itemprop="title">{{ $first.Title }}</span></a> <i class="fa fa-angle-right"></i>
{{ end }}
{{ end }}
{{ end }}
{{ with .Title }}<span itemprop="title"> {{ . }}</span>{{ end }}
</div> </div>
{{ if .Params.toc }} {{ if $toc }}
{{ partial "toc.html" . }} {{ partial "toc.html" . }}
{{ end }} {{ end }}
</div> </div>
</div>
{{ if $isChapter }}
<div id="chapter">
{{ end }} {{ end }}
<div id="body-inner">
{{ if not $isChapter }} {{ if .Params.chapter }}
<h1>{{.Title}}</h1> <div id="chapter">
{{ end }} {{ end }}
<div id="body-inner">
{{if and (not .IsHome) (not .Params.chapter) }}
<h1>{{.Title}}</h1>
{{end}}
{{define "breadcrumb"}}
{{$parent := .page.Parent }}
{{ if $parent }}
{{ $value := (printf "<a href='%s'>%s</a> > %s" $parent.URL $parent.Title .value) }}
{{ template "breadcrumb" dict "page" $parent "value" $value }}
{{else}}
{{.value|safeHTML}}
{{end}}
{{end}}

View file

@ -1,87 +1,98 @@
<nav id="sidebar"> <nav id="sidebar" class="{{if $.Site.Params.showVisitedLinks }}showVisitedLinks{{end}}">
{{ $currentNode := . }}
{{ $showvisitedlinks := .Site.Params.showVisitedLinks }}
<div id="header-wrapper"> <div id="header-wrapper">
<div id="header"> <div id="header">
{{ partial "logo.html" . }} {{ partial "logo.html" . }}
</div> </div>
{{ if .Site.Params.search }} {{if not .Site.Params.disableSearch}}
{{ partial "search.html" . }} {{ partial "search.html" . }}
{{ end }} {{end}}
</div> </div>
<div class="highlightable">
<div class="highlightable">
<ul class="topics"> <ul class="topics">
{{ if $.Site.Params.menu }}
{{ $.Scratch.Set "menuItems" $.Site.Params.menu }}
{{ else }}
{{ $.Scratch.Set "_pages" (slice) }}
{{ range $key, $value := .Site.Sections }}
{{ $sectionPage := $.Site.GetPage "section" $key }}
{{ if $sectionPage.Content }}
{{ $.Scratch.Add "_pages" $sectionPage }}
{{ else if gt $value.Len 0 }}
{{ $.Scratch.Add "_pages" (index $value 0).Page }}
{{ end }}
{{ end }}
{{ $.Scratch.Set "menuItems" (slice)}}
{{ range $key, $value := sort ($.Scratch.Get "_pages") "Weight" }}
{{ $.Scratch.Add "menuItems" $value.Section }}
{{ end }}
{{ end }}
{{ $menuItems := $.Scratch.Get "menuItems" }}
{{ range $i, $key := $menuItems }}
{{ if ne $key "" }}
{{ $value := (index $.Site.Sections $key) }} {{if eq .Site.Params.ordersectionsby "title"}}
{{ $.Scratch.Set "_value" $value }} {{range .Site.Home.Sections.ByTitle}}
{{ with $index := $.Site.GetPage "section" $key }} {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks}}
{{ if .Content }} {{end}}
{{ $.Scratch.Set "first" $index }} {{else}}
{{ else if gt $value.Len 0}} {{range .Site.Home.Sections.ByWeight}}
{{ $.Scratch.Set "first" (index $value 0).Page }} {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks}}
{{ if gt $value.Len 1 }} {{end}}
{{ $.Scratch.Set "_value" (after 1 $value) }} {{end}}
{{ else }}
{{ $.Scratch.Set "_value" nil }}
{{ end }}
{{ end }}
{{ end }}
{{ $first := $.Scratch.Get "first" }}
{{ $value := $.Scratch.Get "_value" }}
<li class="dd-item {{ if eq $.UniqueID $first.UniqueID }}active{{ end }} {{if eq $.Section $first.Section }}parent{{ end }}" data-nav-id="{{ $first.RelPermalink }}">
<a href="{{ $first.RelPermalink }}">
<span>
{{ if isset $first.Params "icon" }}
{{ printf $first.Params.icon | safeHTML }}
{{ end }}
{{ $first.Title }}
{{ if $.Site.Params.showVisitedLinks}}
<i class="fa fa-check read-icon"></i>
{{ end }}
</span>
</a>
{{ if gt $value.Len 0}}
<ul>
{{ range $k, $p := $value }}
<li class="dd-item {{ if eq $.UniqueID $p.Page.UniqueID }}active{{ end }}" data-nav-id="{{ $p.Page.RelPermalink }}">
<a href="{{ $p.Page.RelPermalink }}">
<span>{{ $p.Page.Title }} {{ if $.Site.Params.showVisitedLinks}} <i class="fa fa-check read-icon"> {{ end }} </i></span>
</a>
</li>
{{ end }}
</ul>
{{ end }}
</li>
{{ end }}
{{ end }}
</ul> </ul>
<hr> <hr/>
{{ if .Site.Params.showVisitedLinks}} {{ if $showvisitedlinks}}
<a class="padding" href="#" data-clear-history-toggle=""><i class="fa fa-fw fa-history"></i> Clear History</a> <a class="padding" href="#" data-clear-history-toggle=""><i class="fa fa-fw fa-history"></i> {{T "Clear-History"}}</a>
{{ end }} {{ end }}
<section id="footer"> <section id="footer">
{{ partial "menu-footer.html" . }} {{ partial "menu-footer.html" . }}
</section> </section>
</div> </div>
</nav> </nav>
<!-- templates -->
{{ define "section-tree-nav" }}
{{ $showvisitedlinks := .showvisitedlinks }}
{{ $currentNode := .currentnode }}
{{with .sect}}
{{if .IsSection}}
{{safeHTML .Params.head}}
<li data-nav-id="{{.URL}}" title="{{.Title}}" class="dd-item
{{if .IsAncestor $currentNode }}parent{{end}}
{{if eq .UniqueID $currentNode.UniqueID}}active{{end}}
{{if .Params.alwaysopen}}parent{{end}}
">
<a href="{{ .RelPermalink}}">
<span>
{{safeHTML .Params.Pre}}{{.Title}}{{safeHTML .Params.Post}}
{{ if $showvisitedlinks}}
<i class="fa fa-check read-icon"></i>
{{ end }}
</span>
</a>
{{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
{{ if ne $numberOfPages 0 }}
<ul>
{{ .Scratch.Set "pages" .Pages }}
{{ if .Sections}}
{{ .Scratch.Set "pages" (.Pages | union .Sections) }}
{{end}}
{{ $pages := (.Scratch.Get "pages") }}
{{if eq .Site.Params.ordersectionsby "title"}}
{{ range $pages.ByTitle }}
{{ if and .Params.hidden (not $.showhidden) }}
{{else}}
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks }}
{{end}}
{{ end }}
{{else}}
{{ range $pages.ByWeight }}
{{ if and .Params.hidden (not $.showhidden) }}
{{else}}
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks }}
{{end}}
{{ end }}
{{end}}
</ul>
{{ end }}
</li>
{{else}}
{{ if not .Params.Hidden }}
<li data-nav-id="{{.URL}}" title="{{.Title}}" class="dd-item {{if eq .UniqueID $currentNode.UniqueID}}active{{end}}">
<a href="{{ .RelPermalink}}">
<span>{{safeHTML .Params.Pre}}{{.Title}}{{safeHTML .Params.Post}}
{{ if $showvisitedlinks}}<i class="fa fa-check read-icon"></i>{{end}}
</span>
</a>
</li>
{{ end }}
{{end}}
{{ end }}
{{ end }}

View file

@ -0,0 +1,9 @@
<nav class="pagination" role="navigation">
{{if .HasPrev}}
<a class="newer-posts" href="{{ .Prev.URL }}">&larr; {{T "Previous-Pages"}}</a>
{{end}}
<span class="page-number">{{T "Page"}} {{ .PageNumber }} {{T "pagination-on"}} {{.TotalPages}}</span>
{{if .HasNext}}
<a class="older-posts" href="{{ .Next.URL }}">{{T "Next-Pages"}} &rarr;</a>
{{end}}
</nav>

View file

@ -1,11 +1,11 @@
<div class="searchbox"> <div class="searchbox">
<label for="search-by"><i class="fa fa-search"></i></label> <label for="search-by"><i class="fa fa-search"></i></label>
<input data-search-input id="search-by" type="text" placeholder="Search"> <input data-search-input id="search-by" type="text" placeholder="{{T "Search-placeholder"}}">
<span data-search-clear=""><i class="fa fa-close"></i></span> <span data-search-clear=""><i class="fa fa-close"></i></span>
</div> </div>
<script type="text/javascript" src="{{ .Site.BaseURL }}/js/lunr.min.js"></script> <script type="text/javascript" src="{{"js/lunr.min.js" | relLangURL}}"></script>
<script type="text/javascript" src="{{ .Site.BaseURL }}/js/horsey.js"></script> <script type="text/javascript" src="{{"js/horsey.js" | relLangURL}}"></script>
<script type="text/javascript"> <script type="text/javascript">
var baseurl = "{{ .Site.BaseURL }}"; var baseurl = "{{.Site.BaseURL}}";
</script> </script>
<script type="text/javascript" src="{{ .Site.BaseURL }}/js/search.js"></script> <script type="text/javascript" src="{{"js/search.js" | relLangURL}}"></script>

View file

@ -0,0 +1,33 @@
<section class="attachments">
<label>
<span class="glyphicon glyphicon-paperclip" aria-hidden="true"></span>
{{with .Get "title"}}{{.}}{{else}}{{T "Attachments-label"}}{{end}}
</label>
{{if eq .Page.File.BaseFileName "index"}}
{{$.Scratch.Add "filesName" "files"}}
{{else}}
{{$.Scratch.Add "filesName" (printf "%s.files" .Page.File.BaseFileName)}}
{{end}}
{{ range (readDir (printf "./content/%s%s" .Page.File.Dir ($.Scratch.Get "filesName")) ) }}
{{ $fileDir := replace $.Page.File.Dir "\\" "/" }}
{{if ($.Get "pattern")}}
{{if (findRE ($.Get "pattern") .Name)}}
<li>
<a href="{{ printf "%s/%s%s/%s" $.Site.BaseURL $fileDir ($.Scratch.Get "filesName") .Name }}" >
{{.Name}}
</a>
({{div .Size 1024 }} ko)
</li>
{{end}}
{{else}}
<li>
<a href="{{ printf "%s/%s%s/%s" $.Site.BaseURL $fileDir ($.Scratch.Get "filesName") .Name }}" >
{{.Name}}
</a>
({{div .Size 1024 }} ko)
</li>
{{end}}
{{end}}
</section>
{{.Inner}}

View file

@ -0,0 +1,12 @@
{{- if in (.Get 0) "/_index.md" -}}
{{- $path := (trim (.Get 0) "_index.md") -}}
{{- with .Site.GetPage "section" (trim $path "/") -}}
{{- .URL -}}
{{- end -}}
{{- else -}}
{{- with .Site.GetPage "section" (.Get 0) }}
{{- .URL -}}
{{- else -}}
{{- .Get 0 | relref .Page -}}
{{- end -}}
{{- end -}}

View file

@ -172,7 +172,6 @@ h2 {
font-size: 2.5rem; font-size: 2.5rem;
line-height: 110% !important; line-height: 110% !important;
margin: 2.5rem 0 1.5rem 0; margin: 2.5rem 0 1.5rem 0;
text-transform: capitalize;
} }
h3 { h3 {

View file

@ -812,6 +812,9 @@ td {
overflow: auto; overflow: auto;
position: relative; position: relative;
} }
.hljs::selection, .hljs span::selection {
background: #b7b7b7;
}
.lightbox-active #body { .lightbox-active #body {
overflow: visible; overflow: visible;
} }

View file

@ -17,7 +17,7 @@ var getUrlParameter = function getUrlParameter(sPageURL) {
}; };
// Execute actions on images generated from Markdown pages // Execute actions on images generated from Markdown pages
var images = $("div#body-inner img"); var images = $("div#body-inner img").not(".inline");
// Wrap image inside a featherlight (to get a full size view in a popup) // Wrap image inside a featherlight (to get a full size view in a popup)
images.wrap(function(){ images.wrap(function(){
var image =$(this); var image =$(this);
@ -56,10 +56,10 @@ images.each(function(index){
}); });
// Stick the top to the top of the screen when scrolling // Stick the top to the top of the screen when scrolling
$("#top-bar").stick_in_parent( { //$("#top-bar").stick_in_parent( {
parent: ".sticky-parent", // parent: ".sticky-parent",
spacer: ".sticky-spacer", // spacer: ".sticky-spacer",
}); //});
jQuery(document).ready(function() { jQuery(document).ready(function() {

View file

@ -25,11 +25,6 @@ function getScrollBarWidth() {
return (w1 - w2); return (w1 - w2);
}; };
function setMenuHeight() {
$('#sidebar .highlightable').height($('#sidebar').innerHeight() - $('#header-wrapper').height() - 40);
$('#sidebar .highlightable').perfectScrollbar('update');
}
function fallbackMessage(action) { function fallbackMessage(action) {
var actionMsg = ''; var actionMsg = '';
var actionKey = (action === 'cut' ? 'X' : 'C'); var actionKey = (action === 'cut' ? 'X' : 'C');
@ -49,7 +44,6 @@ function fallbackMessage(action) {
// for the window resize // for the window resize
$(window).resize(function() { $(window).resize(function() {
setMenuHeight();
}); });
// debouncing function from John Hann // debouncing function from John Hann
@ -83,10 +77,13 @@ $(window).resize(function() {
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery('#sidebar .category-icon').on('click', function() {
$( this ).toggleClass("fa-angle-down fa-angle-right") ;
$( this ).parent().parent().children('ul').toggle() ;
return false;
});
var sidebarStatus = searchStatus = 'open'; var sidebarStatus = searchStatus = 'open';
$('#sidebar .highlightable').perfectScrollbar();
// set the menu height
setMenuHeight();
jQuery('#overlay').on('click', function() { jQuery('#overlay').on('click', function() {
jQuery(document.body).toggleClass('sidebar-hidden'); jQuery(document.body).toggleClass('sidebar-hidden');
@ -147,10 +144,19 @@ jQuery(document).ready(function() {
}); });
}); });
$.expr[":"].contains = $.expr.createPseudo(function(arg) {
return function( elem ) {
return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
};
});
if (sessionStorage.getItem('search-value')) { if (sessionStorage.getItem('search-value')) {
jQuery(document.body).removeClass('searchbox-hidden'); var searchValue = sessionStorage.getItem('search-value')
jQuery('[data-search-input]').val(sessionStorage.getItem('search-value')); $(document.body).removeClass('searchbox-hidden');
jQuery('[data-search-input]').trigger('input'); $('[data-search-input]').val(searchValue);
$('[data-search-input]').trigger('input');
var searchedElem = $('#body-inner').find(':contains(' + searchValue + ')').get(0);
searchedElem && searchedElem.scrollIntoView();
} }
// clipboard // clipboard
@ -218,100 +224,24 @@ jQuery(document).ready(function() {
$('#top-bar a:not(:has(img)):not(.btn)').addClass('highlight'); $('#top-bar a:not(:has(img)):not(.btn)').addClass('highlight');
$('#body-inner a:not(:has(img)):not(.btn)').addClass('highlight'); $('#body-inner a:not(:has(img)):not(.btn)').addClass('highlight');
$('#toc-menu').hover(function() { var touchsupport = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)
$('.progress').stop(true, false, true).fadeToggle(100); if (!touchsupport){ // browser doesn't support touch
}); $('#toc-menu').hover(function() {
$('.progress').stop(true, false, true).fadeToggle(100);
});
$('.progress').hover(function() { $('.progress').hover(function() {
$('.progress').stop(true, false, true).fadeToggle(100); $('.progress').stop(true, false, true).fadeToggle(100);
}); });
}
/** if (touchsupport){ // browser does support touch
* Fix anchor scrolling that hides behind top nav bar $('#toc-menu').click(function() {
* Courtesy of https://stackoverflow.com/a/13067009/28106 $('.progress').stop(true, false, true).fadeToggle(100);
* });
* We could use pure css for this if only heading anchors were $('.progress').click(function() {
* involved, but this works for any anchor, including footnotes $('.progress').stop(true, false, true).fadeToggle(100);
**/ });
(function(document, history, location) { }
var HISTORY_SUPPORT = !!(history && history.pushState);
var anchorScrolls = {
ANCHOR_REGEX: /^#[^ ]+$/,
OFFSET_HEIGHT_PX: 50,
/**
* Establish events, and fix initial scroll position if a hash is provided.
*/
init: function() {
this.scrollToCurrent();
window.addEventListener('hashchange', this.scrollToCurrent.bind(this));
document.body.addEventListener('click', this.delegateAnchors.bind(this));
},
/**
* Return the offset amount to deduct from the normal scroll position.
* Modify as appropriate to allow for dynamic calculations
*/
getFixedOffset: function() {
return this.OFFSET_HEIGHT_PX;
},
/**
* If the provided href is an anchor which resolves to an element on the
* page, scroll to it.
* @param {String} href
* @return {Boolean} - Was the href an anchor.
*/
scrollIfAnchor: function(href, pushToHistory) {
var match, rect, anchorOffset;
if(!this.ANCHOR_REGEX.test(href)) {
return false;
}
match = document.getElementById(href.slice(1));
if(match) {
rect = match.getBoundingClientRect();
anchorOffset = window.pageYOffset + rect.top - this.getFixedOffset();
window.scrollTo(window.pageXOffset, anchorOffset);
// Add the state to history as-per normal anchor links
if(HISTORY_SUPPORT && pushToHistory) {
history.pushState({}, document.title, location.pathname + href);
}
}
return !!match;
},
/**
* Attempt to scroll to the current location's hash.
*/
scrollToCurrent: function() {
this.scrollIfAnchor(window.location.hash);
},
/**
* If the click event's target was an anchor, fix the scroll position.
*/
delegateAnchors: function(e) {
var elem = e.target;
if(
elem.nodeName === 'A' &&
this.scrollIfAnchor(elem.getAttribute('href'), true)
) {
e.preventDefault();
}
}
};
window.addEventListener(
'DOMContentLoaded', anchorScrolls.init.bind(anchorScrolls)
);
})(window.document, window.history, window.location);
}); });

View file

@ -1,11 +1,19 @@
var lunrIndex, pagesIndex; var lunrIndex, pagesIndex;
function endsWith(str, suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
// Initialize lunrjs using our generated index file // Initialize lunrjs using our generated index file
function initLunr() { function initLunr() {
if (!endsWith(baseurl,"/")){
baseurl = baseurl+'/'
};
// First retrieve the index file // First retrieve the index file
$.getJSON(baseurl + "/json/search.json") $.getJSON(baseurl +"index.json")
.done(function(index) { .done(function(index) {
pagesIndex = index; pagesIndex = index;
// Set up lunrjs by declaring the fields we use // Set up lunrjs by declaring the fields we use
// Also provide their boost level for the ranking // Also provide their boost level for the ranking
lunrIndex = new lunr.Index lunrIndex = new lunr.Index
@ -60,17 +68,12 @@ $( document ).ready(function() {
return true; return true;
}, },
set: function (value) { set: function (value) {
location.href=value.href; location.href=value.uri;
}, },
render: function (li, suggestion) { render: function (li, suggestion) {
var uri = suggestion.uri.substring(1,suggestion.uri.length); var uri = suggestion.uri.substring(1,suggestion.uri.length);
var indexOfIndex = uri.lastIndexOf("/index");
if (indexOfIndex == -1) {
indexOfIndex = uri.length;
}
var href = uri.substring(uri.indexOf("/"), indexOfIndex);
suggestion.href = baseurl + href;
suggestion.href = baseurl + uri;
var query = $("#search-by").val(); var query = $("#search-by").val();
var numWords = 2; var numWords = 2;

View file

@ -1 +0,0 @@
[]