Started documenting mmm.
h3rald h3rald@h3rald.com
Thu, 30 Nov 2023 16:20:27 +0100
7 files changed,
82 insertions(+),
4 deletions(-)
M
site/contents/_defs_.md
→
site/contents/_defs_.md
@@ -116,6 +116,7 @@ > * [Scopes](/learn-scopes)
> * [Control Flow](/learn-control-flow) > * [Shell](/learn-shell) > * [Extending min](/learn-extending) +> * [Module Management](/learn-mmm) }} {{guide-download =>
M
site/contents/learn-extending.md
→
site/contents/learn-extending.md
@@ -113,3 +113,4 @@ > Tip
> > For more information on how to create new modules with Nim, have a look in the [lib folder](https://github.com/h3rald/min/tree/master/minpkg/lib) of the min repository, which contains all the min modules included in the standard library. +{#link-learn||mmm||min Module Management#}
A
site/contents/learn-mmm.md
@@ -0,0 +1,6 @@
+----- +content-type: "page" +title: "Learn: Module Management" +----- +{@ _defs_.md || 0 @} +
M
site/rules.min
→
site/rules.min
@@ -3,6 +3,8 @@
'hastysite import 'min-highlight import +() :modules + ;Routing ( symbol set-destination@@ -94,6 +96,8 @@ (dict :data ==>)
( timestamp :ts data input-fread from-json :contents + ; Save modules + contents /modules @modules ; Update timestamp contents ts %updated @contents data contents to-json %contents@@ -156,3 +160,31 @@ ((meta /path "mmm.json" ==) (meta process-mmm-json))
((true) (meta output-cp)) ) case ) foreach + +"Generating mmm index..." notice! +; Process deps of each module -> name@version +modules ( + :module + module /deps dkeys ( + :name + module /deps name dget :version + "$#@$#" (name version) =% + ) map ", " join :dependencies + (dependencies "" ==) + ("n/a" @dependencies) + when + module dependencies %dependencies +) map @modules + +{} + "mmm/index" %id + "mmm.html" %path + ".html" %ext + "mmm" %title + "min language" %site + "page" %content-type + modules %modules +dup +"mmm" swap mustache %contents output-fwrite + +
A
site/templates/_module.mustache
@@ -0,0 +1,14 @@
+<h2 id="module-{{name}}">{{name}}</h2> + +<p>{{description}}</p> + +<dl> + <dt>Author</dt> + <dd>{{author}}</dd> + <dt>License</dt> + <dd>{{license}}</dd> + <dt>URL</dt> + <dd><a href="{{url}}">{{url}}</a></dd> + <dt>Dependencies</dt> + <dd>{{dependencies}}</dd> +</dl>
A
site/templates/mmm.mustache
@@ -0,0 +1,23 @@
+<!doctype html> +<html lang="en"> + {{> _head}} + <body> + {{> _menu}} + <main class="pure-g"> + <article class="pure-u-5-5"> + <h1>mmm</h1> + <p>This page lists all existing public <em>managed min modules</em> that can be installed using the <a href="/learn-mmm/">min module management (mmm)</a> + commands that are built-in into the min executable.</p> + <ul> + {{#modules}} + <li><a href="#module-{{name}}">{{name}}</a></li> + {{/modules}} + </ul> + {{#modules}} + {{> _module}} + {{/modules}} + </article> + </main> + {{> _footer}} + </body> +</html>