All,
I hope you are doing well.
I've been considering a new feature for MMD to greatly increase the
flexibility when creating documents and I'm looking for some input.
# Short version #
I created a c implementation of the Mustache "logic-less" templating
system called "Magnum" (because he had the coolest mustache ever...)
https://github.com/fletcher/magnum
This allows you to create document templates and use arbitrarily complex
JSON data to "drive" the templates.
# Longer version #
Many people are familiar with the idea of a "mail merge" feature in a
word processor. You write a letter, leaving blanks for the name,
address, etc. And the software plus in the information from your
address book, allowing you to write a letter once and send it to as many
people as you want.
Mustache is like that on steroids.
You can use a JSON file to describe your "data" and MMD to describe the
document template. Mustache allows you to merge the two according to
your instructions to quickly generate multiple versions of a document as
needed.
# Why templates? #
MMD already supports metadata, which can be used to provide simple
templating functionality. Mustache, however, allows much more complex
functionality, including support for arrays and nested objects.
# What now? #
Right now, Magnum is a separate tool from MMD. You can process your
document with Magnum either before or after running it through MMD. So
it's an extra step, but it works well.
(Also, this means that you can use Magnum completely separate from MMD,
or with any other markup language. I've even used it to write code in C
and SQLite!)
# What next? #
I'm going to be experimenting with the best way to plug things together.
I anticipate building Magnum into MMD itself, so that everything can
be done as part of a single program.
# What can you do? #
I welcome feedback. What would you like to see? What works well? What
doesn't work well? How should I integrate the two workflows? Is this
even worth doing?
F-
--
Fletcher T. Penney
flet...@fletcherpenney.net