mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2024-11-21 10:59:34 +00:00
Initial commit
This commit is contained in:
commit
43974d0908
20
LICENSE
Normal file
20
LICENSE
Normal file
@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Alex Shpak
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
2
archetypes/default.md
Normal file
2
archetypes/default.md
Normal file
@ -0,0 +1,2 @@
|
||||
+++
|
||||
+++
|
39
assets/markdown.scss
Normal file
39
assets/markdown.scss
Normal file
@ -0,0 +1,39 @@
|
||||
@import 'variables';
|
||||
|
||||
$block-border-radius: 0.15rem;
|
||||
|
||||
.markdown {
|
||||
a {
|
||||
text-decoration: none;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: 'Roboto Mono', monospace;
|
||||
}
|
||||
|
||||
p code {
|
||||
padding: $padding-1 $padding-4;
|
||||
background: $gray-100;
|
||||
border-radius: $block-border-radius;
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: $padding-16;
|
||||
background: $gray-100;
|
||||
border-radius: $block-border-radius;
|
||||
font-size: $font-size-14;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
border-left: $padding-1*2 solid $gray-300;
|
||||
margin: 0;
|
||||
padding: $padding-1 $padding-16;
|
||||
|
||||
:first-child { margin-top: 0; }
|
||||
:last-child { margin-bottom: 0; }
|
||||
}
|
||||
}
|
55
assets/pure-extension.scss
Normal file
55
assets/pure-extension.scss
Normal file
@ -0,0 +1,55 @@
|
||||
@import 'variables';
|
||||
|
||||
html, button, input, select, textarea, .pure-g [class *= "pure-u"] {
|
||||
font-family: "Open Sans", "Roboto", sans-serif;
|
||||
font-weight: 300;
|
||||
|
||||
}
|
||||
|
||||
.pure-g {
|
||||
[class *= "pure-u"] {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
.pure-u {
|
||||
flex-grow: 1;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.pure-menu-list ul ul {
|
||||
// left padding for nested sections
|
||||
padding-left: $padding-16;
|
||||
}
|
||||
|
||||
.pure-menu-root {
|
||||
// vertical space between root sections
|
||||
> li {
|
||||
padding-bottom: $padding-16;
|
||||
}
|
||||
|
||||
// font weight only for root sections
|
||||
> li > .section {
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.pure-menu-link, .pure-menu-heading {
|
||||
color: $gray-800;
|
||||
padding: $padding-4 $padding-16;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.pure-menu-link {
|
||||
&:hover, &.active {
|
||||
background: none;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: $gray-600;
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: #1F37E6;
|
||||
}
|
||||
}
|
97
assets/styles.scss
Normal file
97
assets/styles.scss
Normal file
@ -0,0 +1,97 @@
|
||||
@import 'variables';
|
||||
@import 'pure-extension';
|
||||
@import 'markdown';
|
||||
|
||||
html {
|
||||
font-size: $font-size-base;
|
||||
}
|
||||
|
||||
html, body {
|
||||
width: 100%;
|
||||
min-height: 100%;
|
||||
min-width: $body-min-width;
|
||||
}
|
||||
|
||||
body {
|
||||
color: $gray-800;
|
||||
line-height: $body-line-height;
|
||||
}
|
||||
|
||||
.book-content {
|
||||
max-width: $content-max-width;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.book-page {
|
||||
padding: 0 $size-48;
|
||||
}
|
||||
|
||||
.book-brand {
|
||||
padding: 0 $padding-16;
|
||||
font-weight: 300;
|
||||
|
||||
a {
|
||||
color: $gray-800;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
.book-nav {
|
||||
width: $nav-menu-width;
|
||||
flex-grow: 0;
|
||||
|
||||
nav {
|
||||
position: fixed;
|
||||
height: 100%;
|
||||
width: $nav-menu-width;
|
||||
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
|
||||
font-size: $font-size-14;
|
||||
background: $gray-100;
|
||||
padding-left: $padding-16;
|
||||
}
|
||||
}
|
||||
|
||||
.book-toc {
|
||||
flex-grow: 0;
|
||||
width: $toc-menu-width;
|
||||
font-size: $font-size-12;
|
||||
|
||||
nav {
|
||||
position: fixed;
|
||||
height: 100%;
|
||||
width: $toc-menu-width;
|
||||
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
|
||||
> ul {
|
||||
margin: $size-48 0;
|
||||
padding: 0 $padding-16;
|
||||
border-left: $padding-1 solid $gray-200;
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
padding-left: $padding-4;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
line-height: 1.25;
|
||||
padding: $padding-4 0;
|
||||
display: block;
|
||||
|
||||
img {
|
||||
max-height: $font-size-16;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Print styles
|
||||
@media print {
|
||||
|
||||
}
|
36
assets/variables.scss
Normal file
36
assets/variables.scss
Normal file
@ -0,0 +1,36 @@
|
||||
$padding-1: 1px; //minimal
|
||||
$padding-4: .25rem;
|
||||
$padding-8: .5rem;
|
||||
$padding-16: 1rem;
|
||||
|
||||
$font-size-base: 16px;
|
||||
$font-size-12: .75rem;
|
||||
$font-size-14: .875rem;
|
||||
$font-size-16: 1rem;
|
||||
|
||||
$size-48: 3rem;
|
||||
$size-56: 3.5rem;
|
||||
$size-72: 4.5rem;
|
||||
|
||||
// Grayscale
|
||||
$white: #fff;
|
||||
$gray-100: #f8f9fa;
|
||||
$gray-200: #e9ecef;
|
||||
$gray-300: #dee2e6;
|
||||
$gray-400: #ced4da;
|
||||
$gray-500: #adb5bd;
|
||||
$gray-600: #868e96;
|
||||
$gray-700: #495057;
|
||||
$gray-800: #343a40;
|
||||
$gray-900: #212529;
|
||||
$black: #000;
|
||||
|
||||
// $color-link:
|
||||
// $color-visited-link:
|
||||
|
||||
|
||||
$body-line-height: 1.75;
|
||||
$body-min-width: 25rem;
|
||||
$content-max-width: 64rem;
|
||||
$nav-menu-width: 18rem;
|
||||
$toc-menu-width: 14rem;
|
8
layouts/404.html
Normal file
8
layouts/404.html
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
{{ define "main"}}
|
||||
<main id="main">
|
||||
<div>
|
||||
<h1 id="title"><a href="{{ "/docs" }}">Go Home</a></h1>
|
||||
</div>
|
||||
</main>
|
||||
{{ end }}
|
25
layouts/docs/baseof.html
Normal file
25
layouts/docs/baseof.html
Normal file
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
{{ partial "book-html-head" . }}
|
||||
<title>{{ .Site.Title }}</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="pure-g">
|
||||
<div class="pure-u book-nav">
|
||||
{{ partial "book-nav" . }}
|
||||
</div>
|
||||
<div class="pure-u book-content">
|
||||
<div class="pure-g">
|
||||
<div class="pure-u book-page markdown">
|
||||
{{ block "main" . }}{{ end }}
|
||||
</div>
|
||||
<div class="pure-u book-toc">
|
||||
{{ partial "book-toc" . }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
7
layouts/docs/index.html
Normal file
7
layouts/docs/index.html
Normal file
@ -0,0 +1,7 @@
|
||||
{{ define "title" }}
|
||||
{{ .Title }} – {{ .Site.Title }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
<div>{{ .Content }}</div>
|
||||
{{ end }}
|
7
layouts/docs/list.html
Normal file
7
layouts/docs/list.html
Normal file
@ -0,0 +1,7 @@
|
||||
{{ define "title" }}
|
||||
{{ .Title }} – {{ .Site.Title }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
<div>{{ .Content }}</div>
|
||||
{{ end }}
|
3
layouts/docs/single.html
Normal file
3
layouts/docs/single.html
Normal file
@ -0,0 +1,3 @@
|
||||
{{ define "main" }}
|
||||
<div>{{ .Content }}</div>
|
||||
{{ end }}
|
3
layouts/partials/book-brand.html
Normal file
3
layouts/partials/book-brand.html
Normal file
@ -0,0 +1,3 @@
|
||||
<h2 class="book-brand">
|
||||
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
|
||||
</h2>
|
9
layouts/partials/book-html-head.html
Normal file
9
layouts/partials/book-html-head.html
Normal file
@ -0,0 +1,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,600" rel="stylesheet">
|
||||
<link href="/css/pure-min.css" rel="stylesheet">
|
||||
<link href="/css/grids-responsive-min.css" rel="stylesheet">
|
||||
|
||||
{{ $styles := resources.Get "styles.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $styles.Permalink }}">
|
61
layouts/partials/book-nav.html
Normal file
61
layouts/partials/book-nav.html
Normal file
@ -0,0 +1,61 @@
|
||||
{{ $bookSection := default "docs" .Site.Params.BookSection }}
|
||||
{{ if eq $bookSection "*" }}
|
||||
{{ .Scratch.Set "BookSections" .Site.Sections }}
|
||||
{{ else }}
|
||||
{{ $bookSections := where .Site.Sections "Section" $bookSection }}
|
||||
{{ .Scratch.Set "BookSections" $bookSections }}
|
||||
|
||||
{{ if eq (len $bookSections) 1 }}
|
||||
{{ $singleSection := index $bookSections 0 }}
|
||||
{{ .Scratch.Set "BookSections" $singleSection.Sections }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
|
||||
<nav role="navigation" class="pure-menu">
|
||||
{{ partial "book-brand" . }}
|
||||
|
||||
<ul class="pure-menu-list pure-menu-root">
|
||||
{{ range .Scratch.Get "BookSections" }}
|
||||
{{ template "book-section" (dict "Section" . "CurrentPage" $.Permalink) }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<!-- Single section of menu (recursive) -->
|
||||
{{ define "book-section" }}
|
||||
<li class="pure-menu-item">
|
||||
{{ template "book-heading" .Section }}
|
||||
<ul class="pure-menu-list">
|
||||
{{ range .Section.Sections }}
|
||||
{{ template "book-section" (dict "Section" . "CurrentPage" $.CurrentPage) }}
|
||||
{{ end }}
|
||||
{{ range .Section.Pages }}
|
||||
<li class="pure-menu-item">
|
||||
<a href="{{ .RelPermalink }}" class="pure-menu-link {{ if eq $.CurrentPage .Permalink }}active{{ end }}">
|
||||
{{ default .Title (.File | humanize | title) }}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</li>
|
||||
{{ end }}
|
||||
|
||||
<!-- Menu Heading -->
|
||||
{{ define "book-heading" }}
|
||||
|
||||
{{ $sections := split (trim .Dir "/") "/" }}
|
||||
{{ $title := index ($sections | last 1) 0 | humanize | title }}
|
||||
{{ $title := default .Title $title }}
|
||||
|
||||
{{ if .Content }}
|
||||
<a href="{{ .RelPermalink }}" class="pure-menu-link {{ if .IsSection }}section{{ end }}">
|
||||
{{- $title -}}
|
||||
</a>
|
||||
{{ else }}
|
||||
<span class="pure-menu-heading {{ if .IsSection }}section{{ end }}">
|
||||
{{- $title -}}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
1
layouts/partials/book-toc.html
Normal file
1
layouts/partials/book-toc.html
Normal file
@ -0,0 +1 @@
|
||||
{{ .Page.TableOfContents }}
|
7
static/css/grids-responsive-min.css
vendored
Normal file
7
static/css/grids-responsive-min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
21
static/css/index.html
Normal file
21
static/css/index.html
Normal file
@ -0,0 +1,21 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Your page title</title>
|
||||
|
||||
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/pure-min.css"> <!--[if lte IE 8]>
|
||||
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/grids-responsive-old-ie-min.css">
|
||||
<![endif]-->
|
||||
<!--[if gt IE 8]><!-->
|
||||
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/grids-responsive-min.css">
|
||||
<!--<![endif]--></head>
|
||||
|
||||
<body>
|
||||
<!--
|
||||
Your HTML goes here. Visit purecss.io/layouts/ for some sample HTML code.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
11
static/css/pure-min.css
vendored
Normal file
11
static/css/pure-min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
static/css/pure-start.zip
Normal file
BIN
static/css/pure-start.zip
Normal file
Binary file not shown.
15
theme.toml
Normal file
15
theme.toml
Normal file
@ -0,0 +1,15 @@
|
||||
# theme.toml template for a Hugo theme
|
||||
# See https://github.com/gohugoio/hugoThemes#themetoml for an example
|
||||
|
||||
name = "Book"
|
||||
license = "MIT"
|
||||
licenselink = "https://github.com/yourname/yourtheme/blob/master/LICENSE"
|
||||
description = ""
|
||||
homepage = "http://example.com/"
|
||||
tags = []
|
||||
features = []
|
||||
min_version = "0.41"
|
||||
|
||||
[author]
|
||||
name = "Alex Shpak"
|
||||
homepage = ""
|
Loading…
Reference in New Issue
Block a user