From a5e01d22f5f47f4ab363df4d098993ddd10f6546 Mon Sep 17 00:00:00 2001 From: Trevor Bentley Date: Sun, 15 Jan 2023 18:27:18 +0100 Subject: [PATCH] add mdbook example --- examples/csv/README | 9 ++++++ examples/mdbook/README | 11 +++++++ examples/mdbook/book.toml | 2 ++ examples/mdbook/mdbook.toml | 42 +++++++++++++++++++++++++ examples/mdbook/templates/branches.html | 7 +++++ examples/mdbook/templates/history.html | 7 +++++ examples/mdbook/templates/repo.html | 11 +++++++ examples/mdbook/templates/sidebar.html | 10 ++++++ examples/mdbook/templates/tags.html | 7 +++++ 9 files changed, 106 insertions(+) create mode 100644 examples/csv/README create mode 100644 examples/mdbook/README create mode 100644 examples/mdbook/book.toml create mode 100644 examples/mdbook/mdbook.toml create mode 100644 examples/mdbook/templates/branches.html create mode 100644 examples/mdbook/templates/history.html create mode 100644 examples/mdbook/templates/repo.html create mode 100644 examples/mdbook/templates/sidebar.html create mode 100644 examples/mdbook/templates/tags.html diff --git a/examples/csv/README b/examples/csv/README new file mode 100644 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 new file mode 100644 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 new file mode 100644 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 new file mode 100644 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 new file mode 100644 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 new file mode 100644 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 new file mode 100644 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 new file mode 100644 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 new file mode 100644 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 -%}