From 6a351ac15e3604b94e39cde39eb63de421a7e0ef Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Sat, 2 Aug 2025 20:39:08 +0200 Subject: Added makext --- Makefile | 14 +++++++---- content/pages/projects.fossil.md.part | 6 ++--- content/pages/projects.github.md.part | 2 +- content/pages/projects.md | 10 ++++---- makext.mk | 46 ++++++++++++++++++++++++++++++++++ static/projects/xmagnify.fossil | Bin 225280 -> 225280 bytes templates/page-no-title.html | 10 ++++++++ tools/fossil-projects.sh | 6 ++--- tools/github-projects.py | 2 +- 9 files changed, 77 insertions(+), 19 deletions(-) create mode 100644 makext.mk create mode 100644 templates/page-no-title.html diff --git a/Makefile b/Makefile index d0add7d..a76e77e 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,11 @@ +include makext.mk + +help: .help + MAKEFLAGS+=-j2 PROJECTS_FILENAME = content/pages/projects.md -dev: watch server +dev: watch server # Starts a development server watch: find . -type f \( -name "*.html" -o -name "*.js" -o -name "*.md" -o -name "*.yaml" -o -name "*.css" -o -name "*.xml" \) | entr jbmafp -b @@ -9,7 +13,7 @@ watch: server: jbmafp -s -update-projects: projects-header +update-projects: projects-header # Update projects page cat content/pages/projects.fossil.md.part \ content/pages/projects.github.md.part >> \ content/pages/projects.md @@ -19,12 +23,12 @@ projects-header: echo "title: Personal projects" >> $(PROJECTS_FILENAME) echo "date: 2024-10-21T12:00:00+02:00" >> $(PROJECTS_FILENAME) echo "url: projects.html" >> $(PROJECTS_FILENAME) - echo "type: page" >> $(PROJECTS_FILENAME) + echo "type: page-no-title" >> $(PROJECTS_FILENAME) echo "draft: false" >> $(PROJECTS_FILENAME) echo "---\n" >> $(PROJECTS_FILENAME) -update-fossil: +update-fossil: # Update Fossil projects cd tools && bash fossil-projects.sh -update-github: +update-github: # Update GitHub projects cd tools && python github-projects.py diff --git a/content/pages/projects.fossil.md.part b/content/pages/projects.fossil.md.part index 796af87..1813dab 100644 --- a/content/pages/projects.fossil.md.part +++ b/content/pages/projects.fossil.md.part @@ -1,4 +1,4 @@ -## Fossil repositories +# Fossil repositories -- [pats.fossil](/projects/pats.fossil)
Size: 220K, Modified: 2025-08-02 20:24:05 -- [xmagnify.fossil](/projects/xmagnify.fossil)
Size: 220K, Modified: 2025-08-02 20:24:05 +- [pats.fossil](/projects/pats.fossil)
Size: 220K, Modified: 2025-08-02 20:30:23 +- [xmagnify.fossil](/projects/xmagnify.fossil)
Size: 220K, Modified: 2025-08-02 20:37:02 diff --git a/content/pages/projects.github.md.part b/content/pages/projects.github.md.part index 92a8c74..bdc56f7 100644 --- a/content/pages/projects.github.md.part +++ b/content/pages/projects.github.md.part @@ -1,6 +1,6 @@ -## GitHub repositories +# GitHub repositories
diff --git a/content/pages/projects.md b/content/pages/projects.md index cc10185..cabde1d 100644 --- a/content/pages/projects.md +++ b/content/pages/projects.md @@ -2,17 +2,17 @@ title: Personal projects date: 2024-10-21T12:00:00+02:00 url: projects.html -type: page +type: page-no-title draft: false --- -## Fossil repositories +# Fossil repositories -- [pats.fossil](/projects/pats.fossil)
Size: 220K, Modified: 2025-08-02 20:21:40 -- [xmagnify.fossil](/projects/xmagnify.fossil)
Size: 220K, Modified: 2025-08-02 20:21:40 +- [pats.fossil](/projects/pats.fossil)
Size: 220K, Modified: 2025-08-02 20:30:23 +- [xmagnify.fossil](/projects/xmagnify.fossil)
Size: 220K, Modified: 2025-08-02 20:37:02 -## GitHub repositories +# GitHub repositories
diff --git a/makext.mk b/makext.mk new file mode 100644 index 0000000..bbfa148 --- /dev/null +++ b/makext.mk @@ -0,0 +1,46 @@ +# Makext is a collection of useful extensions for Makefiles, aimed at +# simplifying and enhancing the functionality of Make-based projects. These +# extensions provide additional features and convenience functions to +# improve the build process, manage dependencies, and streamline common +# tasks. +# +# Visit the GitHub repository at https://github.com/mitjafelicijan/makext +# to learn more and contribute to the project. +# +# `makext` was written by Mitja Felicijan and is released under the BSD +# two-clause license, see the LICENSE file for more information. + +# Load environmental files from `MEX_ENVIRONMENT`. By default GNU make +# loads what is already in `env`. This extends it to other files. +ifdef MEX_ENVIRONMENT +TEMP_ENV_FILES=$(shell echo $(MEX_ENVIRONMENT) | tr ',' ' ') +$(foreach file,$(TEMP_ENV_FILES),$(eval include $(file))) +endif + +# Help extension that lists all the targets with descriptions +# and adds description and license information if data provided. +.PHONY: .help +.help: +ifdef MEX_DESCRIPTION + @printf "%s\n\n" $(MEX_DESCRIPTION) | fmt +endif + @echo "Targets:" + @grep -vE '^[[:space:]]' $(MAKEFILE_LIST) | grep -E '^.*:.* #' | sed -E 's/(.*):(.*):.*#(.*)/ \2###\3/' | column -t -s '###' +ifdef MEX_LICENSE + @printf "\n%s" $(MEX_LICENSE) | fmt +endif + +# Checks `MEX_ASSURE` variable if all the programs declared actually +# exist on a machine. If not this exists make with error. +.PHONY: .assure +.assure: +ifndef MEX_ASSURE + @printf "Variable MEX_ASSURE is not defined. Can not check for programs.\n" +else + @for prog in $(shell echo $(MEX_ASSURE)); do \ + if ! which $$prog > /dev/null; then \ + echo "Error: '$$prog' not found on this machine."; \ + exit 1; \ + fi; \ + done +endif diff --git a/static/projects/xmagnify.fossil b/static/projects/xmagnify.fossil index 258d27d..a68e892 100644 Binary files a/static/projects/xmagnify.fossil and b/static/projects/xmagnify.fossil differ diff --git a/templates/page-no-title.html b/templates/page-no-title.html new file mode 100644 index 0000000..16ca10d --- /dev/null +++ b/templates/page-no-title.html @@ -0,0 +1,10 @@ +{{ template "base.html" . }} + +{{ define "title" }}{{ .Page.Title }}{{ end }} +{{ define "description" }}{{ .Page.Summary }}{{ end }} + +{{ define "content" }} +
+
{{ .Page.HTML }}
+
+{{ end }} diff --git a/tools/fossil-projects.sh b/tools/fossil-projects.sh index bb6e673..a87be94 100644 --- a/tools/fossil-projects.sh +++ b/tools/fossil-projects.sh @@ -1,11 +1,9 @@ -set -xe - OUT=../content/pages/projects.fossil.md.part -echo -e "## Fossil repositories\n" > $OUT +echo -e "# Fossil repositories\n" > $OUT find ~/Projects/ -type f -name "*.fossil" -not -path "*/website/*" | while read -r file; do - cp $file ../static/projects/ + rsync -uv $file ../static/projects/ done find ../static/projects/ -type f -name "*.fossil" | while read -r file; do diff --git a/tools/github-projects.py b/tools/github-projects.py index e2afe95..ff890f6 100644 --- a/tools/github-projects.py +++ b/tools/github-projects.py @@ -16,7 +16,7 @@ def generate_markdown_file(include_repositories): file = open("../content/pages/projects.github.md.part", "w") file.write(DOUBLE_NL) - file.write("## GitHub repositories") + file.write("# GitHub repositories") file.write(DOUBLE_NL) file.write("
") -- cgit v1.2.3