diff --git a/Makefile b/Makefile index 835cf080..2f034124 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,12 @@ DIRS_PUBLIC := $(patsubst $(CONTENT)/%, $(PUBLIC)/%, $(DIRS_CONTENT)) # Make any subdirectories needed in public $(foreach d, $(DIRS_PUBLIC), $(shell mkdir -p $(d))) -# Metaprogramming maddness +# Metaprogramming madness + +# MAKE_HTML exists so that a seperate rule for each supported extension does not have to exist. +# Instead, the template for such a rule for any valid extension is written here where it is thereby evaluated just below its definition. +# Basically, as long as a file type can actually be converted by pandoc into an HTML file, simply appending the proper extension to EXT will effectively introduce a rule supporting it. + define MAKE_HTML $(PUBLIC)/%.html: $(join $(CONTENT)/%, $(1)) @@ -62,19 +67,21 @@ $(PUBLIC)/%.html: $(join $(CONTENT)/%, $(1)) endef +# For every extension, scour the content folder for files which match, then run MAKE_HTML on all of them! ${info RULES: $(foreach i, $(EXT), $(call MAKE_HTML, $(i)))} $(foreach i, $(EXT), $(eval $(call MAKE_HTML, $(i)))) - - +# Build website all: $(HTMLFILES) @echo -e "FILES: $(FILES) \nHTML: $(HTMLFILES)" rsync -avzh $(CONTENT)/static/ $(PUBLIC)/static $(foreach s, $(SCRIPTS), $(shell $(s) $(HTMLFILES))) +# Clean build folder clean: rm -rf $(PUBLIC) +# Build website, then run locally for testing. demo: all python -m http.server -d public/ -b 127.0.0.1 8080 diff --git a/content/index.org b/content/index.org index 56051ede..a0ae50f6 100644 --- a/content/index.org +++ b/content/index.org @@ -1,4 +1,4 @@ -#+title: Linux User's Group @ UIC +#+title: Linux User Group @ UIC #+AUTHOR: Soham S Gumaste #+OPTIONS: toc:nil diff --git a/content/opsec.md b/content/opsec.md index 4637f90c..70f8dc77 100644 --- a/content/opsec.md +++ b/content/opsec.md @@ -1,3 +1,8 @@ +--- +author: Kevin Cordero +date: March 12th, 2025 +title: "Threat Modeling 101: Intro to Operational Security" +--- # Metadata This is the markdown transcript for a presentation held on Tuesday, March 12th. diff --git a/content/vimlab.md b/content/vimlab.md index 32873d9d..7854e4fa 100644 --- a/content/vimlab.md +++ b/content/vimlab.md @@ -2,7 +2,7 @@ author: - Ethan Wong date: October 13, 2023 -title: Vim +title: VimLab Fall 2023 --- # Metadata diff --git a/scripts/sitemap.sh b/scripts/sitemap.sh index 84c0d273..457e8913 100755 --- a/scripts/sitemap.sh +++ b/scripts/sitemap.sh @@ -1,14 +1,33 @@ #!/usr/bin/env bash +# Verbose set -xeu +# Variable to collect all the markdown links into +# Format: [Article Title](Article Link) LINKS=$"" for files in $(echo "$@" | tr ' ' '\n' | sort -V); do - F="${files#public/}"; - TMP="" - printf -v TMP "[${F%.html}]($F) \n" - LINKS="${LINKS}${TMP}" + # Parameter Expansion; Remove 'public/' from filename and store into variable F + F="${files#public/}" + # "TMP" stores the current markdown link to be appended to the list + TMP="" + + # Title extraction from HTML. Operates on assumption that each webpage has a title meta tag. + + # find title meta tag with awk + TITLE="$(awk '// {print $0}' $files)" + # abuses awk reformatting - just removes trailing & leading whitespace :) + TITLE="$(echo $TITLE | awk '{$1=$1};1')" + # parameter expansion again, remove title html tags + # e.g. <title>My Title becomes "My Title" + TITLE=${TITLE#} + TITLE=${TITLE%} + + # Store current markdown link with newline in TMP + printf -v TMP "[$TITLE]($F) \n" + # Append TMP to list + LINKS="${LINKS}${TMP}" done - -pandoc -s --template template.html --metadata-file metadata.yml --metadata-file sitemap.yml -o public/sitemap.html <<< "${LINKS}" + +pandoc -s --template template.html --metadata-file metadata.yml --metadata-file sitemap.yml -o public/sitemap.html <<<"${LINKS}"