~kungtotte/dtt

Move back to markdown, --gc:arc is too much work

I can't be bothered at this point. Everything works fine without
--gc:arc so I'll stick to that until deps are updated accordingly.
Swap nim-markdown for slimdown for --gc:arc

nim-markdown from soasme had lots of issues with ARC and like docopt
it's easier to pick another markdown library than fix those errors.

Eventually I might switch back if it's updated for ARC.

Also cleaned out old dependencies and changed a func to a proc due to
how slimdown handles things. Will look to see if I can adapt that about
slimdown since it shouldn't really have side-effects.
Switch from docopt to argparse

docopt 0.6.8 had several issues compiling under --gc:arc and I don't
want to spend a whole bunch of time fixing issues in my dependencies.
argparse seems like the best alternative in that it compiles fine with
ARC and also makes for some decently clean code.

The one issue is you can't have empty strings as the default value so we
work around that by defaulting [dir] to "nil".
Turn a number of procs into funcs

A func is short-hand for a proc with no side effects (tracked by the
compiler), and most of the code really is without side-effects so I
think it should be easy to see this at a glance as well as have the
compiler check it for us.

Ultimately this is a program designed for file IO so there will be
side-effects, but now it can be boiled down to a select few procs.
Fix bug in using the try statement

I was relying on a buggy behaviour of the try statement to assign a
value. Both the try and except path need to return the same type of
value, but I was exiting the program in the except:

This satisfies the compiler though and fixes that bug.
Remove nim.cfg
Fix nim.cfg paths
Removed perf. fix because of a bug

I'll live with the slow performance for now; I need to figure out a
better way to improve performance.
README update and version bump

Now that the blog indexing feature is added I think it calls for a
version bump, and the README was updated to take the progress of the
tool into account.
Document template variables

It might be a good idea if people knew what variables they could use for
their templates!
Add more vars for the templates

Now you can reference the latest post, a subset of post, and the entire
blog index (no pagination yet):

{{latest_post}}
{{blog_posts}} - A short list of posts (default 5)
{{blog_index}} - The whole list of posts

Each post has the following vars to use:

{{id}} - The slug/title
{{date}} - The creation date
{{{post}}} - The actual post content (triple {{{ for including html)
{{link}} - The relative URL to this blog post for linking to it.

Also fixed a bug with the stale file check where it would error if you
tried to reference blog posts when no blog posts were rebuilt. Now it
will correctly populate the post variables even if they remain
unchanged.
Add a simple way of listing all blogs

dtt build accepts an argument that is the number of blog posts to list
inside the blog_posts variable (defaults to 5), passing -1 will list all
of them.

Need to figure out full listing/pagination of blogs as well, that's the
final must-have feature for this tool.
Update tmpl.nim to reflect dropping config.cfg

Since we're using templates we don't need to put these things in via
variables read from a config.cfg file, people can just change their
template(s).
Added a modification time check for performance

Once you get a number of pages/posts together the performance starts to
suffer somewhat (~7s for 40 rendered pages on my machine), and the bulk
of that time is spent inside the markdown() function call which is in
one of the dependencies for this project.

So for the time being we get around this by checking modification times
of the markdown files versus the existing html files and only rebuild
them if the markdown was modified later than the html, or if the html
doesn't exist obviously.

That saves a whole bunch of time as it only takes about 0.2-0.3s for a
single markdown file to render.
Add scdoc man-page file for docs

Also make a nimble task for running scdoc over the man page
Fixed a bug introduced during refactoring

I didn't properly render blog posts as actual pages so they didn't get
any CSS styling or anything, that's fixed now though.
Remove cleanCmd and config.cfg code

I realised I don't really need/use a clean command, my OS has tools for
taking care of that so I don't need to build it into dtt.

Also cleaning out remnants of config.cfg code since I don't use it
anymore.
Added a findBaseDir proc to search for a dtt dir

We don't use the config.cfg file anymore so I needed a better way to
find a dtt directory, now it will scan for a content directory upwards
and error out if it can't find it.

Should make it check for content + template to be really sure it won't
conk out.
Remove unused code and slimline blog management

Now everything runs much smoother and the code is easier to follow
I think. There's still a few rough edges here and there but it's much
better now to build on this.
Optimize buildCmd to use fewer loops

This is a big change that optimizes away the multiple loops to scan for
blog posts, find links to pages, and render pages out. Now it does one
major loop collecting everything then one loop to render and write pages
out that goes much faster since it's doing fewer things.

Next up is refactoring the code to reduce duplication and complexity.
Next