Commit graph

65 commits

Author SHA1 Message Date
Ed Page
023e7879f2 refactor: Convert to assert_fs/assert_cmd
The tests are now operating in a more standard use case thanks to the
ability to easily setup. The are running in the CWD rather than all the
paths artifically being set.

Fixes #381
2018-08-02 06:12:52 -06:00
Ed Page
32bf4a42e2 chore: Upgrade dependencies 2018-06-25 10:00:39 -06:00
Ed Page
de7f246097 chore: Update CI 2018-06-25 09:03:48 -06:00
Ed Page
821c106dc3 style: Update rustfmt 2018-03-03 20:55:04 -07:00
Ed Page
373651b972 refactor(config): Remove dependence on config
Most of the code is decoupled from config.
- This will help in evolving
- This helps decouple other things, like `new` not needing to load
  layouts.
2018-03-03 12:58:37 -07:00
Ed Page
b2cbe13aaa perf(layouts): Switch from lazy to eager
No idea what impact this will have on performance actually.

BREAKING CHANGE: The paths used for layouts now must be clean (no
`//./file.liquid`).
2018-03-03 12:58:07 -07:00
Ed Page
b09c59b350 refactor(config): Use path for paths 2018-03-03 12:55:37 -07:00
Geobert Quach
bc97e4ef33 refactor(build()): renamed some functions according to comments 2018-01-27 21:03:31 +00:00
Ed Page
0aedcba5fb
Merge pull request #370 from Geobert/fix#241
Fix EOL issue with tests
2018-01-27 13:12:25 -06:00
Geobert Quach
ef16be08eb fix(tests): normalizing EOL management
Closes #241
add editorconfig
add gitattributes
2018-01-27 16:14:07 +00:00
Ed Page
8fca43406d feat: Upgrade liquid
Features
* Provide context on errors (good enough for #136)
* Implement basic `compact` support

Bug Fixes
* `date_in_tz` can't parse cobalt's dates
* Improve value coercion practices
  * Every `Value` is now treated as a string.
  * Whole numbers are now preserved.
  * Whole numbers can convert to fractional numbers but not the other way
    around.
  * You can convert a fractional number to a whole number using the
    filters `round`, `ceil`, or `floor`.
  * Operations on only whole numbers preserve their whole number nature.
  * for tag ranges, indexing, etc only accept whole numbers

Fixes #136

BREAKING CHANGES: There might be minor behavior changes form the coercion
changes.
2018-01-24 06:40:15 -07:00
Ed Page
1e19ae070d feat(front): Change date to YYYY-MM-DD
Fixes #349

BREAKING CHANGE:

Frontmatter `published_date` switched from "29 December 2016 15:20:21
-0700" to "2016-12-29 15:20:21 -0700".

`cobalt migrate` should handle this for you.
2018-01-03 21:01:34 -07:00
Ed Page
34e9d545b0 feat(config): Stablize the format
The `.cobalt.yml` format should be more forward looking now, not
breaking users in the face of new featurs being added.

Features this uncovers
- Default the frontmatter for pages and posts

Fixes #199

BREAKING CHANGE: `.cobalt.yml` format change.  Run `cobalt migrate` to
convert your site to the new format.  Please backup first in case there
is an issue.
2018-01-03 21:01:34 -07:00
Ed Page
d81c1a08c8 refactor(legacy): Define the model for legacy support 2017-12-04 11:38:07 -07:00
Ed Page
d4d11277cd refactor(config): Move where legacy is handled
Originally, I hid the conversions as a hack.  This is making the
conversions to non-legacy harder, so removing it.

I temporarily disabled tests until #334
2017-12-04 11:38:07 -07:00
Ed Page
f9d2716704 refactor: Rename internal config.dest to destination 2017-10-25 05:44:04 -06:00
Ed Page
92ca0c60da fix: --destination is now relative to cwd (again)
A previous commit make the `dest` config flag relative to the config
file.  This also impacted `--destination`.  This would be unexpected, so
we now track separately the config's dest and the overridden dest so we
can properly track what they should be relative to.

This is a step towards #284.
2017-10-23 17:51:31 -06:00
Ed Page
ce95b39541 fix: source/dest are now relative to config
This is a step towards #284

BREAKING CHANGE: source/dest are now relative to your project root, as
defined by your config file.
2017-10-23 17:26:00 -06:00
Ed Page
c1cf01cd52 fix(error): Report file path on parse error 2017-10-23 17:25:59 -06:00
Ed Page
468b94f937 refactor(config): Use the builder pattern
When moving the post-processing into the builder, I went ahead and
implemented the link semantics talked about in #216.  This causes a
minor change to output.  RSS and jsonfeed's links to the main website
will not have a trailing slash which no one should notice.
2017-10-23 17:25:59 -06:00
Ed Page
1aa53d2459 fix(md): Add table/ref support
Fixes #303
2017-10-20 21:02:32 -06:00
Ed Page
ccdaef50aa fix(data,sass): Remove custom folder support
This is an attempt to try to simplify things until someone has a use
case for it.

What are the problems with custom folders?
- Less confusing to users.  When giving the user a choicem, we should be
  able to describe why they might want to make that choice.
- Less to test
- No semantic problems to worry about.
  - What should be the behavior for a non-`_`-prefixed folder
  - What should be the behavior for deeply nesting particularly with the
    above question mixed in at random points.
2017-10-20 18:18:09 -06:00
Ed Page
922f1e9b17 chore: Upgrade to rustfmt 0.8.6
The configuration was dumped to `.rustfmt.toml`, so hopefully people can
also use newer versions of rustfmt.

The config was not updated to also include the latest style RFCs just
out of laziness.
2017-10-19 21:18:31 -06:00
Benjamin Kampmann
527a85f2cc test(data-files): Add test for data file reading and processing 2017-10-18 01:41:35 +02:00
Benjamin Kampmann
9dac0b24d4 fix(scss): Allow Configuration of SCSS Options 2017-10-12 16:58:29 +02:00
Benjamin Kampmann
57f3868e53 fix(scss): Put SCSS compiling behind a feature-gate 2017-10-12 16:58:16 +02:00
Benjamin Kampmann
4ec53211ca test(scss): Add tests for SCSS compiling 2017-10-12 16:58:09 +02:00
Ed Page
1e07708bad feat: Improve reporting to user
- Provide more error context (like which file failed to parse).
- Restored logging of command failures (removed in split)
- Restored logging of successful commands (removed in split)
2017-10-07 22:26:59 -06:00
Ed Page
e2979618d5 refactor(tests): Make dir diffing reusable. 2017-09-30 20:21:55 -06:00
Ed Page
be782b5d13 tests: Changing syntax theme 2017-07-26 20:04:53 -06:00
Ed Page
cafd42fa3c feat: Support nested frontmatter
This is the alternative implementation for #193, taking advantage of
serde rather than converting YAML->Liquid by hand.
2017-07-12 07:56:42 -06:00
Ed Page
7f571a8bd5 feat: Better define when to reference url or file of a document.
This is mostly a refactoring but with the impact that `page.path` now
returns a non-exploded path.

BREAKING CHANGES: `page.path` now returns the non-exploded path.
2017-07-12 07:56:42 -06:00
Ed Page
cb98b5d054 chore: Simplify the non-draft code ... I think 2017-07-12 07:52:40 -06:00
Uwe Arzt
8a42321765 Added test, run cargo fmt in version 0.8.3 2017-06-30 10:01:49 +02:00
Ed Page
0d37993546 fix(tests): Improve error reporting 2017-05-24 16:46:59 -05:00
Ed Page
4a2e34e6b2 fix(CI): Upgrade rustfmt 2017-05-20 18:37:46 -05:00
Ed Page
eb9e0b0559 Merge pull request #217 from whostolemyhat/ignore-querystrings
Ignore querystrings
2017-05-12 09:02:36 -05:00
Ed Page
5c06950547 Merge branch 'master' into sort-order 2017-05-11 18:19:24 -05:00
James Tease
a39d6ed404 Ignore querystrings when serving locally 2017-05-11 09:19:40 +01:00
James Tease
8daadae2f9 Allow posts to be reverse sorted 2017-05-10 13:57:23 +01:00
James Tease
c2190c6ffc Add previous and next attributes to posts 2017-05-10 10:58:44 +01:00
Jan-Erik Rediger
0072eabbd1 Add minimal example without a frontmatter 2017-04-23 14:13:16 +02:00
Ed Page
e523702e36 style: Address new clippy complaints 2017-04-20 15:20:31 -05:00
Ed Page
d9a4209e20 chore: Upgrade dependencies
Upgrade notes:
- notify: Debouncing was added but have not yet switched to it because of
  the extra work to extract the relevant path

Dependencies that were held back:
- assert_cli: See killercup/assert_cli#30 and killercup/assert_cli#31
- rss: Seems they turned off XML escaping.  Didn't have time to research
  this.
2017-03-24 09:24:14 -05:00
Uwe Arzt
291229bffb Posts in subdirs (#185) 2017-02-09 23:50:09 +01:00
Benjamin Kampmann
382e5400f8 Adding syntax highlighting (#165) 2017-01-03 09:44:53 +01:00
benaryorg
53764f39fd
tests: incomplete_rss: distinct display and description
Signed-off-by: benaryorg <binary@benary.org>
2016-11-19 16:11:41 +01:00
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
Stas Rudakou
d177767c3b Use tempdir crate instead of home-grown tests/tmp
Suggested by @johannhof, closes #65
2016-10-31 01:25:43 +03:00
Johann Hofmann
4027605fe9 Draft support (#128)
* Add draft support (fixes #121)

* Add documentation for drafts

* Add support for draft front matter attributes

* Run rustfmt

* Draft related debug messages
2016-08-09 15:04:24 -06:00