diff options
author | Darshan Baral <darshanbaral@users.noreply.github.com> | 2019-05-19 04:47:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-19 04:47:19 +0300 |
commit | 338838fcf67386fd0493d102ce0a116330dc4476 (patch) | |
tree | cd0ce55db952ac43ed44b3e0cf1cbc24a0cde0d0 | |
parent | 3bf6c02cb7fa9103cdf336f603ec65cd6662d9f9 (diff) |
Add files via upload
-rw-r--r-- | LICENSE | 20 | ||||
-rw-r--r-- | archetypes/default.md | 2 | ||||
-rw-r--r-- | layouts/404.html | 5 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 11 | ||||
-rw-r--r-- | layouts/_default/section.html | 28 | ||||
-rw-r--r-- | layouts/_default/single.html | 11 | ||||
-rw-r--r-- | layouts/index.html | 44 | ||||
-rw-r--r-- | layouts/partials/bookMenu.html | 14 | ||||
-rw-r--r-- | layouts/partials/chapterMenu.html | 18 | ||||
-rw-r--r-- | layouts/partials/footer.html | 11 | ||||
-rw-r--r-- | layouts/partials/head.html | 30 | ||||
-rw-r--r-- | layouts/partials/header.html | 5 | ||||
-rw-r--r-- | layouts/partials/navbar.html | 16 | ||||
-rw-r--r-- | static/css/kitab.css | 24 | ||||
-rw-r--r-- | static/js/myFunctions.js | 39 | ||||
-rw-r--r-- | theme.toml | 12 |
16 files changed, 290 insertions, 0 deletions
@@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2019 DARSHAN BARAL + +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. diff --git a/archetypes/default.md b/archetypes/default.md new file mode 100644 index 0000000..ac36e06 --- /dev/null +++ b/archetypes/default.md @@ -0,0 +1,2 @@ ++++ ++++ diff --git a/layouts/404.html b/layouts/404.html new file mode 100644 index 0000000..ccc620b --- /dev/null +++ b/layouts/404.html @@ -0,0 +1,5 @@ +{{ define "main" }}
+<main>
+ <h3>Still working on that one...</h3>
+</main>
+{{ end }}
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..989e22b --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html lang="{{ .Site.Language }}"> + {{ partial "head.html" . }} + <body class="container" style="max-width: 1024px;"> + {{ partial "header" . }} + <main class="mt-3"> + {{ block "main" . }} + {{ end }} + </main> + </body> +</html> diff --git a/layouts/_default/section.html b/layouts/_default/section.html new file mode 100644 index 0000000..6ec2a09 --- /dev/null +++ b/layouts/_default/section.html @@ -0,0 +1,28 @@ +{{ define "main" }}
+<main>
+ <table class="table table-striped table-sm m-auto" style="max-width: 800px;">
+ <thead>
+ <tr>
+ <th scope="col">
+ <h3>
+ {{ .Title | markdownify }}
+ </h3>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ {{ range .Pages.ByWeight }}
+ <tr>
+ <td>
+ <a href="{{ .Permalink }}">
+ <h4>
+ {{ .Title }}
+ </h4>
+ </a>
+ </td>
+ </tr>
+ {{ end }}
+ </tbody>
+ </table>
+</main>
+{{ end }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..42a93b7 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,11 @@ +{{ define "main" }}
+<div>
+ <h2>{{ .Title }}</h2>
+ <div class="ml-4 border-left border-primary pl-1">
+ {{ .Content }}
+ </div>
+ <div class="toTop navMenu menuItem" onclick="scrollToTop()">
+ <i class="fas fa-angle-up"></i>
+ </div>
+</div>
+{{ end }}
diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..6972886 --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,44 @@ +{{ define "main" }}
+<main>
+ <div class="site-title text-center">
+ <h1>
+ {{ .Title }}
+ </h1>
+ </div>
+ <div class="d-flex flex-row justify-content-center row">
+ {{ range .Site.Sections.ByWeight }}
+ <div class="m-2 p-2 border border-primary rounded" style="max-width: 350px;">
+ <a href="{{ .Permalink }}">
+ <h3 class="mb-0 p-0">
+ {{ .Title | markdownify }}
+ </h3>
+ </a>
+ <div class="text-right">
+ <small>
+ - {{ .Params.author }} ({{ .Date.Format (default "2006-May-13" $.Site.Params.dateFormat) }})
+ </small>
+ </div>
+ <ul class="list-unstyled ml-1 mb-0 border-top border-primary pt-2">
+ {{ range first 5 .Pages }}
+ <li>
+ <a href="{{ .Permalink }}">
+ <h4>
+ {{ .Title }}
+ </h4>
+ </a>
+ </li>
+ {{ end }}
+ </ul>
+ {{ $pageNums := len .Pages }}
+ {{ if ge $pageNums 6 }}
+ <p class="text-right mb-0">
+ <a href="{{ .Permalink }}">
+ ...more
+ </a>
+ </p>
+ {{ end }}
+ </div>
+ {{ end }}
+ </div>
+</main>
+{{ end }}
diff --git a/layouts/partials/bookMenu.html b/layouts/partials/bookMenu.html new file mode 100644 index 0000000..7833e3b --- /dev/null +++ b/layouts/partials/bookMenu.html @@ -0,0 +1,14 @@ +<div class="menuItems d-none">
+ <ul class="list-unstyled">
+ {{ range .Site.Sections }}
+ <li>
+ <a href="{{ .URL | absURL}}">
+ <h2 class="mb-0 mt-3">
+ {{ .Title |markdownify }}
+ </h2>
+ </a>
+ <p>by {{ .Params.author }}</p>
+ </li>
+ {{ end }}
+ </ul>
+</div>
diff --git a/layouts/partials/chapterMenu.html b/layouts/partials/chapterMenu.html new file mode 100644 index 0000000..a7c53f3 --- /dev/null +++ b/layouts/partials/chapterMenu.html @@ -0,0 +1,18 @@ +<div class="chapters d-none">
+ <h2 class='mt-3'>
+ {{ $thisSection := .Site.GetPage "section" .Section }}
+ {{ with $thisSection }}
+ {{ .Title | markdownify }}
+ {{ end }}
+ </h2>
+ <ul class="list-unstyled ml-3 mb-0 mt-0">
+ {{ $mypages := intersect (where .Site.Pages "Section" .Section) (where .Site.Pages "Kind" "page") }}
+ {{ range $mypages }}
+ <li>
+ <a href="{{ .Permalink }}"
+ ><h4>{{ .Title | markdownify}}</h4></a
+ >
+ </li>
+ {{ end }}
+ </ul>
+</div>
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..9a13025 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,11 @@ +<footer>
+ <small>
+ {{ .Site.Params.footer | markdownify }}
+ </small>
+ <br />
+ <small>
+ <a class="kitab-theme-by-darshan" href="https://github.com/darshanbaral/kitab">
+ kitab</a>/<a href="https://www.darshanbaral.com/">db
+ </a>
+ </small>
+</footer>
diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100644 index 0000000..26ae6fc --- /dev/null +++ b/layouts/partials/head.html @@ -0,0 +1,30 @@ +<head>
+ <meta charset="UTF-8" />
+ <title>{{ .Site.Params.title }}</title>
+ <meta name="description" content="{{ .Site.Params.description }}" />
+ <meta name="author" content="{{ .Site.Params.author }}" />
+
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <meta name="apple-mobile-web-app-capable" content="yes" />
+ <meta name="apple-mobile-web-app-status-bar-style" content="black" />
+
+ <link
+ rel="stylesheet"
+ href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
+ integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
+ crossorigin="anonymous"
+ />
+ <link
+ href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
+ rel="stylesheet"
+ />
+ <link
+ rel="stylesheet"
+ href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
+ integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay"
+ crossorigin="anonymous"
+ />
+ <link rel="stylesheet" href="{{ .Site.BaseURL }}/css/kitab.css" />
+
+ <script src="{{ .Site.BaseURL }}/js/myFunctions.js"></script>
+</head>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..984aa4a --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1,5 @@ +<nav>
+ {{ partial "navbar" . }}
+ {{ partial "bookMenu" . }}
+ {{ partial "chapterMenu" . }}
+</nav>
diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html new file mode 100644 index 0000000..6d3cc4e --- /dev/null +++ b/layouts/partials/navbar.html @@ -0,0 +1,16 @@ +<div class="d-flex flex-row mt-2 border-bottom">
+ <div class="menuItem navMenu mr-4">
+ <a href="{{ `/` | relURL }}"><i class="fas fa-home"></i></a>
+ </div>
+ <div class="menuItem navMenu mr-4" onclick="showBooks()">
+ <i class="fas fa-book"></i>
+ </div>
+ {{ if eq .Kind "page" }}
+ <div class="menuItem navMenu" onclick="showChapters()">
+ <i class="fas fa-bars"></i>
+ </div>
+ {{ end }}
+ <div class="w-100 text-right">
+ {{ partial "footer" . }}
+ </div>
+</div>
diff --git a/static/css/kitab.css b/static/css/kitab.css new file mode 100644 index 0000000..164a404 --- /dev/null +++ b/static/css/kitab.css @@ -0,0 +1,24 @@ +html {
+ width: 100vw;
+}
+* {
+ font-family: "Roboto", sans-serif;
+}
+body {
+ background-color: #f3f3ef;
+}
+.navMenu {
+ color: #007bff !important;
+ font-size: 1.8em;
+}
+.navMenu:hover {
+ color: #0056b3 !important;
+ cursor: pointer;
+}
+a:hover {
+ text-decoration: none;
+}
+.toTop {
+ position: fixed;
+ bottom: 0;
+}
diff --git a/static/js/myFunctions.js b/static/js/myFunctions.js new file mode 100644 index 0000000..79c9ec5 --- /dev/null +++ b/static/js/myFunctions.js @@ -0,0 +1,39 @@ +let showBooks = function() {
+ let options = document.querySelector(".chapters");
+ let menuItems = document.querySelector(".menuItems");
+ let mainItem = document.querySelector("main");
+ if (!options.classList.contains("d-none")) {
+ options.classList.add("d-none");
+ }
+ if (menuItems.classList.contains("d-none")) {
+ menuItems.classList.remove("d-none");
+ mainItem.classList.add("d-none");
+ } else {
+ menuItems.classList.add("d-none");
+ mainItem.classList.remove("d-none");
+ }
+};
+
+let showChapters = function() {
+ let menuItems = document.querySelector(".menuItems");
+ let options = document.querySelector(".chapters");
+ let mainItem = document.querySelector("main");
+ if (!menuItems.classList.contains("d-none")) {
+ menuItems.classList.add("d-none");
+ }
+ if (options.classList.contains("d-none")) {
+ options.classList.remove("d-none");
+ mainItem.classList.add("d-none");
+ } else {
+ options.classList.add("d-none");
+ mainItem.classList.remove("d-none");
+ }
+};
+
+let scrollToTop = () => {
+ const c = document.documentElement.scrollTop || document.body.scrollTop;
+ if (c > 0) {
+ window.requestAnimationFrame(scrollToTop);
+ window.scrollTo(0, c - c / 8);
+ }
+};
diff --git a/theme.toml b/theme.toml new file mode 100644 index 0000000..60ab59c --- /dev/null +++ b/theme.toml @@ -0,0 +1,12 @@ +name = "kitab" +license = "MIT" +licenselink = "https://github.com/yourname/yourtheme/blob/master/LICENSE" +description = "A hugo theme for publishing books" +homepage = "" +tags = ["book"] +features = ["minimal", "responsive"] +min_version = "0.41" + +[author] + name = "Darshan Baral" + homepage = "https://www.darshanbaral.com/"
\ No newline at end of file |