summary history branches tags files
commit:a5e01d22f5f47f4ab363df4d098993ddd10f6546
author:Trevor Bentley
committer:Trevor Bentley
date:Sun Jan 15 18:27:18 2023 +0100
parents:88e76d788cac4c894cd0e2eecfccc8be2765a5da
add mdbook example
diff --git a/examples/csv/README b/examples/csv/README
line changes: +9/-0
index 0000000..37f1f79
--- /dev/null
+++ b/examples/csv/README
@@ -0,0 +1,9 @@
+This example demonstrates generating a CSV spreadsheet from a few git
+repositories using Itsy-Gitsy.
+
+Generate with:
+
+$ itsy-gitsy -c csv.toml --clean --local
+
+Then open "rendered/repos.csv" with a text editor or spreadsheet
+application.

diff --git a/examples/mdbook/README b/examples/mdbook/README
line changes: +11/-0
index 0000000..c3ad107
--- /dev/null
+++ b/examples/mdbook/README
@@ -0,0 +1,11 @@
+This example renders a few git repositories as an mdBook with Itsy-Gitsy.
+
+You'll need to have Itsy-Gitsy and mdbook available.  Update the
+commands below to use absolute paths, if necessary.
+
+Build the book with:
+
+$ itsy-gitsy -c mdbook.toml --clean --local
+$ mdbook serve rendered/
+
+And navigate to http://localhost:3000/ to view.  That's it!

diff --git a/examples/mdbook/book.toml b/examples/mdbook/book.toml
line changes: +2/-0
index 0000000..a5adb25
--- /dev/null
+++ b/examples/mdbook/book.toml
@@ -0,0 +1,2 @@
+[book]
+title = "Itsy-Gitsy mdBook"

diff --git a/examples/mdbook/mdbook.toml b/examples/mdbook/mdbook.toml
line changes: +42/-0
index 0000000..236d98e
--- /dev/null
+++ b/examples/mdbook/mdbook.toml
@@ -0,0 +1,42 @@
+###############################################################################
+##
+## Minimal configuration to generate an "mdBook"
+##
+###############################################################################
+
+render_markdown = false
+syntax_highlight = false
+asset_files = ["book.toml"]
+
+[gitsy_templates]
+path = "templates/"
+repo_list    = "sidebar.html"
+repo_summary = "repo.html"
+history      = "history.html"
+branches     = "branches.html"
+tags         = "tags.html"
+
+[gitsy_outputs]
+path = "rendered/"
+repo_list     = "src/SUMMARY.md"
+repo_summary  = "src/%REPO%/about.md"
+history       = "src/%REPO%/history.md"
+branches      = "src/%REPO%/branches.md"
+tags          = "src/%REPO%/tags.md"
+global_assets = ""
+cloned_repos  = "cloned_repos/"
+
+[connectr]
+path = "https://github.com/mrmekon/connectr"
+website = "https://github.com/mrmekon/connectr"
+description = "A super lightweight Spotify controller"
+
+[tempest-cljs]
+path = "https://github.com/mrmekon/tempest-cljs"
+website = "https://github.com/mrmekon/tempest-cljs"
+description = "Tempest arcade game, in ClojureScript, hosted on Noir"
+
+[picdb]
+path = "https://github.com/mrmekon/picdb"
+website = "https://github.com/mrmekon/picdb"
+description = "Command-line debugger for Microchip PIC processors"

diff --git a/examples/mdbook/templates/branches.html b/examples/mdbook/templates/branches.html
line changes: +7/-0
index 0000000..78265f3
--- /dev/null
+++ b/examples/mdbook/templates/branches.html
@@ -0,0 +1,7 @@
+# {{name}} -- Branches
+
+| Branch | Hash | Summary |
+| --- | --- | --- |
+{% for entry in branches | sort(attribute="ts_utc") | reverse -%}
+| {{entry.ref_name}} | {{entry.short_hash}} | ({{entry.summary}}) |
+{% endfor -%}

diff --git a/examples/mdbook/templates/history.html b/examples/mdbook/templates/history.html
line changes: +7/-0
index 0000000..707425d
--- /dev/null
+++ b/examples/mdbook/templates/history.html
@@ -0,0 +1,7 @@
+# {{name}} -- Commits
+
+| Hash | Summary |
+| --- | --- |
+{% for entry in history -%}
+| {{entry.short_hash}} | ({{entry.summary}}) |
+{% endfor -%}

diff --git a/examples/mdbook/templates/repo.html b/examples/mdbook/templates/repo.html
line changes: +11/-0
index 0000000..9bb7d65
--- /dev/null
+++ b/examples/mdbook/templates/repo.html
@@ -0,0 +1,11 @@
+# {{name}} -- Overview
+
+{{metadata.description}}
+
+## Recent commits (10 of {{history | length}})
+
+{% for entry in history -%}
+{% if loop.index0 < 10  -%}
+- {{entry.short_hash}}: {{entry.summary}}
+{% endif -%}
+{% endfor -%}

diff --git a/examples/mdbook/templates/sidebar.html b/examples/mdbook/templates/sidebar.html
line changes: +10/-0
index 0000000..fe2e0b2
--- /dev/null
+++ b/examples/mdbook/templates/sidebar.html
@@ -0,0 +1,10 @@
+# Summary
+
+# Git Repositories
+
+{% for repo in repos | sort(attribute="name") | reverse  -%}
+- [{{repo.name}}]({{repo.name}}/about.md)
+  - [history]({{repo.name}}/history.md)
+  - [branches]({{repo.name}}/branches.md)
+  - [tags]({{repo.name}}/tags.md)
+{% endfor -%}

diff --git a/examples/mdbook/templates/tags.html b/examples/mdbook/templates/tags.html
line changes: +7/-0
index 0000000..683d61f
--- /dev/null
+++ b/examples/mdbook/templates/tags.html
@@ -0,0 +1,7 @@
+# {{name}} -- Tags
+
+| Tag | Hash | Summary |
+| --- | --- | --- |
+{% for entry in tags | sort(attribute="ts_utc") | reverse -%}
+| {{entry.ref_name}} | {{entry.short_hash}} | ({{entry.summary}}) |
+{% endfor -%}