Merge pull request #5 from SqrtMinusOne/more-pages

More pages
This commit is contained in:
Pavel Korytov 2024-01-04 22:10:39 +03:00 committed by GitHub
commit 98978673ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 258 additions and 57 deletions

5
.gitignore vendored
View file

@ -1,8 +1,13 @@
org/configs/** org/configs/**
!org/configs/.gitkeep !org/configs/.gitkeep
org/packages/**
!org/packages/.gitkeep
/_data/ /_data/
/__data/ /__data/
/public/ /public/
resources/_gen resources/_gen
/content/configs/ /content/configs/
/.log/ /.log/
/.hugo_build.lock
/content/packages/
/static/*-img/

39
.gitmodules vendored
View file

@ -1,3 +1,42 @@
[submodule "repos/dotfiles"] [submodule "repos/dotfiles"]
path = repos/dotfiles path = repos/dotfiles
url = https://github.com/SqrtMinusOne/dotfiles.git url = https://github.com/SqrtMinusOne/dotfiles.git
[submodule "repos/lyrics-fetcher"]
path = repos/lyrics-fetcher
url = https://github.com/SqrtMinusOne/lyrics-fetcher.el.git
[submodule "repos/elfeed-summary"]
path = repos/elfeed-summary
url = git@github.com:SqrtMinusOne/elfeed-summary.git
[submodule "repos/org-journal-tags"]
path = repos/org-journal-tags
url = git@github.com:SqrtMinusOne/org-journal-tags.git
[submodule "repos/elfeed-sync"]
path = repos/elfeed-sync
url = git@github.com:SqrtMinusOne/elfeed-sync.git
[submodule "repos/password-store-ivy"]
path = repos/password-store-ivy
url = git@github.com:SqrtMinusOne/password-store-ivy.git
[submodule "repos/biome"]
path = repos/biome
url = git@github.com:SqrtMinusOne/biome.git
[submodule "repos/org-clock-agg"]
path = repos/org-clock-agg
url = git@github.com:SqrtMinusOne/org-clock-agg.git
[submodule "repos/avy-dired"]
path = repos/avy-dired
url = git@github.com:SqrtMinusOne/avy-dired.git
[submodule "repos/pomm"]
path = repos/pomm
url = git@github.com:SqrtMinusOne/pomm.el.git
[submodule "repos/micromamba"]
path = repos/micromamba
url = git@github.com:SqrtMinusOne/micromamba.el.git
[submodule "repos/reverso"]
path = repos/reverso
url = git@github.com:SqrtMinusOne/reverso.el.git
[submodule "repos/perspective-exwm"]
path = repos/perspective-exwm
url = git@github.com:SqrtMinusOne/perspective-exwm.el.git
[submodule "repos/exwm-modeline"]
path = repos/exwm-modeline
url = git@github.com:SqrtMinusOne/exwm-modeline.git

View file

@ -177,6 +177,9 @@ $toc-left-width: $toc-width + $max-width + 25px;
margin: $y-medium auto; margin: $y-medium auto;
max-width: 100%; max-width: 100%;
} }
a > img {
margin: $y-medium 4px $y-medium 0px !important;
}
.avatar > img { .avatar > img {
border-radius: 50%; border-radius: 50%;
float: right; float: right;

View file

@ -33,6 +33,9 @@ staticDir = ["static"]
name = "Posts" name = "Posts"
url = "/posts/" url = "/posts/"
weight = 1 weight = 1
[[menu.main]]
name = "Emacs packages"
url = "/emacs-packages/"
[[menu.main]] [[menu.main]]
name = "Configs" name = "Configs"
url = "/configs/readme" url = "/configs/readme"

View file

@ -0,0 +1,8 @@
+++
title = "My Emacs packages"
author = ["Pavel Korytov"]
draft = false
norss = true
+++
- [Lyrics Fetcher](/packages/lyrics-fetcher)

View file

@ -6,6 +6,8 @@
{{- else -}} {{- else -}}
{{- $pages = $pctx.Pages -}} {{- $pages = $pctx.Pages -}}
{{- end -}} {{- end -}}
{{- $pages = where $pages "Section" "!=" "configs" -}}
{{- $pages = where $pages ".Params.norss" "!=" "true" -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}} {{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}} {{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}} {{- $pages = $pages | first $limit -}}
@ -25,7 +27,7 @@
{{- with .OutputFormats.Get "RSS" -}} {{- with .OutputFormats.Get "RSS" -}}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end -}} {{- end -}}
{{ range where $pages "Section" "!=" "configs" }} {{ range $pages }}
<item> <item>
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>

View file

@ -0,0 +1,41 @@
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "RSS" -}}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end -}}
{{ range where $pages "Section" "!=" "configs" }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
<content type="html">
{{ .Content | html }}
</content>
</item>
{{ end }}
</channel>
</rss>

View file

@ -0,0 +1,28 @@
{{ define "main" }}
<script defer language="javascript" type="text/javascript" src="{{ "/js/dynamic-toc.js" | urlize | relURL }}"></script>
<div class="root">
<h1 id="title-small-screen">
{{ .Title }}
{{ if .Params.repo }}
<iframe src="https://ghbtns.com/github-btn.html?user=SqrtMinusOne&repo={{ .Params.repo }}&type=star&count=true" frameborder="0" scrolling="0" width="150" height="20" title="GitHub"></iframe>
{{ end }}
</h1>
<div class="container" id="actual-content">
<h1 id="title-large-screen" class="dotfiles-title">
{{ .Title }}
{{ if .Params.repo }}
<iframe src="https://ghbtns.com/github-btn.html?user=SqrtMinusOne&repo={{ .Params.repo }}&type=star&count=true" frameborder="0" scrolling="0" width="150" height="20" title="GitHub"></iframe>
{{ end }}
</h1>
{{ .Content }}
</div>
<div class="table-of-contents">
<div class="table-of-contents-text">
<b><a href="#">Table of Contents</a></b>
{{ .TableOfContents }}
</div>
<a id="unhide-all-button" class="hidden">&lt;Expand&gt;</a>
<a id="hide-all-button" class="hidden">&lt;Collapse&gt;</a>
</div>
</div>
{{ end }}

0
org/packages/.gitkeep Normal file
View file

View file

@ -0,0 +1,6 @@
#+HUGO_BASE_DIR: ../..
#+HUGO_SECTION:
#+TITLE: My Emacs packages
#+HUGO_CUSTOM_FRONT_MATTER: :norss true
- [[/packages/lyrics-fetcher][Lyrics Fetcher]]

1
repos/avy-dired Submodule

@ -0,0 +1 @@
Subproject commit 01abcc027bf49b8c5516b70da63ac79e8b4ecc58

1
repos/biome Submodule

@ -0,0 +1 @@
Subproject commit 599a55fa20a7ba38c3aead07e0af7b7b02902dfa

@ -1 +1 @@
Subproject commit f12737bb44edafecec2b79b8d9a70d5ed1a1ff99 Subproject commit bea3dd52b4c7d5083502aeab4335e3900ec5ec4e

1
repos/elfeed-summary Submodule

@ -0,0 +1 @@
Subproject commit efa30b88d7f048a2df4958e59da8002ebd2dbb29

1
repos/elfeed-sync Submodule

@ -0,0 +1 @@
Subproject commit 7fb24f88f71f5e08208b75a001c50a6066a025af

1
repos/exwm-modeline Submodule

@ -0,0 +1 @@
Subproject commit f72e65818f90c754edb8d0dcff47e8248a7f0a56

1
repos/lyrics-fetcher Submodule

@ -0,0 +1 @@
Subproject commit bcde34a7ae8db84170bfe76260eefed64686ddf0

1
repos/micromamba Submodule

@ -0,0 +1 @@
Subproject commit cd3ce4b7142790f25f20e5cfd6ed5ebbf4498c6c

1
repos/org-clock-agg Submodule

@ -0,0 +1 @@
Subproject commit 4cc610315bdc4a656682ded736a6c5345108267f

@ -0,0 +1 @@
Subproject commit c9dba4817f098281139c85db5b1bcbf79edc419b

@ -0,0 +1 @@
Subproject commit 60a2862cb827672de18619cd8e3239e0f146e55d

@ -0,0 +1 @@
Subproject commit 68fb0ca2d482e0f4a92c4ceb19bf2262ea937e95

1
repos/pomm Submodule

@ -0,0 +1 @@
Subproject commit a717c3a05352cb8a233a5b4330186ead077746ba

1
repos/reverso Submodule

@ -0,0 +1 @@
Subproject commit 47812d7738047277e2ab365c45a9512e8258422c

View file

@ -1,10 +1,8 @@
;; -*- lexical-binding: t; -*-
(require 'package) (require 'package)
(require 'vc) (require 'vc)
(require 'files) (require 'files)
(message (concat (vc-find-root default-directory ".git") "org/configs"))
(cd (concat (vc-find-root default-directory ".git") "org/configs"))
(setq package-user-dir (expand-file-name "./.packages")) (setq package-user-dir (expand-file-name "./.packages"))
(setq package-archives '(("melpa" . "https://melpa.org/packages/") (setq package-archives '(("melpa" . "https://melpa.org/packages/")
@ -15,22 +13,11 @@
(unless package-archive-contents (unless package-archive-contents
(package-refresh-contents)) (package-refresh-contents))
(setq package-user-dir (expand-file-name "./.packages"))
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
("elpa" . "https://elpa.gnu.org/packages/")))
(unless (package-installed-p 'use-package) (unless (package-installed-p 'use-package)
(package-install 'use-package)) (package-install 'use-package))
(require 'use-package) (require 'use-package)
(use-package ox-hugo ;; Org Hugo
:ensure t)
(use-package org-make-toc
:ensure t)
(setq org-make-toc-link-type-fn #'org-make-toc--link-entry-org)
(defvar-local my/org-hugo-heading-slugs nil) (defvar-local my/org-hugo-heading-slugs nil)
@ -60,40 +47,45 @@
(puthash slug t my/org-hugo-heading-slugs)) (puthash slug t my/org-hugo-heading-slugs))
slug)) slug))
(setq org-hugo-anchor-functions '(org-hugo-get-page-or-bundle-name (use-package ox-hugo
:ensure t
:config
(setq org-hugo-anchor-functions '(org-hugo-get-page-or-bundle-name
org-hugo-get-custom-id org-hugo-get-custom-id
my/org-hugo-get-heading-slug my/org-hugo-get-heading-slug
org-hugo-get-md5)) org-hugo-get-md5))
(setq org-hugo-base-dir (vc-find-root default-directory ".git")))
(setq org-hugo-section "configs") ;; Org Make TOC
(setq org-hugo-base-dir (vc-find-root default-directory ".git"))
;; (setq org-hugo-export-with-toc 6) (use-package org-make-toc
:ensure t
(setq my/config-files '("README.org" :config
"Emacs.org" (setq org-make-toc-link-type-fn #'org-make-toc--link-entry-org))
"Desktop.org"
"Console.org"
"Mail.org"
"Guix.org"))
(dolist (file my/config-files) ;; Export dotfiles
(setq my/config-files
'("README.org" "Emacs.org" "Desktop.org" "Console.org" "Mail.org" "Guix.org"))
(defun my/export-dotfiles ()
(cd (concat (vc-find-root default-directory ".git") "org/configs"))
(dolist (file my/config-files)
(copy-file (expand-file-name (copy-file (expand-file-name
(format "%s/repos/dotfiles/%s" (format "%s/repos/dotfiles/%s"
(vc-find-root default-directory ".git") (vc-find-root default-directory ".git")
file)) file))
file 'overwrite)) file 'overwrite))
(copy-directory
(copy-directory
(expand-file-name (expand-file-name
(format "%s/repos/dotfiles/dot-imgs/" (format "%s/repos/dotfiles/dot-imgs/"
(vc-find-root default-directory ".git"))) (vc-find-root default-directory ".git")))
"dot-imgs" t t) "dot-imgs" t t)
(dolist (file my/config-files)
(dolist (file my/config-files)
(with-temp-buffer (with-temp-buffer
(org-mode) (let ((org-mode-hook nil) (text-mode-hook nil))
(org-mode))
(insert-file-contents file) (insert-file-contents file)
(unless (string-equal file "README.org") (unless (string-equal file "README.org")
(org-make-toc)) (org-make-toc))
@ -105,4 +97,65 @@
(replace-string ":noweb yes" ":noweb no-export" nil (point-min) (point-max)) (replace-string ":noweb yes" ":noweb no-export" nil (point-min) (point-max))
(setq-local buffer-file-name file) (setq-local buffer-file-name file)
(message "Publish %s" file) (message "Publish %s" file)
(org-hugo-export-to-md))) (let ((org-hugo-section "configs")
(org-mode-hook nil)
(text-mode-hook nil))
(org-hugo-export-to-md)))))
;; Export packages
(setq my/emacs-packages
'("lyrics-fetcher"
"pomm"
"elfeed-summary"
"exwm-modeline"
"perspective-exwm"
"org-journal-tags"
"elfeed-sync"
"password-store-ivy"
"avy-dired"
"reverso"
"micromamba"
"biome"
"org-clock-agg"))
(defun my/export-packages ()
(cd (concat (vc-find-root default-directory ".git") "org/packages"))
(let ((root (vc-find-root default-directory ".git")))
(dolist (package my/emacs-packages)
(copy-file
(expand-file-name
(format "%s/repos/%s/README.org" root package))
(format "./%s.org" package) 'overwrite)
(when (file-directory-p (format "%s/repos/%s/img" root package))
(copy-directory
(expand-file-name
(format "%s/repos/%s/img" root package))
(format "./static/%s-img" package) t t))
(with-current-buffer (generate-new-buffer "tmp")
(insert-file-contents (format "./%s.org" package))
(goto-char (point-min))
(insert
"#+HUGO_CUSTOM_FRONT_MATTER: :repo "
(let ((default-directory (format "%s/repos/%s/" root package)))
(string-trim
(shell-command-to-string
"git remote get-url origin | sed 's/.*SqrtMinusOne\\/\\(.*\\)\\.git/\\1/'")))
"\n")
(when-let
(published-at
(with-temp-buffer
(insert-file-contents (format "%s/repos/%s/%s.el" root package package))
(goto-char (point-min))
(when (re-search-forward (rx bol ";; Published-At:" (0+ space) (group (1+ nonl))) nil t)
(substring-no-properties
(match-string 1)))))
(insert
"#+DATE: " published-at "\n"))
(replace-string
"./img/" (format "./static/%s-img/" package) nil (point-min) (point-max))
(setq-local buffer-file-name (format "./%s.org" package))
(message "Publish %s" package)
(let ((org-hugo-section "packages")
(org-mode-hook nil)
(text-mode-hook nil))
(org-hugo-export-to-md))))))