Commit graph

334 commits

Author SHA1 Message Date
Vincent Prouillet
0e4e0c35b3 Remove all draft specific code 2019-07-19 11:10:28 +02:00
Vincent Prouillet
ad6b713759 Do not use serve remove dir result
Closes #752
2019-07-17 09:55:14 +02:00
Vincent Prouillet
7c3a112d7d Render draft pages in serve mode 2019-07-12 23:47:15 +02:00
Vincent Prouillet
a923f7005f Update site summary in zola check 2019-07-12 23:43:07 +02:00
Vincent Prouillet
28ecf553d5 Add counts in zola check
Closes #726
2019-07-12 23:38:46 +02:00
traviscross
46ee256ba4 Fix clippy warnings (#744)
Clippy is returning some warnings.  Let's fix or explicitly ignore
them.  In particular:

- In `components/imageproc/src/lib.rs`, we implement `Hash` explicitly
  but derive `PartialEq`.  We need to maintain the property that two
  keys being equal implies the hashes of those two keys are equal.
  Our `Hash` implementations preserve this, so we'll explicitly ignore
  the warnings.

- In `components/site/src/lib.rs`, we were calling `.into()` on some
  values that are already of the correct type.

- In `components/site/src/lib.rs`, we were using `.map(|x| *x)` in
  iterator chains to remove a level of indirection; we can instead say
  `.copied()` (introduced in Rust v1.36) or `.cloned()`.  Using
  `.copied` here is better from a type-checking point of view, but
  we'll use `.cloned` for now as Rust v1.36 was only recently
  released.

- In `components/templates/src/filters.rs` and
  `components/utils/src/site.rs`, we were taking `HashMap`s as
  function arguments but not generically accepting alternate `Hasher`
  implementations.

- In `src/cmd/check.rs`, we use `env::current_dir()` as a default
  value, but our use of `unwrap_or` meant that we would always
  retrieve the current directory even when not needed.

- In `components/errors/src/lib.rs`, we can use `if let` rather than
  `match`.

- In `components/library/src/content/page.rs`, we can collapse a
  nested conditional into `else if let ...`.

- In `components/library/src/sorting.rs`, a function takes `&&Page`
  arguments.  Clippy warns about this for efficiency reasons, but
  we're doing it here to match a particular sorting API, so we'll
  explicitly ignore the warning.
2019-07-12 22:54:18 +02:00
Jakub Turski
8a737d71fb Add an option to hard link files from static/ instead of copying. (#723)
* Add hard_link_static config option.

* Copy or hardlink file depending on an argument.

Modify the call sites for `copy_file` to account for the extra argument.

* Plug the config setting through to copy_file.

Don't apply the config option to theme's static directory.

* Update documentation.

* Backticks make no sense in this comment.

* Addressing PR comments.

* Be consistent with argument naming.
2019-07-12 22:54:18 +02:00
Tim Visée
90dad05c67 Add --open flag to serve command, to open URL in default browser (#739)
* Add --open flag to serve command, to open URL in default browser

* Mention serve --open flag in CLI documentation
2019-07-12 22:54:18 +02:00
Sam Ford
059ca55b36 Update LiveReload.js to v3.0.0 (#730) 2019-07-12 22:54:18 +02:00
Vincent Prouillet
9df9465080 Only check for port availability when not in watch-only for serve
Closes #712
2019-06-21 20:02:51 +02:00
Sam Ford
39f97f1520
Update actix-web to 1.0
* actix_web::fs is now found in the actix-files crate.

* NotFoundHandler is now implemented using ErrorHandlers and the
path to 404.html is provided to the not_found() function using
actix_web::App::data. This setup allows for additional StatusCodes
to be handled in the future, if desired.

* Cleanly serving index.html files for requests to directories now
appears to be possible simply by using index_file("index.html") in
the static files service, so handle_directory() is removed.
2019-06-18 19:05:00 -04:00
Vincent Prouillet
cb962f7a64 Add aliases to sections 2019-06-02 20:21:06 +02:00
Vincent Prouillet
717f2112bb Add chmod to list of events on which to rebuild on serve 2019-05-27 19:51:43 +02:00
Marcus Klaas de Vries
0d964204c3 Check command global (#683)
* Add check subcommand

* Add some brief documentation for the check subcommand

* Start working on parallel link checks

* Check all external links in Site

* Return *all* dead links in site
2019-05-27 14:05:07 +02:00
Vincent Prouillet
b70f9f95e3 Process images at the end of the build process
To also process the ones found in templates

Closes #669
2019-05-20 11:29:54 +02:00
Vincent Prouillet
debe0633bc Revert "Allow default base-path command line option to be set for building and serving"
This reverts commit 1815155c1d.
2019-04-20 12:50:34 +02:00
Vincent Prouillet
2aa3ea758b Set content-type for livereload script
Closes #667
2019-04-18 19:11:06 +02:00
Blake Smith
1815155c1d Allow default base-path command line option to be set for building and serving 2019-03-23 20:25:56 -05:00
Vincent Prouillet
9bc675f2a7 Fix colocated dates + rustfmt
Closes #607
2019-02-09 19:54:47 +01:00
Vincent Prouillet
776bf41123 Show actual Tera source error 2019-01-30 20:42:53 +01:00
Peng Guanwen
0b897ce7c7 Replace trim_{left, right} with trim_{start, end}
trim_{start, end} is introduced in rust 1.30.0 and
trim_{left, right} is deprecated since 1.33.0.
2019-01-29 16:30:54 +08:00
Vincent Prouillet
21d67235ae Arc-ify Library 2019-01-27 18:57:07 +01:00
Robert O'Callahan
986c49daf1 Fix --watch-only to actually rebuild the site 2019-01-25 13:48:45 +13:00
Vincent Prouillet
5caf24f06c Remove error-chain
Closes #576
2019-01-17 14:31:47 +01:00
Vincent Prouillet
0f0304d7ed Mention build rm the directory 2019-01-05 11:04:12 +01:00
Vincent Prouillet
c441f5e857 Lower serve latency
Closes #554
2019-01-05 11:02:47 +01:00
Vincent Prouillet
a12e9512bc fmt/clippy 2018-12-29 11:17:43 +01:00
Vincent Prouillet
7af314c61e Update deps + fmt 2018-11-14 17:34:21 +01:00
Vincent Prouillet
afc30543cc Handle file/dir renaming
Closes #385
2018-11-10 22:23:39 +01:00
Vincent Prouillet
d3bd22cfc4 Update changelog 2018-11-03 14:11:38 +01:00
Vincent Prouillet
a799384f38
Merge pull request #450 from FreeMasen/next
add watch command
2018-11-03 13:49:39 +01:00
Robert Masen
1ec2694acc reset color in colorize 2018-11-01 19:59:02 -05:00
Robert Masen
e0f90eed4a remove debug-println! 2018-11-01 17:52:23 -05:00
Robert Masen
b7c3d7199d add --watch-only flag 2018-11-01 17:20:35 -05:00
Vincent Prouillet
b7ce4e59fb rustfmt 2018-10-31 08:18:57 +01:00
Jake Howard
aad12d829f Remote data (#494) 2018-10-29 20:13:09 +01:00
Vincent Prouillet
4c9fd0d302 Do not panic if something is already bound to 1111 in serve 2018-10-19 16:33:11 +02:00
Vincent Prouillet
f84ae7c93b Rename all occurrences of gutenberg to zola in code 2018-10-18 22:50:06 +02:00
Vincent Prouillet
652196969c templates folder is now optional for serve
Fix #445
2018-10-11 20:52:42 +02:00
Vincent Prouillet
0ce3a0f070
Merge pull request #459 from Keats/database
Slotmap refactor
2018-10-09 11:30:49 +02:00
Vincent Prouillet
10aba20fe5 Slotmap refactor 2018-10-03 16:29:29 +02:00
Vladislav Supalov
ca982a268f Replace hard-coded directory slash in serve output (#457)
* Replace hard-coded directory slash in serve output
2018-10-02 11:31:18 +02:00
Christian Friedrich Coors
85529186e4 Fix some clippy warnings 2018-09-30 21:15:09 +02:00
Greizgh
b8233af2c4 Allow to disable colors through env vars
- unless forced, only use colors in tty
- support CLICOLOR and NO_COLOR vars
- switch to termcolor crate to handle output coloring
2018-09-24 19:19:34 +02:00
Vincent Prouillet
58e2793097 Ignore one more type of emacs temp file 2018-09-13 16:57:38 +02:00
Vincent Prouillet
ae7a65b51f Fix base-url not overriding processed images urls
Closes #418
2018-09-10 20:30:59 +02:00
Johan Sigfrids
883357a7dd Handle relative path case 2018-08-05 08:59:56 +03:00
Johan Sigfrids
9be5e640ff Only test windows path handling on windows.
Otherwise Path won't know what to do.
2018-08-04 23:28:39 +03:00
Johan Sigfrids
64ec7e1578 Fix path handling on windows.
Delay turning paths into string. Instead, use methods on Path/PathBuf
to manipulate paths. This way the Rust Path implementation gets to deal with
all werid cross-platform issues.

This should fix #359
2018-08-04 22:47:45 +03:00
Vincent Prouillet
a83518a29b Update warning message to use weight 2018-07-31 15:39:20 +02:00
Vincent Prouillet
a958f96955 Update actix 2018-07-22 12:14:16 +02:00
Owen Nelson
8f460dc28b Custom 404 page now template driven.
Since we are using a builtin template, we can be assured to have the
target file in place. Middleware renamed since it is bound directly to
the concept of handling 404s.
2018-06-25 23:24:57 -07:00
Owen Nelson
7ab22528a5 WIP Custom 404 page.
This is a proposed successor to #296 (rewritten for actix-web, rather
than iron).
2018-06-25 21:47:37 -07:00
eir
17106be497 Send Appropriate Response on Error
Users can now place custom error pages in static/error/<error_code>.html
e.g. static/error/404.html

If no custom page is found, a default plaintext describing the error is served.
2018-06-25 21:42:58 -07:00
Vincent Prouillet
42939b9a66 Fix error and cargo update 2018-06-25 18:08:20 +02:00
Unreal Hoang
ffcc455ed5 Fix panicking handling file without extension 2018-06-25 18:07:41 +02:00
Owen Nelson
0e0cd244f3 Fix error handling put in place to side-step a confusing compiler error.
I filed actix/actix-web#261 as per the maintaner's request while
working on #310.

Having looked at the issue this morning, it appeared there was an
implementation to convert `io::Result` into a `Responder`, which kicked
in when I tried to access the `respond_to()` method without getting the
inner type from that first result before hand.
2018-06-25 18:07:41 +02:00
Owen Nelson
45156c46c9 map actix_web::error::Error to std::io::Error as string.
Conversion is by way of the `Display` trait impl since the actix errors
all seem to be more concerned with converting to/from http responses
rather than standard errors.
2018-06-25 18:07:41 +02:00
Owen Nelson
908f16855a Fixes #279 switch from iron to actix-web.
This implementation seems to match the behavior of the previous iron
server.

Static files are rendered as-is, and when a directory is requested, we
attempt to render a `index.html` found inside, or 404 if it's not
present.

The actix docs mention using channels to send a message to the server to
shut it down gracefully while running in another thread (as we're doing
here), but it seems like there would have to be some reorganization in
order to manage this effectively, perhaps holding the channel sender inside
`main.rs` so we can push a message through to the server when the call
to `cmd::serve()` finally returns.

For the time being, I left things without any careful attempts to
cleanup the server thread. This more or less matches the old iron
implementation as far as I can see.

The static file handling in actix is _just_ a little off from what we'd
want.
I left some comments in the source regarding why we can't just use their hook
for directory index redirection.
2018-06-25 18:07:41 +02:00
Vojtech Kral
6662014e55 Add image resizing support #225 2018-06-25 18:05:04 +02:00
Vincent Prouillet
b892c07ed3 Don't hardcode the ws port
Closes #282
2018-06-25 17:59:04 +02:00
Vincent Prouillet
50a79c52f3 Fix serve not working with config flag
Closes #294
2018-06-25 17:58:27 +02:00
Vincent Prouillet
73ddbf7152 Write some docs 2018-03-21 16:18:24 +01:00
Vincent Prouillet
f1abbd0860 Move copy utils to utils crate 2018-03-20 18:43:17 +01:00
Vincent Prouillet
2eacb8247b Fix config CLI option
Closes #254
2018-03-16 19:11:12 +01:00
Vincent Prouillet
b3b2527c5d TIL about serde default 2018-03-12 20:11:03 +01:00
Andrew Zah
f5ced05926 Separate interface and base url for gutenberg serve (#223)
Separate interface and base_url for serve

You can now have a different base_url and listening interface.
The `gutenberg serve` cmd now accepts `-u`/`--base-url`, but it defaults to `127.0.0.1`.
2018-02-02 17:18:07 +01:00
Vincent Prouillet
16f658c70c Move test_site and turn rebuild.rs into a component 2018-01-29 18:40:12 +01:00
Vincent Prouillet
a44dd5f49a serve cleans after itself now
Closes #199
2018-01-22 18:11:28 +01:00
Vincent Prouillet
f37992e03a Do not unwrap on serve 2018-01-22 13:46:36 +01:00
Thomas Vincent
67eca7731f Reload on config change (#206)
* Trigger rebuild when `config.toml` is edited
2018-01-12 11:50:29 +01:00
Vincent Prouillet
892c987152 Livereload shortcode changes
Fix #204
2018-01-09 23:39:21 +01:00
Vincent Prouillet
14edd2b875 Add output-dir option to build & serve
From #191
2017-12-29 19:26:17 +01:00
Vincent Prouillet
129e693521 Add default templates 2017-11-27 18:09:09 +01:00
Thomas Vincent
78a3602454 Add the detection of ChangeKind::Sass to tests 2017-11-21 00:05:37 +01:00
Vincent Prouillet
1d8df5774f Allow static folder to be missing 2017-10-25 14:49:54 +02:00
Vincent Prouillet
e06611f46f Forgot to let base-url take a value >_> 2017-10-17 11:47:30 +02:00
Vincent Prouillet
d2177df838 Stop using clap macro 2017-10-16 22:48:59 +02:00
Vincent Prouillet
73797efe90 Add a base-url flag to the build command 2017-10-05 10:56:13 +09:00
Vincent Prouillet
20c1947b47 Clippy run 2017-10-02 20:16:56 +09:00
Vincent Prouillet
dee1dbe667 Working on site
And some tweaks as I write the docs
2017-09-29 15:37:58 +09:00
Vincent Prouillet
de5d711771 Use flags for port/interface in serve cmd 2017-09-27 21:51:10 +09:00
Vincent Prouillet
5d7e0bb33e Register all Tera global fns on change 2017-09-26 17:25:55 +09:00
Vincent Prouillet
a07835bbe3 Ignore folder change on live reload. Close #118 2017-09-12 15:57:51 +09:00
Vincent Prouillet
f58e416b96 Clippy run 2017-08-31 18:01:26 +09:00
Vincent Prouillet
699ffb07ce Create themes folder on init 2017-08-25 08:43:54 +09:00
Vincent Prouillet
c77cc9b170 First draft of theme support 2017-08-23 19:17:24 +09:00
Vincent Prouillet
23e4b911e7 Improve gutenberg init
Fix #104
2017-07-27 18:28:06 +09:00
Vincent Prouillet
2ea77f3883 Generate completions for all shells 2017-07-15 13:24:31 +09:00
Vincent Prouillet
d78477b619 Add Sass support for *nix 2017-07-06 22:19:50 +09:00
Vincent Prouillet
c3b525745e Convert project to a workspace 2017-07-01 16:47:41 +09:00
Vincent Prouillet
11c89fa663 Sorting benches 2017-07-01 12:06:49 +09:00
Vincent Prouillet
1f1fc3f454 Remove section from page context 2017-06-29 22:19:54 +09:00
Vincent Prouillet
c7bea0bc54 Add weight sorting 2017-06-29 16:11:15 +09:00
Vincent Prouillet
7768a0cc12 Bench + parallelize more things 2017-06-27 22:39:04 +09:00
Vincent Prouillet
b158ca7952 Read off disk in parallel 2017-06-22 14:21:56 +09:00
Vincent Prouillet
b45f8c3116 Merge pull request #89 from williamyaoh/add-parallel
Parallelize site rendering using rayon
2017-06-21 18:14:30 +09:00
Vincent Prouillet
414457ed92 Get assets of page only if file is named index.md 2017-06-21 18:07:40 +09:00
William Yao
2109787625 coalesce syntect data structures into rendering::highlighting (Keats/gutenberg#89) 2017-06-21 04:00:37 -05:00
William Yao
b759cf7681 parallelize site rendering with rayon (Keats/gutenberg#70) 2017-06-21 04:00:37 -05:00
Vincent Prouillet
6508b7e4d3 Name the index section 2017-06-19 18:14:13 +09:00
Vincent Prouillet
03bbe9cc90 Revert "Reverse order sorting to be desc"
This reverts commit 26e119479c.
2017-06-17 08:42:18 +09:00
Vincent Prouillet
6a059d86d0 Add aliases to pages. Fix #86 2017-06-16 23:09:01 +09:00
Vincent Prouillet
26e119479c Reverse order sorting to be desc 2017-06-16 22:12:38 +09:00
Vincent Prouillet
e76ee7ae4a Pass section in context when rendering a page if there is one 2017-06-16 21:53:54 +09:00
Vincent Prouillet
c3986b701a Add table of contents support 2017-06-16 13:00:48 +09:00
Vincent Prouillet
2d949249c3 Add trailing slash to paths and permalinks. Fix #85 2017-06-11 02:52:39 +09:00
Vincent Prouillet
0037f743cd Add license of livereload-js in serve.rs 2017-06-07 18:25:59 +09:00
William Yao
4c9d1e3af7 Add shortcode for Streamable videos (Electric Boogaloo) (#80)
Add shortcode for Streamable video
2017-06-06 12:51:20 +09:00
Vincent Prouillet
ffe8a24333 Sort tag/category page by date
Fix #75
2017-05-30 19:23:10 +09:00
Vincent Prouillet
bae3ade471 Add get_section fn and update readme 2017-05-23 20:03:25 +09:00
Vincent Prouillet
958f1cf88c Update Tera and fix tests 2017-05-23 19:49:10 +09:00
Vincent Prouillet
3fb06ac791 Clippy 2017-05-22 20:58:28 +09:00
Vincent Prouillet
92d81509d3 Rebuild pages on changes to insert_anchor 2017-05-22 20:56:37 +09:00
Vincent Prouillet
916f7407db Rename anchor link class 2017-05-22 20:44:33 +09:00
Vincent Prouillet
efb4d16ede Remove next/previous page when adding a previous/next to avoid chains
Where all the posts would be serialized
2017-05-22 20:38:04 +09:00
Vincent Prouillet
dbe4a1d517 Move insert_anchor to section and allow left/right 2017-05-22 20:28:43 +09:00
Vincent Prouillet
2a11b9d116 Better error if address in use
Fix #72
2017-05-21 00:00:42 +09:00
Vincent Prouillet
33faf6fe70 Make number RSS item configurable
Fix #71
2017-05-20 23:45:32 +09:00
Vincent Prouillet
26159609d2 Add a rendering module 2017-05-17 21:53:26 +09:00
Vincent Prouillet
b2a63e2ada Add a get_url global fn
Close #67
2017-05-17 19:06:11 +09:00
Vincent Prouillet
59b4b07cb3 Use Path for fs utils rather than AsRef 2017-05-16 14:54:50 +09:00
Vincent Prouillet
be784bbaa3 Refactor taxonomies
Fix #66
2017-05-16 13:39:42 +09:00
Vincent Prouillet
056bf55881 Add a FileInfo struct to hold some common data about the files 2017-05-15 19:53:39 +09:00
Vincent Prouillet
d9ed7df118 Minify livereload.js 2017-05-15 17:11:14 +09:00
Vincent Prouillet
b2c3adff37 Move page tests inside content mod 2017-05-15 17:02:38 +09:00
Vincent Prouillet
4f27dc2f18 Move find_content_components to content mod 2017-05-15 16:26:11 +09:00
Vincent Prouillet
86b6bd80c3 Fix SectionFrontMatter default 2017-05-15 14:59:14 +09:00
Vincent Prouillet
c35b76406e Move stuff around a bit more 2017-05-15 12:23:19 +09:00
Vincent Prouillet
07f11755d6 Create a content mod 2017-05-14 14:14:58 +09:00
Vincent Prouillet
09d5e74a65 Smarter rebuild on content change
Fix #59
2017-05-13 22:37:02 +09:00
Vincent Prouillet
76527801ce Move render_alias to templates mod 2017-05-13 13:05:38 +09:00
Vincent Prouillet
299c3c8b22 Separate Page and Section front matter into 2 structs
Fix #61
2017-05-13 13:01:39 +09:00
Vincent Prouillet
bb3cba1ad5 Move adding filters to the templates mod 2017-05-13 11:45:29 +09:00
Vincent Prouillet
72c626ee55 Move all tera stuff into a templates mod 2017-05-12 23:27:22 +09:00
Vincent Prouillet
2fb4e2b01d Move all printing in cli to the console file 2017-05-12 23:10:21 +09:00
Vincent Prouillet
2a150299f3 Move cli code to bin directory 2017-05-12 22:59:41 +09:00
Vincent Prouillet
5ac5625de1 Default to not generating tags and categories page
Also add a Site::render_section method
2017-05-12 22:54:13 +09:00
Vincent Prouillet
ab3e04c9e5 Do not count the index as a section when printing 2017-05-12 21:30:59 +09:00
Vincent Prouillet
c791dffae5 Use livereload properly. Fix #10 2017-05-12 21:15:50 +09:00
Vincent Prouillet
8711c9a3c0 Change Site::section and fix empty paginated sections 2017-05-12 20:24:44 +09:00
Vincent Prouillet
c565f10cb3 Let sections have their own body 2017-05-12 18:05:00 +09:00
Vincent Prouillet
005990a928 Create a default index section if there is none 2017-05-12 16:30:01 +09:00
Vincent Prouillet
939b699518 Clippy 2017-05-11 15:45:19 +09:00
Vincent Prouillet
1e0744601e Slighty smarter rebuild on page content change 2017-05-11 14:53:52 +09:00
Vincent Prouillet
6f5e008853 Add global get_page tera fn 2017-05-10 12:17:15 +09:00
Vincent Prouillet
c989ab607c Add orphan in print notice and fix orphan with assets and url 2017-05-09 21:47:02 +09:00
Vincent Prouillet
f3edef2640 Warn about ignored pages 2017-05-09 21:12:10 +09:00
Vincent Prouillet
7099fc8ac2 Add frontmatter flag to not render a section
Useful if you're creating a section only to access it in the index but
do not want a section page for it
2017-05-09 20:39:42 +09:00
Vincent Prouillet
4df9752b54 Pass the <directory, section> to the index 2017-05-09 20:24:44 +09:00