cobalt.rs/tests/target/sort_posts
Stas Rudakou bd120ee796 Refactor methods for rendering documents, add excerpts and fix content attributes (#147)
* Don't render documents without `extends` twice

`liquid_escaped` test case was red before the fix:
`tests/fixtures/liquid_escaped/not-extends.liquid` renders invalid
liquid markup, so cobalt used to panic when it rendered this document
twice.

* Move lines in `Document::as_html` to improve readability

* Reorganize the code for rendering documents

This doesn't change flow, that's just a prerequisite for adding
excerpts.

* Add excerpts test fixture based on a vanilla `cobalt new` project

* Add several posts with different kinds of excerpts to `excerpts` fixture/target

* Add .liquid posts to  fixture/target

* Split front matter using an improved regex

The default excerpt separator is \n\n. If the linefeed after "---" is a
part of content, a document starting from one blank line will have an
empty excerpt.

\r is there because they use both \r and \n on Windows.

* Add jekyll-like excerpts to posts

It doesn't make sense to add excerpts to other documents as they are not
injected to rendering context like "posts" is. So we won't do it to save
some CPU time.

* Cache layouts to avoid repeated fs calls and memory allocations

Fixes #120 (we don't need to use mutex here because crossbeam has been
removed in #146).
2016-11-04 21:44:03 +01:00
..
posts Ignore underscored directories by default 2016-07-03 10:53:31 +02:00
index.html Refactor methods for rendering documents, add excerpts and fix content attributes (#147) 2016-11-04 21:44:03 +01:00