This is a follow-up to PR #46. It replaces the 300ms loop with a file
watcher. Hawk is a wrapper around java.nio.file.WatchService coming with
proper OS X support.
Now rebuilds should be instantaneous.
The blog that I'm moving to cryogen currently groups the posts by year instead of by year/month. This change makes the grouping configurable while defaulting to the current behavior of year/month grouping on posts.
When `clean-urls?` is set in config, emit pages as subdirectories
`prefix/root/page-name/index.html` instead of
`prefix/root/page-name.html`. Links in emitted HTML then point to
`prefix/root/page-name/`. When `clean-urls?` not set, behaves as
before.
Refactor most URI generation into a new `page-uri` function.
`page-uri` replaces most calls* to `path`, all calls to `post-uri`
and all calls to the old `page-uri`.
Introduce function `create-file-recursive`. Function creates
file parent if not exists.
Introduce function `write-html`. When `clean-urls?` is set, spits
emitted HTML into subdirectories as described above; otherwise
behaves like `create-file`. Replaces most* calls to `create-file`
Calls `create-file` or `create-file-recursive`.
* Exceptions made for sitemap XML and RSS feed XML pages
`content-with-more-marker` returns a HTML string when the `content`
conteins more marker ("<!--more-->").
In many case, HTML tags in `content` is balanced.
ex.
------------------------------
<div id='post'>
<div class='post-content'>
this post has more marker
<!--more-->
and more content.
</div>
</div>
------------------------------
But original code breaks the balance.
------------------------------
<div id='post'>
<div class='post-content'>
this post has more marker
------------------------------
Afer this patch applied, `tagsoup` read above text and `hiccup`
re-render to HTML text with correct balanced tags.
------------------------------
<div id='post'>
<div class='post-content'>
this post has more marker
</div></div>
------------------------------
add :tag-root-uri :page-root-uri :post-root-uri parsing
replace {entity}-root with {entity}-root-uri parameters to set uri
fix root-path call
fix root-path function params order
(worked erlier because of keyword<->map transposition)
fix keyword :{entity}-root-uri to :{entity}-root transformation
misprint: congig -> config
add function to compose file path
add create-file function
add function to compose a path
handle empty blog-path using path function
fix filename for preview
This makes each markup implementation process posts in parallel.
In case of a simple test blog with 4 markdown pages mean compilation
time was reduced from 395 to 330ms. In the experiment I used OpenJDK 8
running `lein ring server` on a 4 core CPU.
This makes compilation of cryogen-core.watcher faster by reducing the
number of its dependencies. Now it depends just on pandect.algo.md5
instead of all pandect.algo.*
This commit replaces a regular expression lookup with a simple
String/indexOf substring search.
It addresses pathological cases in which re-find took several
seconds to process contents of a blog post. An example of such
a case was a post with 16kB of nested HTML tags in a single line.
Add an enclosure tag to a post's metadata to let a podcast client
to deliver your audio content. It should look like this:
:enclosure [{:url "<full-url>"}]
Without the brackets, you end up with NullPointerExceptions, so
make sure you have that.
The URL should be the full location of where the audio file is
hosted (not relative), so for example:
:enclosure [{:url "http://www.example.com/01_episode_IV.mp3"}]
I created a bunch of markdown files with just the enclosure and
info about the audiobook with the following bash snippet:
find -L books -type f -iname "*mp3" | sort | while read mp3; do name=$(basename $mp3 .mp3); book=$(basename "$(dirname $mp3)"); echo "{:title \"$name\"\n:layout :post\n:tags [\"audiobooks\" \"$book\"]\n:enclosure [{:url \"http://clashthebunny.mason.ch/blog/$mp3\"}]}\n $book - $name\n==================" > md/posts/"$(date "+%Y-$name").md"; done
Each book was in it's own subdirectory of books:
books/Dracula/1-01-Chapter1_part01.mp3
books/Dracula/1-02-Chapter1_part02.mp3
books/Dracula/2-01-Chapter2_part01.mp3
Note that the above script requires the prefix of the episode to
be "date-like". It should be fairly easy to work out a way to get
your podcast up and running.
Add the book names to your rss-filters array, e.g.:
["Dracula" "Pride & Prejudice"]
Most podcasting clients support authentication, so just password
protect those directories and you should be good to go, even
if you are hosting copyrighted content.
For certain pages a key with a boolean value is added to the config map which can then be used in templates to determine if it is the page being rendered. Not all pages have this key and boolean value. Instead of adding additional keys for every page a new generic key, 'active-page', has been added and its value is the page name, ex: 'home', 'archives', 'tags', etc. The default value is 'home'. This key can then be used in any template to check the page which is currently being rendered.
1) Removed the <author> tag from each <item>. The presence of this tag is ok here but the xsd requires that the content include a valid email address, not just the name string coming from the site config (Forms that pass validation are "test@xyz.com" or "test@xyz.com (Test McTester)" ). And who would want to advertise their real email like that? :)
2) Removed the <author> tag from the <channel>. <author> isn't a valid child element of a channel. There is a child element called <webMaster> that is a close analogue but it also requires content as above.
As the filename extensions given by the render plugins are also used as
regex for replacing them with .html to generate URIs, the dot in front of
the extension was interpreted as an arbitrary character for the regex.
Also, it matched in the middle of a string. Now dots get quoted and a $
added to only match at the end of the filename.
Fix#16
- this method will now look for both of the following references, this
commit adds support for (2)
(1) <h1><a name="href">Reference Text</a></h1>
and
(2) <h1 id="href">Reference Text</h1>
1. create markup namespace to hold Markup protocol and its Markdown and
Asciidoc implementations.
2. Update compiler ns to iterate through available Markups and pass
Markup to fns that need Markup info.
3. Refactor compiler ns parse fns to be more granular.