Compare commits

...

14 Commits
v0.1.0 ... main

17 changed files with 145 additions and 39 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
resources/
# If you clone nwt-docs here
docs/

View File

@ -13,7 +13,7 @@ Discuss on the above spaces and open a [ticket here](https://todo.sr.ht/~earnest
## Patches
Patches for docs only should be done against [nwt-docs](https://git.sr.ht/~earnestma/nwt-docs). Otherwise, if you adding a new feature or documentation, modify `docs/` in the main repo at the same time.
If you adding a new feature or documentation, please remember to also send a patch against [nwt-docs](https://git.sr.ht/~earnestma/nwt-docs).
If you need more help sending patches, you may take a look at [this guide](https://git-send-email.io/).

View File

@ -10,7 +10,7 @@ A Hugo theme for your digital garden, notes, or wiki. Inspired by <http://wiki.x
### Installing and usage
See `docs/` directory or the [online manual](https://man.sr.ht/~earnestma/nwt). The online manual sources are available as Markdown in [this git repository](https://git.sr.ht/~earnestma/nwt-docs).
See the [online manual](https://man.sr.ht/~earnestma/nwt). The online manual sources are also available as Markdown in [this git repository](https://git.sr.ht/~earnestma/nwt-docs).
## Contributing

View File

@ -491,3 +491,28 @@ pre code {
text-decoration: none;
padding: 1 5px;
}
/* Open and close the collapsible content button */
.collapsible {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
}
.active, .collapsible:hover {
background-color: #ccc;
}
/* Style the collapsible content. Note: hidden by default */
.collapsible_content {
padding: 0 18px;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
}

14
assets/js/collapsible.js Normal file
View File

@ -0,0 +1,14 @@
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.maxHeight){
content.style.maxHeight = null;
} else {
content.style.maxHeight = content.scrollHeight + "px";
}
});
}

28
assets/js/new-tabs.js Normal file
View File

@ -0,0 +1,28 @@
// https://hugocodex.org/add-ons/new-window-fix
//open external links in a new window
function external_new_window() {
for(var c = document.getElementsByTagName("a"), a = 0;a < c.length;a++) {
var b = c[a];
if(b.getAttribute("href") && b.hostname !== location.hostname) {
b.target = "_blank";
b.rel = "noopener";
}
}
}
//open PDF links in a new window
function pdf_new_window ()
{
if (!document.getElementsByTagName) return false;
var links = document.getElementsByTagName("a");
for (var eleLink=0; eleLink < links.length; eleLink ++) {
if ((links[eleLink].href.indexOf('.pdf') !== -1)||(links[eleLink].href.indexOf('.doc') !== -1)||(links[eleLink].href.indexOf('.docx') !== -1)) {
links[eleLink].onclick =
function() {
window.open(this.href);
return false;
}
}
}
}
pdf_new_window();
external_new_window();

4
config.toml Normal file
View File

@ -0,0 +1,4 @@
[module.hugoVersion]
extended = true
min = '0.80.0'
# max = ''

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module git.sr.ht/~earnestma/nwt
go 1.16

View File

@ -1,12 +1,19 @@
<!DOCTYPE html>
<html>
{{- partial "head.html" . }}
{{ partial "head-custom.html" . -}}
<body>
<header>{{ partial "header.html" . }}</header>
<div id="content">
{{- block "main" . }}{{- end }}
</div>
<footer>{{ partial "footer.html" . -}}</footer>
</body>
</html>
{{- partial "head.html" . }}
{{ partial "head-custom.html" . -}}
<body>
<header>{{ partial "header.html" . }}</header>
<div id="content">
{{- block "main" . }}{{- end }}
{{ partial "docscomments.html" . }}
</div>
<footer>{{ partial "footer.html" . -}}</footer>
{{- $newtabjs := resources.Get "/js/new-tabs.js" | js.Build "/js/new-tabs.js" | minify | fingerprint }}
<script src="{{ $newtabjs.Permalink }}"></script>
</body>
</html>

View File

@ -1,24 +1,16 @@
{{ define "main" }}
<h2>{{ .Title }}</h2>
{{ if eq .Title "Wiki Index" }}
{{ if eq .Title "Index" }}
<ul>
{{ range .Pages }}
<li>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</li>
<li>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>
{{ else }}
<h3>Subpages:</h3>
<ul>
<li><a href="..">Go back</a></li>
{{ range .Pages }}
<li>
<a href="{{ .Permalink }}">{{ .Title }}</a> <br>
</li>
{{ end }}
</ul>
{{ partial "pageslist.html" . }}
{{ end }}
<hr>
@ -31,4 +23,4 @@
{{ .Content }}
{{ end }}
{{ end }}

View File

@ -1,13 +1,11 @@
{{ define "main" }}
<h3>Subpages:</h3>
<ul>
{{ range .Pages }}
<li>
<a href="{{ .Permalink }}">{{ .Title }}</a> <br>
</li>
{{ end }}
</ul>
{{ partial "pageslist.html" . }}
<hr>
<h2>{{ .Title }}</h2>
{{ if $.Params.enabletoc }}
<div class="toc">
{{ .Page.TableOfContents }}
</div>
{{ end }}
{{ .Content }}
{{ end }}

View File

@ -1,3 +1,3 @@
{{ define "main" }}
{{ .Content }}
{{ .Content }}
{{ end }}

View File

@ -0,0 +1 @@
<p>You weren't expecting to see this! Set up your own copy of layouts/partials/docscomments-content.html with the code you want.</p>

View File

@ -0,0 +1,16 @@
{{ if not .Site.Params.disableDocsComments }}
{{ if not .Page.Params.disableDocsComments }}
{{ if hugo.IsProduction }}
<button type="button" class="collapsible">Expand</button>
<div class="collapsible_content">
{{ partial "docscomments-content.html" . }}
</div>
{{- $collapsiblejs := resources.Get "/js/collapsible.js" | js.Build "/js/collapsible.js" | minify | fingerprint }}
<script src="{{ $collapsiblejs.Permalink }}"></script>
{{ else }}
<p>Enable HUGO_ENV=production to see.</p>
{{ end }}
{{ end }}
{{ end }}

View File

@ -1,6 +1,12 @@
<p>{{ .Site.Copyright }}</p>
<p>
Last updated: {{ .Lastmod.Format "January 2, 2006" }}
{{ with .GitInfo }}<a href="{{$.Site.Params.GitRepo}}/commit/{{ .Hash }}">
{{ .Subject }} ({{ .AbbreviatedHash }})</a>
{{ end }}</p>
<nav>
{{ range .Site.Menus.main }}
{{ range .Site.Menus.footer }}
<a href="{{ .URL }}">{{ .Name }}</a>
{{ end }}
</nav>

View File

@ -1,4 +1,4 @@
<a href="{{ " /" | relURL }}">
<a href="{{ "/" | relURL }}">
<h2>{{ .Site.Title }}</h2>
</a>
<nav>

View File

@ -0,0 +1,8 @@
<ul>
<li><a href="..">Go back</a></li>
{{ range .Pages }}
<li>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>