Posts about crystal (old posts, page 4)
Croupier version v0.4.0 is out
What's Changed
- Support key/value in addition to files as input/output
- Implement a persistent k/v store
- Implement fast_mode
- auto mode with kv
Full Changelog: v0.3.4...v0.4.0
New Project: Shortcodes
One thing leads to another. I wanted to learn a new language and chose Crystal. To practice, I rewrote my standard practice project, Nicoletta, a static site generator.
That brought to mind doit a task/dataflow library, which made me want to implement something similar, so I wrote Croupier which went well, so I said "Why not write a more serious SSG, which is Nicolino which I think would not be complete without a feature from Nikola which I stole from Hugo, called shortcodes. So I had to write a shortcode parser.
What are shortcodes?
Sort of macros for markdown. You want to do a <figure>
but
markdown doesn't have it, so you do this:
{{% figure src="http://whatever" %}}
And you end up with a figure tag in your document.
That is done by passing data like that "src" argument and the context of the document you are writing into a template, which renders a piece of HTML, that's inserted where the shortcode was and bob's your uncle.
There are variants, and details, and subtleties, but that's the basic idea.
The bad news was that I was not the author of Nikola's current shortcode parser, that was someone else, and I really don't understant their code.
So I wanted to write it from scratch.
I have been wanting to learn ragel for a bit, let's say 10 years. It's a thing that takes a finite state machine description in a DSL and turns it into a parser in the language you want.
As long as you want one of the languages it likes, which is not Crystal, so I used it to generate it in C. And wrapped that in Crystal.
So, that's a very long way to say that I wrote a Shortcode parser library that can be used from Crystal and from C, and since it can be used from C, it can be used from pretty much any language.
It doesn't implement the whole shortcode "specification" (which is not a real thing that exists) but it implements the basics.
Now, I just need to use it in Nicolino, and eventually make it better as needed.
BTW: Ragel rocks.
Hacé version v0.1.2 is out
Version v0.1.2
-
Make tasks not be
default
by default. This means that if you
don't specify a task when invokinghace
, nothing will happen.This is a breaking change.
-
Added
self
to exposed variables in tasks. This can be used
to achieve what you would use $@ or other automatic variables
in Makefiles. -
Added
-f
option to specify a Hacefile to use. -
Added
-n
option to do a dry run. -
Added
always_run
flag for tasks which causes them to always
run even if their dependencies are unchanged. -
Implemented
--question
flag to ask if a task should be run. -
Implemented
auto
command, which continuously rebuilds as needed
reacting to filesystem changes.
Croupier version v0.3.4 is out
What's new?
- Fixed bug saving .croupier, was missing all inputs
- Added tests for
TaskManager.save_run
- Fixed bug in inotify watcher path lookup
- Fixed bug where auto_run would only run tasks once (found in Hacé)