New features and a bit about D
I've written a considerable number of features since I listed the So far good progress! I already wrote the following features:
Features
- Post list improvements - Title instead of filename
- Post list improvements - Summary
- Access statistics
- Template system - It needs some interface, at all.
Missing:
- Author in post
- Comments
- Post composer - I'm still writing offline
- Caching system
Probably, just after comments and author, I'm going to implement caching system.
Some noticiable things:
- Everything is hosted on GitLab
- I'm using markdown comments as metatags. It makes the system really extensible.
[ID]: # (postid) [DATE]: # (postdate) [AUTHOR]: # (author name)
- New template! CSS/design is hard!
- Writing offline is not that bad. Using an markdown editor, I have syntax highlight and it's very nice.
A bit about D
I used for the first time template parameters today.
How to get ordered list of files ?
First, let's check the sort algorithm and dirEntries
//First sortedRange
SortedRange!(Range, less) sort(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable, Range)(Range r)
//Now dirEntries
DirIterator dirEntries(string path, SpanMode mode, bool followSymlink = true);
Although it looks simple, dirEntries returns DirIterator and sort requires a range. Luckly the solution is pretty simple
auto dir_list = array(base_dir.dirEntries(SpanMode.shallow));
Now, we have a range based on DirIterator. The only thing we need is to invert less operator
sort!("a.name > b.name")(dir_list);
Done. We have our list sorted from Z to A.
Some other option we have:
sort!("a.timeLastModified > b.timeLastModified")(dir_list);
sort!("a.size > b.size")(dir_list);
sort!("a.timeCreated > b.timeCreated")(dir_list);
References: