diff options
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, +} |
