mirror of
https://github.com/cobalt-org/cobalt.rs
synced 2024-11-15 08:27:15 +00:00
bd120ee796
* 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). |
||
---|---|---|
.. | ||
posts | ||
index.html |