diff options
| author | William Boman <william@redwill.se> | 2022-08-07 18:31:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-07 18:31:20 +0200 |
| commit | d1c860da4b89fd29a45decfb490c79748d954493 (patch) | |
| tree | a3fbabb1212dee5812fe30dcc380b23fb7b72fc0 /scripts/lua/mason-scripts/templates | |
| parent | chore: reformat long descriptions (#264) (diff) | |
| download | mason-d1c860da4b89fd29a45decfb490c79748d954493.tar mason-d1c860da4b89fd29a45decfb490c79748d954493.tar.gz mason-d1c860da4b89fd29a45decfb490c79748d954493.tar.bz2 mason-d1c860da4b89fd29a45decfb490c79748d954493.tar.lz mason-d1c860da4b89fd29a45decfb490c79748d954493.tar.xz mason-d1c860da4b89fd29a45decfb490c79748d954493.tar.zst mason-d1c860da4b89fd29a45decfb490c79748d954493.zip | |
feat: generate PACKAGES.md (#265)
Diffstat (limited to 'scripts/lua/mason-scripts/templates')
3 files changed, 46 insertions, 0 deletions
diff --git a/scripts/lua/mason-scripts/templates/PACKAGES.template.md b/scripts/lua/mason-scripts/templates/PACKAGES.template.md new file mode 100644 index 00000000..c0b38280 --- /dev/null +++ b/scripts/lua/mason-scripts/templates/PACKAGES.template.md @@ -0,0 +1,11 @@ +# Mason Package Index +> `:Mason` + +{% list(each(packages, _.compose(link, _.prop("name")))) %} + +{% render_each(packages) "./package-section.template.md" %} +--- +<sub><sup> +Last updated: {% last_updated %}<br/> +[https://github.com/williamboman/mason.nvim](https://github.com/williamboman/mason.nvim) +</sup></sub> diff --git a/scripts/lua/mason-scripts/templates/package-section.template.md b/scripts/lua/mason-scripts/templates/package-section.template.md new file mode 100644 index 00000000..b71882f2 --- /dev/null +++ b/scripts/lua/mason-scripts/templates/package-section.template.md @@ -0,0 +1,19 @@ +{# include "parse_commit" #} + +# {{ name }} + +> {{ spec.desc }} + +Homepage: {% url(spec.homepage) %} +Languages: {% join(spec.languages) ", " %} +Categories: {% join(spec.categories) ", " %} + +<details> + <summary>History:</summary> + +{% list(each(history, parse_commit)) %} +</details> + +``` +:MasonInstall {{ name }} +``` diff --git a/scripts/lua/mason-scripts/templates/parse_commit.lua b/scripts/lua/mason-scripts/templates/parse_commit.lua new file mode 100644 index 00000000..2f7e7358 --- /dev/null +++ b/scripts/lua/mason-scripts/templates/parse_commit.lua @@ -0,0 +1,16 @@ +local _ = require "mason-core.functional" + +local linkify = _.gsub([[#(%d+)]], function(issue) + return ("[#%d](https://github.com/williamboman/mason.nvim/issues/%d)"):format(issue, issue) +end) + +return { + parse_commit = function(commit_str) + local commit = + _.compose(_.zip_table { "sha", "commit_date", "author_name", "subject" }, _.split "\t")(commit_str) + + return (_.dedent [[ + [`%s`](https://github.com/williamboman/mason.nvim/commit/%s) %s - %s by %s + ]]):format(commit.sha, commit.sha, commit.commit_date, linkify(commit.subject), commit.author_name) + end, +} |
