Commit 2dbea8e72f
2dbea8e72f3c6c31e0426b59b943df44052dcc9f
parent: 99e4a3d8ad
Verified · cmc
cmc <hello@cleberg.net> · 2025-06-04 17:19 UTC
feat: add build process
Layout: unified · split
.gitignore
added
+1
| @@ -0,0 +1 @@ |
| |
1 | .build\ No newline at end of file |
README.org
+8
| @@ -6,6 +6,14 @@ This repository contains reusable Org-mode templates intended for structured |
| 6 | documentation of various workflows. Templates are grouped by domain under the |
6 | documentation of various workflows. Templates are grouped by domain under the |
| 7 | =templates/= directory. |
7 | =templates/= directory. |
| 8 | |
8 | |
| |
9 | See the live preview of these templates exported to HTML at |
| |
10 | [[https://org-templates.cleberg.net][org-templates.cleberg.net]]. A set of |
| |
11 | minimal CSS rules are applied from the =assets/styles.css= file. |
| |
12 | |
| |
13 | To generate the HTML files locally, run the provided =export.sh= script from a |
| |
14 | command line shell. This script processes the Org files and produces the HTML |
| |
15 | exports. No additional configuration is required. |
| |
16 | |
| 9 | * Directory Structure |
17 | * Directory Structure |
| 10 | |
18 | |
| 11 | The repository is organized as follows: |
19 | The repository is organized as follows: |
assets/styles.css
added
+75
| @@ -0,0 +1,75 @@ |
| |
1 | /* styles.css */ |
| |
2 | /* Minimal, readable styles for Org-mode HTML exports */ |
| |
3 | |
| |
4 | body { |
| |
5 | font-family: system-ui, sans-serif; |
| |
6 | font-size: 16px; |
| |
7 | line-height: 1.6; |
| |
8 | color: #222; |
| |
9 | background: #ffffff; |
| |
10 | margin: 2rem auto; |
| |
11 | max-width: 800px; |
| |
12 | padding: 0 1rem; |
| |
13 | } |
| |
14 | |
| |
15 | h1, h2, h3, h4 { |
| |
16 | font-weight: 600; |
| |
17 | margin-top: 2rem; |
| |
18 | margin-bottom: 1rem; |
| |
19 | } |
| |
20 | |
| |
21 | h1 { font-size: 1.75rem; border-bottom: 2px solid #ccc; padding-bottom: 0.3rem; } |
| |
22 | h2 { font-size: 1.5rem; border-bottom: 1px solid #ddd; padding-bottom: 0.2rem; } |
| |
23 | h3 { font-size: 1.25rem; } |
| |
24 | h4 { font-size: 1.1rem; } |
| |
25 | |
| |
26 | ul, ol { |
| |
27 | margin-left: 1.5rem; |
| |
28 | padding-left: 0; |
| |
29 | } |
| |
30 | |
| |
31 | pre, code { |
| |
32 | font-family: monospace; |
| |
33 | background: #f4f4f4; |
| |
34 | padding: 0.2em 0.4em; |
| |
35 | border-radius: 4px; |
| |
36 | } |
| |
37 | |
| |
38 | pre { |
| |
39 | padding: 1em; |
| |
40 | overflow-x: auto; |
| |
41 | } |
| |
42 | |
| |
43 | blockquote { |
| |
44 | margin-left: 1rem; |
| |
45 | padding-left: 1rem; |
| |
46 | border-left: 3px solid #ccc; |
| |
47 | color: #555; |
| |
48 | } |
| |
49 | |
| |
50 | table { |
| |
51 | border-collapse: collapse; |
| |
52 | width: 100%; |
| |
53 | margin: 1rem 0; |
| |
54 | } |
| |
55 | |
| |
56 | th, td { |
| |
57 | border: 1px solid #ccc; |
| |
58 | padding: 0.5rem; |
| |
59 | text-align: left; |
| |
60 | } |
| |
61 | |
| |
62 | hr { |
| |
63 | border: none; |
| |
64 | border-top: 1px solid #ccc; |
| |
65 | margin: 2rem 0; |
| |
66 | } |
| |
67 | |
| |
68 | a { |
| |
69 | color: #0366d6; |
| |
70 | text-decoration: none; |
| |
71 | } |
| |
72 | |
| |
73 | a:hover { |
| |
74 | text-decoration: underline; |
| |
75 | }\ No newline at end of file |
export.sh
added
+36
| @@ -0,0 +1,36 @@ |
| |
1 | #!/bin/bash |
| |
2 | |
| |
3 | set -e |
| |
4 | |
| |
5 | SRC_ROOT="${1:-$(pwd)/templates}" |
| |
6 | DEST_ROOT="$(pwd)/.build" |
| |
7 | CSS_SRC="$(pwd)/assets/styles.css" |
| |
8 | CSS_DEST="$DEST_ROOT/assets/styles.css" |
| |
9 | |
| |
10 | # Clean and recreate build directory |
| |
11 | rm -rf "$DEST_ROOT" |
| |
12 | mkdir -p "$DEST_ROOT/assets" |
| |
13 | cp "$CSS_SRC" "$CSS_DEST" |
| |
14 | |
| |
15 | # Export and relocate |
| |
16 | find "$SRC_ROOT" -name "*.org" | while read -r org_file; do |
| |
17 | # Relative path from templates root |
| |
18 | rel_path="${org_file#$SRC_ROOT/}" |
| |
19 | rel_dir=$(dirname "$rel_path") |
| |
20 | base_name=$(basename "$org_file" .org) |
| |
21 | |
| |
22 | # Temporary output will go next to source |
| |
23 | echo "Exporting: $rel_path" |
| |
24 | |
| |
25 | emacs "$org_file" \ |
| |
26 | --batch \ |
| |
27 | --eval '(require '\''ox-html)' \ |
| |
28 | --eval "(setq org-html-head \"<link rel=\\\"stylesheet\\\" type=\\\"text/css\\\" href=\\\"../assets/styles.css\\\" />\")" \ |
| |
29 | --eval '(org-html-export-to-html)' |
| |
30 | |
| |
31 | # Move output file to .build |
| |
32 | mkdir -p "$DEST_ROOT/$rel_dir" |
| |
33 | mv "$(dirname "$org_file")/${base_name}.html" "$DEST_ROOT/$rel_dir/" |
| |
34 | done |
| |
35 | |
| |
36 | echo "Export complete. Output is in .build/"\ No newline at end of file |
templates/generic/zettelkasten.org
deleted
−10
| @@ -1,10 +0,0 @@ |
| 1 | * [[id:202506040934][Note Title]] |
| |
| 2 | :PROPERTIES: |
| |
| 3 | :ID: 202506040934 |
| |
| 4 | :DATE: %U |
| |
| 5 | :END: |
| |
| 6 | |
| |
| 7 | ** Summary |
| |
| 8 | ** Key Points |
| |
| 9 | ** Links |
| |
| 10 | - [[id:202506041000][Related Note]] |
| |