code formatting

This commit is contained in:
Somrat 2022-01-30 11:10:45 +06:00
parent fa2d300c90
commit def0a392a5
9 changed files with 320 additions and 267 deletions

View file

@ -4,21 +4,21 @@
<body>
{{ if .IsHome }}
{{ "<!-- header -->" | safeHTML }}
<header class="banner {{if .Site.Params.banner.bg_image}}overlay bg-cover{{else}}bg-primary{{end}}" data-background="{{ .Site.Params.banner.bg_image | absURL }}">
{{ partial "navigation.html" . }}
{{ partialCached "banner.html" . }}
<!-- header -->
<header
class="banner {{if .Site.Params.banner.bg_image}}overlay bg-cover{{else}}bg-primary{{end}}"
data-background="{{ .Site.Params.banner.bg_image | absURL }}"
>
{{ partial "navigation.html" . }} {{ partialCached "banner.html" . }}
</header>
{{ "<!-- /header -->" | safeHTML }}
<!-- /header -->
{{ else }}
{{ "<!-- header -->" | safeHTML }}
<!-- header -->
<header class="shadow-bottom sticky-top bg-white">
{{ partial "navigation.html" . }}
</header>
{{ "<!-- /header -->" | safeHTML }}
{{ end }}
{{ block "main" . }}{{ end }}
<!-- /header -->
{{ end }} {{ block "main" . }}{{ end }}
{{ partialCached "footer.html" . }}
</body>
</html>

View file

@ -1,25 +1,51 @@
{{ define "main" }}
{{ "<!-- contact -->" | safeHTML }}
<!-- contact -->
<section class="section">
<div class="container">
<div class="row">
<div class="col-12">
<h2 class="section-title text-primary">{{ .Title }}</h2>
{{ .Content }}
<form action="{{ .Site.Params.contact_form_action | safeURL }}" method="POST">
<input type="text" id="name" name="name" placeholder="Name" class="form-control mb-4 shadow rounded-0">
<input type="email" id="mail" name="mail" placeholder="Email" class="form-control mb-4 shadow rounded-0">
<input type="text" id="subject" name="subject" placeholder="Subject"
class="form-control mb-4 shadow rounded-0">
<textarea name="message" id="message" placeholder="Message"
class="form-control mb-4 shadow rounded-0"></textarea>
<button type="submit" value="send" class="btn btn-primary">{{ i18n "send" }}</button>
<form
action="{{ .Site.Params.contact_form_action | safeURL }}"
method="POST"
>
<input
type="text"
id="name"
name="name"
placeholder="Name"
class="form-control mb-4 shadow rounded-0"
/>
<input
type="email"
id="mail"
name="mail"
placeholder="Email"
class="form-control mb-4 shadow rounded-0"
/>
<input
type="text"
id="subject"
name="subject"
placeholder="Subject"
class="form-control mb-4 shadow rounded-0"
/>
<textarea
name="message"
id="message"
placeholder="Message"
class="form-control mb-4 shadow rounded-0"
></textarea>
<button type="submit" value="send" class="btn btn-primary">
{{ i18n "send" }}
</button>
</form>
</div>
</div>
</div>
</section>
{{ "<!-- /contact -->" | safeHTML }}
<!-- /contact -->
{{ end }}

View file

@ -1,20 +1,16 @@
{{ define "main" }}
{{ $data := index .Site.Data .Site.Language.Lang }}
{{ "<!-- faq -->" | safeHTML }}
{{ define "main" }} {{ $data := index .Site.Data .Site.Language.Lang }}
<!-- faq -->
<section class="section pb-0">
<div class="container">
<div class="row">
<div class="col-12">
<h2 class="section-title text-primary">{{ .Title }}</h2>
{{ "<!-- accordion -->" | safeHTML }}
<div id="accordion">
{{ .Content }}
</div>
<!-- accordion -->
<div id="accordion">{{ .Content }}</div>
</div>
</div>
</div>
</section>
{{ "<!-- /faq -->" | safeHTML }}
<!-- /faq -->
{{ end }}

View file

@ -7,31 +7,36 @@
</div>
</section>
{{ end }}
{{ "<!-- topics -->" | safeHTML }}
<!-- topics -->
<section class="section">
<div class="container">
<div class="row justify-content-center">
<div class="col-12 text-center">
<h2 class="section-title">{{ i18n "topics_title" | safeHTML }}</h2>
<h2 class="section-title">{{ i18n "topics_title" | markdownify }}</h2>
</div>
{{ "<!-- topic-item -->" | safeHTML }}
<!-- topic-item -->
{{ range (where .Site.Pages "Type" "docs") }}
<div class="col-lg-4 col-sm-6 mb-4">
<a href="{{ .Permalink }}" class="px-4 py-5 bg-white shadow text-center d-block match-height">
{{ with .Params.icon}}<i class="{{.}} icon text-primary d-block mb-4"></i>{{end}}
{{ with .Params.icon}}
<i class="{{.}} icon text-primary d-block mb-4"></i>
{{end}}
<h3 class="mb-3 mt-0">{{ .Title }}</h3>
{{with .Params.description}}<p class="mb-0">{{. | markdownify}}</p>{{end}}
{{with .Params.description}}
<p class="mb-0">{{. | markdownify}}</p>
{{end}}
</a>
</div>
{{ end }}
</div>
</div>
</section>
{{ "<!-- /topics -->" | safeHTML }}
<!-- /topics -->
{{ if .Site.Params.cta.enable }}
{{ with .Site.Params.cta }}
{{ "<!-- call to action -->" | safeHTML }}
<!-- call to action -->
<section>
<div class="container">
<div class="row">
@ -49,7 +54,7 @@
</div>
</div>
</section>
{{ "<!-- /call to action -->" | safeHTML }}
<!-- /call to action -->
{{ end }}
{{ end }}

View file

@ -1,16 +1,23 @@
{{ "<!-- banner -->" | safeHTML }}
<!-- banner -->
<div class="container section">
<div class="row">
<div class="col-lg-8 text-center mx-auto">
<h1 class="text-white mb-3">{{ .Site.Params.banner.title | markdownify }}</h1>
<p class="text-white mb-4">{{ .Site.Params.banner.subtitle | markdownify }}</p>
<h1 class="text-white mb-3">
{{ .Site.Params.banner.title | markdownify }}
</h1>
<p class="text-white mb-4">
{{ .Site.Params.banner.subtitle | markdownify }}
</p>
<div class="position-relative">
<input id="search" class="form-control" placeholder="{{ .Site.Params.banner.placeholder }}">
<input
id="search"
class="form-control"
placeholder="{{ .Site.Params.banner.placeholder }}"
/>
<i class="ti-search search-icon"></i>
<!-- Javascript -->
{{ $currentNode := . }}
{{ $currentNode.Scratch.Set "pages" .Site.Pages }}
{{ $pages := ($currentNode.Scratch.Get "pages") }}
{{ $currentNode := . }} {{ $currentNode.Scratch.Set "pages" .Site.Pages
}} {{ $pages := ($currentNode.Scratch.Get "pages") }}
<script>
$(function() {
var projects = [
@ -36,4 +43,4 @@
</div>
</div>
</div>
{{ "<!-- /banner -->" | safeHTML }}
<!-- /banner -->

View file

@ -1,24 +1,26 @@
{{ "<!-- details page -->" | safeHTML }}
<!-- details page -->
<section class="single section-sm pb-0">
<div class="container">
<div class="row">
<div class="col-lg-3">
<div class="sidebar">
<a class="back-btn" href="{{ .Site.BaseURL | relLangURL }}" aria-label="back"></a>
<a
class="back-btn"
href="{{ .Site.BaseURL | relLangURL }}"
aria-label="back"
></a>
<ul class="list-styled">
{{ $currentNode := . }}
{{range .Site.Home.Sections.ByWeight}}
{{ if eq .FirstSection $currentNode.FirstSection }}
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode}}
{{ end }}
{{ end }}
{{ if .Content }}
{{ if eq .Params.downloadBtn "true" }}
{{ $currentNode := . }} {{range .Site.Home.Sections.ByWeight}} {{ if
eq .FirstSection $currentNode.FirstSection }} {{ template
"section-tree-nav" dict "sect" . "currentnode" $currentNode}} {{ end
}} {{ end }} {{ if .Content }} {{ if eq .Params.downloadBtn "true"
}}
<div>
<button class="btn btn-primary btn-block" id="generatePDF" > Get Pdf </button>
<button class="btn btn-primary btn-block" id="generatePDF">
Get Pdf
</button>
</div>
{{ end }}
{{ end }}
{{ end }} {{ end }}
</ul>
</div>
</div>
@ -30,48 +32,49 @@
{{ else }}
<div class="bg-light p-4">
<ul class="page-list">
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode }}
{{ template "section-tree-nav" dict "sect" . "currentnode"
$currentNode }}
</ul>
</div>
{{ end }}
<p class="post-meta border-bottom pb-3 mb-0 mt-3">Updated on {{ .Lastmod.Format "02 Jan 2006" }}</p>
<p class="post-meta border-bottom pb-3 mb-0 mt-3">
Updated on {{ .Lastmod.Format "02 Jan 2006" }}
</p>
<nav class="pagination mt-3">
<!-- Next prev page -->
{{ $currentNode := . }}
{{ template "menu-nextprev" dict "menu" .Site.Home "currentnode" $currentNode }}
{{ define "menu-nextprev" }}
{{$currentNode := .currentnode }}
{{ if ne .menu.Params.hidden true}}
{{if hasPrefix $currentNode.Permalink .menu.Permalink }}
{{ $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 }}
{{with ($.Scratch.Get "prevPage")}}
<a class="nav nav-prev" href="{{.Permalink }}" aria-label="Previous page" ><i class="ti-arrow-left mr-2"></i> <span class="d-none d-md-block">{{.Title}}</span></a>
{{end}}
{{with ($.Scratch.Get "nextPage")}}
<a class="nav nav-next" href="{{.Permalink }}" aria-label="Previous page" > <span class="d-none d-md-block">{{.Title}}</span><i class="ti-arrow-right ml-2"></i></a>
{{ $currentNode := . }} {{ template "menu-nextprev" dict "menu"
.Site.Home "currentnode" $currentNode }} {{ define "menu-nextprev"
}} {{$currentNode := .currentnode }} {{ if ne .menu.Params.hidden
true}} {{if hasPrefix $currentNode.Permalink .menu.Permalink }} {{
$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 }} {{with ($.Scratch.Get "prevPage")}}
<a
class="nav nav-prev"
href="{{.Permalink }}"
aria-label="Previous page"
><i class="ti-arrow-left mr-2"></i>
<span class="d-none d-md-block">{{.Title}}</span></a
>
{{end}} {{with ($.Scratch.Get "nextPage")}}
<a
class="nav nav-next"
href="{{.Permalink }}"
aria-label="Previous page"
>
<span class="d-none d-md-block">{{.Title}}</span
><i class="ti-arrow-right ml-2"></i
></a>
{{end}}
</nav>
</div>
@ -79,34 +82,31 @@
</div>
</div>
</section>
{{ "<!-- /details page -->" | safeHTML }}
<!-- /details page -->
<!-- templates -->
{{ define "section-tree-nav" }}
{{ $showvisitedlinks := .showvisitedlinks }}
{{ $currentNode := .currentnode }}
{{with .sect}}
{{safeHTML .Params.head}}
{{ $fileUniqueID := "" }}
{{ with .File }}{{ $fileUniqueID = .UniqueID }}{{ end }}
{{ $currentNodeFileUniqueID := "" }}
{{ with $currentNode.File }}{{ $currentNodeFileUniqueID = .UniqueID }}{{ end }}
<li data-nav-id="{{.Permalink}}" title="{{.Title}}" class="sidelist
{{if eq $fileUniqueID $currentNodeFileUniqueID}}active{{end}}">
{{ define "section-tree-nav" }} {{ $showvisitedlinks := .showvisitedlinks }} {{
$currentNode := .currentnode }} {{with .sect}} {{safeHTML .Params.head}} {{
$fileUniqueID := "" }} {{ with .File }}{{ $fileUniqueID = .UniqueID }}{{ end }}
{{ $currentNodeFileUniqueID := "" }} {{ with $currentNode.File }}{{
$currentNodeFileUniqueID = .UniqueID }}{{ end }}
<li
data-nav-id="{{.Permalink}}"
title="{{.Title}}"
class="sidelist
{{if eq $fileUniqueID $currentNodeFileUniqueID}}active{{end}}"
>
<a href="{{.Permalink}}">
{{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
{{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML
.Params.Post}}
</a>
{{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
{{ if ne $numberOfPages 0 }}
{{ $numberOfPages := (add (len .Pages) (len .Sections)) }} {{ if ne
$numberOfPages 0 }}
<ul>
{{ range .Pages.ByWeight }}
{{ if and .Params.hidden (not $.showhidden) }}
{{else}}
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode }}
{{end}}
{{end}}
{{ range .Pages.ByWeight }} {{ if and .Params.hidden (not $.showhidden) }}
{{else}} {{ template "section-tree-nav" dict "sect" . "currentnode"
$currentNode }} {{end}} {{end}}
</ul>
{{ end }}
</li>
{{ end }}
{{ end }}
{{ end }} {{ end }}

View file

@ -1,4 +1,4 @@
{{ "<!-- footer -->" | safeHTML }}
<!-- footer -->
<footer class="section pb-4">
<div class="container">
<div class="row align-items-center">
@ -8,15 +8,22 @@
<div class="col-md-4 text-md-right text-center">
<ul class="list-inline">
{{ range .Site.Params.social }}
<li class="list-inline-item"><a class="text-color d-inline-block p-2" href="{{ .link | safeURL }}" aria-label="{{ .name }}"><i class="{{ .icon }}"></i></a></li>
<li class="list-inline-item">
<a
class="text-color d-inline-block p-2"
href="{{ .link | safeURL }}"
aria-label="{{ .name }}"
><i class="{{ .icon }}"></i
></a>
</li>
{{ end }}
</ul>
</div>
</div>
</div>
</footer>
{{ "<!-- /footer -->" | safeHTML }}
<!-- /footer -->
{{ "<!-- Main Script -->" | safeHTML }}
<!-- Main Script -->
{{ $script := resources.Get "js/script.js" | minify}}
<script src="{{ $script.Permalink }}"></script>

View file

@ -1,25 +1,37 @@
<head>
<meta charset="utf-8">
<meta charset="utf-8" />
<title>{{ .Title }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
{{ hugo.Generator }}
<meta name="description" content="{{ .Title }} - {{ .Site.Title }} ">
<meta name="description" content="{{ .Title }} - {{ .Site.Title }} " />
{{ "<!-- ** CSS Plugins Needed for the Project ** -->" | safeHTML }}
<!-- ** CSS Plugins Needed for the Project ** -->
<!-- Bootstrap -->
<link
rel="stylesheet"
href="{{ `plugins/bootstrap/bootstrap.min.css` | absURL }}"
/>
{{ "<!-- Bootstrap -->" | safeHTML }}
<link rel="stylesheet" href="{{ `plugins/bootstrap/bootstrap.min.css` | absURL }}">
<!-- themefy-icon -->
<link
rel="stylesheet"
href="{{ `plugins/themify-icons/themify-icons.css` | absURL }}"
/>
{{ "<!-- themefy-icon -->" | safeHTML }}
<link rel="stylesheet" href="{{ `plugins/themify-icons/themify-icons.css` | absURL }}">
<!--Favicon-->
<link
rel="icon"
href="{{ `images/favicon.png` | absURL }}"
type="image/x-icon"
/>
{{ "<!--Favicon-->" | safeHTML }}
<link rel="icon" href="{{ `images/favicon.png` | absURL }}" type="image/x-icon">
<!-- fonts -->
<link
href="https://fonts.googleapis.com/css?family={{replace .Site.Params.font_family ' ' '+' | title}}:300,400,700&display=swap"
rel="stylesheet"
/>
{{ "<!-- fonts -->" | safeHTML }}
<link href="https://fonts.googleapis.com/css?family={{replace .Site.Params.font_family ' ' '+' | title}}:300,400,700&display=swap" rel="stylesheet">
{{ "<!-- PDF.js -->" | safeHTML }}
<!-- PDF.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.9.359/pdf.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.3/html2pdf.bundle.js"></script>
@ -35,59 +47,59 @@
}
</style>
{{ "<!-- Main Stylesheet -->" | safeHTML }}
<!-- Main Stylesheet -->
{{ $css := resources.Get "css/style.css" | minify }}
<link href="{{ $css.Permalink }}" rel="stylesheet" media="screen" />
{{ "<!-- ** JS Plugins Needed for the Project ** -->" | safeHTML }}
{{ "<!-- jquiry -->" | safeHTML }}
<!-- ** JS Plugins Needed for the Project ** -->
<!-- jquiry -->
<script src="{{ `plugins/jquery/jquery-1.12.4.js` | absURL }}"></script>
{{ "<!-- jquary ui -->" | safeHTML }}
<!-- jquary ui -->
<script src="{{ `plugins/jquery/jquery-ui.js`| absURL }}"></script>
{{ "<!-- Bootstrap JS -->" | safeHTML }}
<!-- Bootstrap JS -->
<script src="{{ `plugins/bootstrap/bootstrap.min.js` | absURL }}"></script>
{{ "<!-- match-height JS -->" | safeHTML }}
<!-- match-height JS -->
<script src="{{ `plugins/match-height/jquery.matchHeight-min.js` | absURL }}"></script>
{{ template "_internal/google_analytics.html" . }}
{{ if templates.Exists ( printf "partials/overrides/header.html" ) }}
{{ partial "partials/overrides/header.html" . }}
{{ else }}
{{ "<!-- create /layouts/partials/overrides/header.html in your own theme or root directory to add your custom content here -->" | safeHTML }}
{{ template "_internal/google_analytics.html" . }} {{ if templates.Exists (
printf "partials/overrides/header.html" ) }} {{ partial
"partials/overrides/header.html" . }} {{ else }}
<!-- create /layouts/partials/overrides/header.html in your own theme or root directory to add your custom content here -->
{{ end }}
<!-- Open Graph image and Twitter Card metadata -->
{{ $image_path := .Params.image | default site.Params.image }}
{{ $image_path_local := printf "static/%s" $image_path }}
{{ $image_ext := trim (path.Ext $image_path | lower) "." }}
{{ if fileExists $image_path_local }}
{{ $image_path := .Params.image | default site.Params.image }} {{
$image_path_local := printf "static/%s" $image_path }} {{ $image_ext := trim
(path.Ext $image_path | lower) "." }} {{ if fileExists $image_path_local }}
<meta property="og:image" content="{{ $image_path | absURL }}" />
{{ if ne $image_ext "svg" }}
{{ with (imageConfig $image_path_local) }}
{{ if (and (gt .Width 144) (gt .Height 144)) }}
{{ if ne $image_ext "svg" }} {{ with (imageConfig $image_path_local) }} {{ if
(and (gt .Width 144) (gt .Height 144)) }}
<meta name="twitter:image" content="{{ $image_path | absURL }}" />
<meta name="twitter:card" content="summary{{ if (and (gt .Width 300) (gt .Height 157) (not (eq .Width .Height))) }}_large_image{{ end }}">
<meta
name="twitter:card"
content="summary{{ if (and (gt .Width 300) (gt .Height 157) (not (eq .Width .Height))) }}_large_image{{ end }}"
/>
{{ end }}
<meta property="og:image:width" content="{{ .Width }}">
<meta property="og:image:height" content="{{ .Height }}">
{{ end }}
{{ end }}
<meta property="og:image:type" content="image/{{ if eq $image_ext `svg` }}svg+xml{{ else }}{{ replaceRE `^jpg$` `jpeg` $image_ext }}{{ end }}">
<meta property="og:image:width" content="{{ .Width }}" />
<meta property="og:image:height" content="{{ .Height }}" />
{{ end }} {{ end }}
<meta
property="og:image:type"
content="image/{{ if eq $image_ext `svg` }}svg+xml{{ else }}{{ replaceRE `^jpg$` `jpeg` $image_ext }}{{ end }}"
/>
{{ end }}
<meta name="twitter:title" content="{{ .Title }}" />
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"/>
{{ with site.Social.twitter }}<meta name="twitter:site" content="@{{ . }}"/>{{ end }}
{{ range site.Authors }}
{{ with .twitter }}<meta name="twitter:creator" content="@{{ . }}"/>{{ end }}
{{ end }}
{{ template "_internal/opengraph.html" . }}
{{ template "_internal/twitter_cards.html" . }}
<meta
name="twitter:description"
content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"
/>
{{ with site.Social.twitter }}
<meta name="twitter:site" content="@{{ . }}" />
{{ end }} {{ range site.Authors }} {{ with .twitter }}
<meta name="twitter:creator" content="@{{ . }}" />
{{ end }} {{ end }} {{ template "_internal/opengraph.html" . }} {{ template
"_internal/twitter_cards.html" . }}
</head>