Skip to content

Commit

Permalink
chore: update pdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
neurosnap committed Jun 21, 2024
1 parent c6dec4b commit e44698d
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 98 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21.5

// replace github.com/picosh/pdocs => /home/erock/dev/pico/pdocs

require github.com/picosh/pdocs v0.0.0-20240605155503-8b60d6355244
require github.com/picosh/pdocs v0.0.0-20240621040056-5cbf57557db3

require (
github.com/alecthomas/chroma v0.10.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ github.com/picosh/pdocs v0.0.0-20240604041559-e4e457618a79 h1:ISjrO1HaL0cgFO7vJE
github.com/picosh/pdocs v0.0.0-20240604041559-e4e457618a79/go.mod h1:KXO3Z0EVdA811AX6mlK4lwFDT+KgmegRVrEmZU5uLXU=
github.com/picosh/pdocs v0.0.0-20240605155503-8b60d6355244 h1:5kqyTKIuLWGX9zZwOZoi+maEZEZLkq6QPLspUs8jUJE=
github.com/picosh/pdocs v0.0.0-20240605155503-8b60d6355244/go.mod h1:KXO3Z0EVdA811AX6mlK4lwFDT+KgmegRVrEmZU5uLXU=
github.com/picosh/pdocs v0.0.0-20240621040056-5cbf57557db3 h1:VuX6UzKt5bNir3itrMBiROmzZp8PEZJkbD7muwz5x2s=
github.com/picosh/pdocs v0.0.0-20240621040056-5cbf57557db3/go.mod h1:KXO3Z0EVdA811AX6mlK4lwFDT+KgmegRVrEmZU5uLXU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
75 changes: 4 additions & 71 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import (
"log/slog"

"github.com/picosh/pdocs"
)

Expand Down Expand Up @@ -36,22 +38,11 @@ func main() {
Text: "File uploads",
Href: "/file-uploads",
Page: pager("file-uploads.md"),
Children: []*pdocs.Sitemap{
pdocs.AnchorTagSitemap("How do I upload files"),
pdocs.AnchorTagSitemap("How do I update files"),
pdocs.AnchorTagSitemap("How do I delete files"),
pdocs.AnchorTagSitemap("How do I download files"),
},
},
{
Text: "UI",
Href: "/ui",
Page: pager("ui.md"),
Children: []*pdocs.Sitemap{
pdocs.AnchorTagSitemap("SSH TUI"),
pdocs.AnchorTagSitemap("Web UI"),
pdocs.AnchorTagSitemap("SSH Config"),
},
},
},
},
Expand All @@ -63,19 +54,6 @@ func main() {
Text: "Pages",
Href: "/pgs",
Page: pager("pgs.md"),
Children: []*pdocs.Sitemap{
pdocs.AnchorTagSitemap("CLI Reference"),
pdocs.AnchorTagSitemap("File denylist"),
pdocs.AnchorTagSitemap("Access Control List"),
pdocs.AnchorTagSitemap("Pretty URLs"),
pdocs.AnchorTagSitemap("Custom Domains"),
pdocs.AnchorTagSitemap("Custom Redirects and rewrites"),
pdocs.AnchorTagSitemap("Custom Headers"),
pdocs.AnchorTagSitemap("Single-Page Applications"),
pdocs.AnchorTagSitemap("Reserved Username Project"),
pdocs.AnchorTagSitemap("Content Security Policy"),
pdocs.AnchorTagSitemap("Does pages have a CDN or muilti-region support"),
},
},
{
Text: "Tuns",
Expand All @@ -86,36 +64,16 @@ func main() {
Text: "Prose",
Href: "/prose",
Page: pager("prose.md"),
Children: []*pdocs.Sitemap{
pdocs.AnchorTagSitemap("How are blogs structured"),
pdocs.AnchorTagSitemap("How can I customize my blog"),
pdocs.AnchorTagSitemap("How can I customize a blog post"),
pdocs.AnchorTagSitemap("Unlisted posts"),
pdocs.AnchorTagSitemap("How can I add a footer to all of my posts"),
pdocs.AnchorTagSitemap("How can I change the theme of my blog"),
pdocs.AnchorTagSitemap("How can I change the default 404 page"),
},
},
{
Text: "Pastes",
Href: "/pastes",
Page: pager("pastes.md"),
Children: []*pdocs.Sitemap{
pdocs.AnchorTagSitemap("Pipe Support"),
pdocs.AnchorTagSitemap("How do I set expiration date"),
pdocs.AnchorTagSitemap("How do I unlist a paste"),
},
},
{
Text: "RSS-To-Email",
Href: "/feeds",
Page: pager("feeds.md"),
Children: []*pdocs.Sitemap{
pdocs.AnchorTagSitemap("Digest interval options"),
pdocs.AnchorTagSitemap("Inline content"),
pdocs.AnchorTagSitemap("Can I create multiple email digests?"),
pdocs.AnchorTagSitemap("Can I fetch Reddit RSS feeds"),
},
},
{
Text: "Docker Registry",
Expand All @@ -132,20 +90,11 @@ func main() {
Text: "Custom domains",
Href: "/custom-domains",
Page: pager("custom-domains.md"),
Children: []*pdocs.Sitemap{
pdocs.AnchorTagSitemap("prose.sh"),
pdocs.AnchorTagSitemap("pgs.sh"),
pdocs.AnchorTagSitemap("My DNS does not support CNAME flattening"),
},
},
{
Text: "Images",
Href: "/images",
Page: pager("images.md"),
Children: []*pdocs.Sitemap{
pdocs.AnchorTagSitemap("What file types are supported"),
pdocs.AnchorTagSitemap("Image manipulation"),
},
},
{
Text: "API Tokens",
Expand All @@ -163,29 +112,11 @@ func main() {
Text: "FAQ",
Href: "/faq",
Page: pager("faq.md"),
Children: []*pdocs.Sitemap{
pdocs.AnchorTagSitemap("Why can't I login to pico"),
pdocs.AnchorTagSitemap("How do I force the correct pico SSH key"),
pdocs.AnchorTagSitemap("How do I generate an SSH key"),
pdocs.AnchorTagSitemap("How can I setup my ssh-agent"),
pdocs.AnchorTagSitemap("How can I use git to sync my content"),
pdocs.AnchorTagSitemap("Can I create multiple pico accounts"),
pdocs.AnchorTagSitemap("Can I associate multiple SSH keypairs to a single account"),
pdocs.AnchorTagSitemap("Are there any bandwidth limitations"),
pdocs.AnchorTagSitemap("How can I download a copy of all of my content"),
pdocs.AnchorTagSitemap("How can I delete my content"),
pdocs.AnchorTagSitemap("How can I delete my account with my content"),
pdocs.AnchorTagSitemap("I lost my SSH private key how can I recover my account"),
},
},
{
Text: "IRC",
Href: "/irc",
Page: pager("irc.md"),
Children: []*pdocs.Sitemap{
pdocs.AnchorTagSitemap("Realtime chat"),
pdocs.AnchorTagSitemap("Our public bouncer"),
},
},
},
},
Expand Down Expand Up @@ -249,7 +180,9 @@ func main() {
},
}

logger := slog.Default()
config := &pdocs.DocConfig{
Logger: logger,
Sitemap: sitemap,
Out: "./public",
Tmpl: "./tmpl",
Expand Down
9 changes: 7 additions & 2 deletions static/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@
}

.sidebar-list {
padding-left: 1rem;
padding: 0 0 0 1rem;
}

.sidebar-list li {
margin: 0 0 0.5rem 0;
}

@media only screen and (max-width: 800px) {
Expand Down Expand Up @@ -106,6 +110,7 @@
}

.sidebar-list {
padding-left: 0;
padding: 0 0 0 0.6rem;
margin: 0;
}
}
49 changes: 26 additions & 23 deletions tmpl/sitemap-footer.partial.tmpl
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
{{define "sitemap-footer"}}
<div class="sitemap text-sm mb-4">
<ul class="list-none">
{{range .Sitemap.Children -}}
{{if .Href}}
<li><a href="{{.GenHref}}" class="link-alt text-md">{{.Text}}</a></li>
{{else}}
<li class="text-md">{{.Text}}</li>
<ul class="list-none sidebar-list">
{{range .Sitemap.Children}}
{{if .Href}}
<li class="text-md">
{{if (eq $.Href .GenHref)}}
<a href="{{.GenHref}}" class="link-alt-hover">{{.Text}}</a>
{{else}}
<a href="{{.GenHref}}" class="link-alt">{{.Text}}</a>
{{end}}
</li>
{{else}}
<li class="text-md">{{.Text}}</li>
{{end}}

{{range .Children}}
<ul class="list-none sidebar-list">
<li>
{{if (eq $.Href .GenHref)}}
<a href="{{.GenHref}}" class="link-alt-hover">{{.Text}}</a>
{{else}}
<a href="{{.GenHref}}" class="link-alt">{{.Text}}</a>
{{end}}
</li>
</ul>
{{end}}
{{end}}
{{range .Children -}}
<ul class="list-none sidebar-list">
<li>
{{- if (and $.Prev (eq $.Prev.GenHref .GenHref)) -}}
<a href="{{.GenHref}}" class="link-alt-adj">{{.Text}}</a>
{{- else if (and $.Next (eq $.Next.GenHref .GenHref)) -}}
<a href="{{.GenHref}}" class="link-alt-adj">{{.Text}}</a>
{{- else if (eq $.Href .GenHref) -}}
<a href="{{.GenHref}}" class="link-alt-hover">{{.Text}}</a>
{{- else -}}
<a href="{{.GenHref}}" class="link-alt">{{.Text}}</a>
{{- end -}}
</li>
</ul>
{{- end}}
{{- end}}
</ul>
</ul>
</div>
{{end}}
3 changes: 2 additions & 1 deletion tmpl/toc.partial.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
{{range .Children -}}
<li>
<a href="{{.GenHref}}">{{.Text}}</a>

<ul class="list-disc" style="padding-left: 2rem;">
{{range .Children}}
<li>
<a href="{{.ParentHref}}{{.GenHref}}">{{.Text}}</a>
<a href="{{.GenHref}}">{{.Text}}</a>
</li>
{{end}}
</ul>
Expand Down

0 comments on commit e44698d

Please sign in to comment.