gedw99 / mergician-demo

Apache License 2.0
0 stars 0 forks source link

mergician-demo

Demo files to try out the mergician stack.

A stack for html / xml merging and associated tooling for Lambda like architecture.

Whats in the stack ?

https://github.com/rcrowley/mergician

https://github.com/rcrowley/electrostatic

https://github.com/rcrowley/deadlinks

https://github.com/rcrowley/sitesearch

HTMX and why ?

It shows different approach to templates and merging and hence can be a quasi HTMX style system.

It's more pure in that you can use it for any GUI, and not just web. I have been using it for Web, PDF, Image and video creation. Mutations go to the Source, and Reads are a simple compute.

Fragments are just parts of the pipeline; nothing new.

The merging is the key to the Perf and why it could also be a HTMX style system.

SWAT / Theory

Its basis is XML which is of course reusable, in that a GUI that is both Web and non web is possible with mergician if your IR ( intermediate representation) DSL is XML. So you can also generate PDF, Emails, Images, Videos from the same XML.

Its Caching and idempotency allows asking for an Final HTML ( or other ), and it only runs sub tree dependencies if they have changed. The SHA is disk based, allows easy running on anything. Perhaps even browsers, mobile and embedded if you want to take it that far, which is possible as it has so few dependencies; might have to remove the AWS deps though.

Its Merging, in the Markdown example, allows Edits higher up in the pipeline tree to not be overwritten by Edits in Sub trees. Use case being that Users & Developers own edits in higher trees is not overridden by the base base templates, so that Low Code systems are easier to developer and use.

How to run ??

_demo folder has it all. Still a WIP :)

Make file pulls all repos and builds and has run targets to get going quickly.

Below are the repositories used.

merg / mergician repo

Feed it html or markdown to make web html...

Usage: mergician [-o <output>] [-r <rule>[...]] <input>[...]
  -o <output>   write to this file instead of standard output
  -r <rule>     use a custom rule for merging inputs (overrides all defaults;
                may be repeated)
                each rule is a destination HTML tag with optional attributes,
                "=" or "+=", and a source HTML tag with optional attributes
                default rules: <article class="body"> = <body>
                               <div class="body"> = <body>
                               <section class="body"> = <body>
  <input>[...]  one or more input HTML, Markdown, or Google Doc HTML-in-zip files

elec / electostatic repo

Electostatic extends Mergician just that little bit further into a very basic CMS. It processes a whole document root directory,

./electrostatic/electrostatic -h
Usage: electrostatic -i <input> -l <layout> -o <output> [-p] [-v]
  -i <input>   directory containing input HTML and Markdown documents
  -l <layout>  site layout HTML document
  -o <output>  document root directory where merged HTML documents will be placed
  -p           pretend to process all the inputs but don't write any outputs; implies -v
  -v           verbose mode

site / sitesearch repo

Usage: sitesearch -l [-n ] [-r ] [...] -l site layout HTML document for search result pages -n name of the the Lambda function (default "sitesearch") -r AWS region to host the Lambda function (default to AWS_DEFAULT_REGION in the environment) [...] pathname, relative to your site's root, of one or more HTML files, given as command-line arguments or on standard input

dead / deadlinks repo

find dead links.

Usage: deadlinks [-i <ignore>] [-v] [<dirname>[...]]
  -i <ignore>  file containing links to ignore
  <dirname>    document root directory to scan for dead links (defaults to the current working directory)

extra

Need to add JSON SCHEMA / JSON FORMS, validation via Benthos.