From: Kyle Bowman Date: Sun, 29 Sep 2024 13:50:14 +0000 (-0400) Subject: chore: Add todo and scripts dir. X-Git-Url: https://git.rocketbowman.com/?a=commitdiff_plain;h=a1630536c50679136c11de534308b6014c02a4ff;p=jetsam.git chore: Add todo and scripts dir. --- diff --git a/README.md b/README.md index f875680..e50c9b7 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,12 @@ markdown files are in the directory, even if they are in a separate ## Building -`make all` builds all the HTML from the Markdown. -`./index.sh` builds the index based on content from build directory. +* `make all` builds all the HTML from the Markdown. +* `./scripts/index.sh > build/all.html` builds the index that is based on +content from the build directory. + +Note: There is some significant hardcoding in the script that assumes that +the `all.html` file is in the `build` directory. # Common Errors diff --git a/index.sh b/index.sh deleted file mode 100755 index 263d8b1..0000000 --- a/index.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -############# -# CONSTANTS # -############# -BUILD_DIR="build" - -############# -# FUNCTIONS # -############# - -get_title() { - grep -oP '(?<=).*?(?=)' "$1" -} - # DESC: Gets the text between the tags of an HTML file. - # $1: Path to HTML file - -make_a() { - local path - path="$(echo "$1" | cut -d '/' -f2- )" - printf "<a href=\"%s\">%s</a>\n" "$path" "$(get_title "$1")" -} - # DESC: Writes an HTML anchor based on a built HTML file - # $1: Path to HTML file - # NOTE: Cut build/ from the path b/c the path needs to be relative - # and the the file we are creating will go into the build dir. - -make_li(){ - printf "<li>%s</li>\n" "$1" -} - -make_ul() { - echo "<ul>" - for item in $1; do - make_li "$(make_a "$item")" - done - echo "</ul>" -} - # DESC: Adds <ul> tags around a list of links. - # $1: A list of items that have <li> - -make_boilerplate(){ - printf \ -"<!DOCTYPE html> -<html> - <head> - <meta content=\"text/html; charset=utf-8\" http-equiv=\"content-type\"> - <title>Pages in Build - - - - - -
-

Pages in Build

- %s -
- -" "$1" -} - # DESC: Defines the template and injects the body. - # $1: The body of the HTML to add. - # NOTE: The CSS for index is one level higher b/c I'm dumping into - # the build directory rather than one of its subdirectories. - - -######## -# MAIN # -######## -FILES="$(find "$BUILD_DIR" -type 'f')" -make_boilerplate "$(make_ul "$FILES")" diff --git a/scripts/combine.sh b/scripts/combine.sh new file mode 100755 index 0000000..8861250 --- /dev/null +++ b/scripts/combine.sh @@ -0,0 +1,16 @@ +#!/bin/bash +basenames="$(find ./tiddlers -name '*.md' -exec basename -s .md {} \;)" +outdir="./test" + +if [ ! -d "$outdir" ]; then + mkdir "$outdir" +fi; + +for file in $basenames; do + { + echo "---" + cat "./tiddlers/$file.md.meta" + echo; echo "---"; echo; + cat "./tiddlers/$file.md" + } > "$outdir/$file.md" +done \ No newline at end of file diff --git a/scripts/index.sh b/scripts/index.sh new file mode 100755 index 0000000..263d8b1 --- /dev/null +++ b/scripts/index.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +############# +# CONSTANTS # +############# +BUILD_DIR="build" + +############# +# FUNCTIONS # +############# + +get_title() { + grep -oP '(?<=).*?(?=)' "$1" +} + # DESC: Gets the text between the tags of an HTML file. + # $1: Path to HTML file + +make_a() { + local path + path="$(echo "$1" | cut -d '/' -f2- )" + printf "<a href=\"%s\">%s</a>\n" "$path" "$(get_title "$1")" +} + # DESC: Writes an HTML anchor based on a built HTML file + # $1: Path to HTML file + # NOTE: Cut build/ from the path b/c the path needs to be relative + # and the the file we are creating will go into the build dir. + +make_li(){ + printf "<li>%s</li>\n" "$1" +} + +make_ul() { + echo "<ul>" + for item in $1; do + make_li "$(make_a "$item")" + done + echo "</ul>" +} + # DESC: Adds <ul> tags around a list of links. + # $1: A list of items that have <li> + +make_boilerplate(){ + printf \ +"<!DOCTYPE html> +<html> + <head> + <meta content=\"text/html; charset=utf-8\" http-equiv=\"content-type\"> + <title>Pages in Build + + + + + +
+

Pages in Build

+ %s +
+ +" "$1" +} + # DESC: Defines the template and injects the body. + # $1: The body of the HTML to add. + # NOTE: The CSS for index is one level higher b/c I'm dumping into + # the build directory rather than one of its subdirectories. + + +######## +# MAIN # +######## +FILES="$(find "$BUILD_DIR" -type 'f')" +make_boilerplate "$(make_ul "$FILES")" diff --git a/todo.md b/todo.md new file mode 100644 index 0000000..794ea39 --- /dev/null +++ b/todo.md @@ -0,0 +1,54 @@ +# To Do + +* Add navigation to template to make notes useful. + * ~~Need an index page.~~ + * ~~I only want files in the build directory.~~ + * ~~I want a clickable link with a reference to the title.~~ + * (Stretch) An automated description would be nice. + * Add index page to nav bar for every page. + * About - add acknowledgements + * Summaries - index + * Misc - deal with this later +* Figure out a `make deploy` with a `.env` file. + * Serve via goddard on push. (If using git hook in rb, use .env file) +* Clean up coding/organizational messes - codify design philosophy. + * Drive project-level batch interactions from Makefile + * What about file level operataions, like hardwrapping an MD file? + (I'll probably need Python for that and I don't want to add a + dependency. We will add that as a separate CLI tool.) + * Helper scripts should go in a separate dir. + * Try to decouple hardcoded things + * index and template use different hardcoded paths to CSS. + * (Stretch) Should acknowledgements be a template? + * (Stretchier) Should I mention Pandoc (def), GNU Make (prob), VSCodium (prob not), Foam (prob not), + Debian(very prob not)? + * Can I centralize config? A `make config` would be nice if it includes + static content (like `author="Kyle Bowman"`) and dynamic content like + `files=$(ls build)`. + * _static should contain only things that are copied into the website + * (Stretch) Reformulate my templates based on jgm's templates so I can + merge updates easily. +* Write the README +* Extract lessons from `experiments.md`. + * I'm torn about where to put these. In the project or in my notes? +* (Stretch) Formalize demo and add tests +* (Stretch) Add a hotkey to strike through a line in a to-do list. +* (Stretch) Start building a CLI library that helps me manage md files. + * Hard wrap the MD files themselves. + * Spell check + +# Done +* ~~Structure notes~~ + * ~~rocketbowman - keep this publishable. Contains functional components like _static, Makefile, tests, templates~~ + * ~~README (and maybe eventually doc/)~~ + * ~~Makefile~~ + * ~~Acknowledgements~~ + * ~~_static/~~ + * ~~tests/~~ + * ~~symlink to public/ dir/repo~~ + * ~~symlink to private/ dir/repo~~ +* ~~Move, symlink and categorize notes~~ + * ~~How do I want to archive git repositories?~~ + * ~~Convert .tid (md + md.meta) int md (w/ frontmatter)~~ + * ~~private: zettlekasten (private?)~~ + * ~~public: summaries/how-to/essays (need to determine categories)~~ \ No newline at end of file