Commit graph

462 commits

Author SHA1 Message Date
Vincent Prouillet 5532f62c2d Check for paths collisions
Closes #366
2020-02-02 17:48:43 -08:00
Vincent Prouillet 6153d20047 Link to issues for regression tests 2020-02-02 17:48:43 -08:00
Philipp Oppermann 3362df4a48 Compute canonical path before adjusting parent path (#856)
* Compute canonical path before adjusting parent path

* Don't use adjusted `parent` to recalculate `canonical` in `find_language`

* Add regression tests

- Test for correct canonical field when calling `new_page`
- Test for correct canonical field after calling `find_language`
2020-02-02 17:48:43 -08:00
Stan Rozenraukh a89b30073c Section extra -> SitemapEntry (#850) 2020-02-02 17:48:42 -08:00
Tjeu Kayim 75570d041a Skip link checking for URL with prefix in config (#846) 2020-02-02 17:47:01 -08:00
Morgan e8dc33ad08 fixes #844 duplicate entries in doc (#845) 2020-02-02 17:47:01 -08:00
Laurent Arnoud aaaed31f9c Add title and body to alias page (#830) 2020-02-02 17:45:16 -08:00
Vincent Prouillet d624f7ec8b Update base64 2020-02-02 17:45:16 -08:00
Geobert Quach 3f166285de Paginator total pages (#829)
* feat(pagination): Add `total_pages` in paginator object

* feat(pagination): Added doc for `total_pages`

* feat(pagination): Added test for `total_pages`
2020-02-02 17:45:16 -08:00
Jochen Kupperschmidt 587d7396b3 Properly escape & in injected live-reload script tag (#825)
"[…] `&` normally indicates the start of a character entity reference or
numeric character reference; writing it as `&` […] allows `&` to be
included in the content of an element or in the value of an attribute."

From: https://en.wikipedia.org/wiki/HTML#Character_and_entity_references
2020-02-02 17:45:16 -08:00
Jochen Kupperschmidt b3bc8a8896 Do not attempt to serve on "well-known" ports (#824) 2020-02-02 17:45:16 -08:00
Vincent Prouillet 243702e2c2 Update tera 2020-02-02 17:45:16 -08:00
Tjeu Kayim 6149fd17e1 Skip anchor checking for URL with prefix in config (#812)
* cargo fmt & clippy

* Skip anchor checking for URL with prefix in config
2020-02-02 17:45:16 -08:00
Bob 4aa2ba84fc Let toc is visable through Page & Section variables in templates (#818)
* Let toc is visable through Page & Section variables in templates

* Removed the current toc variable from page & section
2020-02-02 17:44:38 -08:00
Michael Macias b1ceb3e80e rendering: Avoid prepending URL prefix to links that start with a scheme (#817)
Links that start with a scheme (e.g., `tel:18008675309`) inadvertently
had a URL prefix prepended. Previously, only `mailto:` was handled, but
given the sheer number of [registered URI schemes][uri-schemes], a loose
pattern matcher is used to detect schemes instead.

External links, as identified by the renderer, are now limited to `http`
and `https` schemes.

Fixes #747 and fixes #816.

[uri-schemes]: https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
2020-02-02 17:44:38 -08:00
Arne Beer f96aad2fdd Only shrink when resizing with fit (#803) 2019-09-24 16:54:14 -07:00
Vincent Prouillet 5844047435 Update slotmap 2019-09-16 11:44:39 +02:00
Marcus Klaas de Vries 4fd5d3f348 Bump pulldown_cmark to version 0.6.0 (#797)
* Bump pulldown_cmark to version 0.6.0

* Rename headers to headings
2019-09-06 23:36:30 +02:00
Neil Kistner 52c2b74b39 Add anchor existence checking to link_checker component (#786)
* Add anchor existant checking to link_checker component

* Oops, forgot some changes

* Drop scraper dependency and rework tests

* Handle name attributes
2019-09-04 20:31:19 +02:00
Zdenek Crha 096fefe7ed Remove pub visibility from Config::translations hash (#796)
The access to translations is not straightforward and requires checks if
language and key exists. It is better to forbit direct access to
attribute and provide method - `get_translation()` - that will handle
all details of key translations.

Remove unit tests that use direct access and test only public method.
2019-09-04 20:30:32 +02:00
Bob 9db9fc8fb2 Fix the issue of generating the search index for multiple language (#794)
* fix the issue of generating the search index for multiple language

* updat docs for generating the search index for multiple language

* fix failed tests

* add tests for the search index of multiple language
2019-09-03 16:50:23 +02:00
zdenek-crha 5aadd3d4f2 Fix crash of trans() function called on absent translation key (#793)
Add method get_translation(lang, key) into Config struct that retrieves
translated term from parsed configuration or error when either
desired language or key is missing.

Use the new method in Trans struct implementing global Tera function
trans().

Add unit test to cover both happy and error path for translation
retrieval in both config and templates crate.
2019-09-03 10:51:41 +02:00
Bob e77adc56fd Fix the issue when checking the changes for multiple language section index file (#787)
* Fix the issue when checking the changes of multiple language section
2019-08-30 15:44:57 +02:00
Vincent Prouillet fb89f94516 Process images on rebuild
Closes #790
2019-08-29 20:08:04 +02:00
Vincent Prouillet b396a1bc20 Add --drafts flag + rustfmt 2019-08-24 22:23:08 +02:00
Vincent Prouillet 6a7e955ab0 Add lang to get_taxonomy & get_taxonomy_url 2019-08-15 22:14:53 +02:00
Vincent Prouillet 6d5611f409 Use new Tera escape_xml filter for xml files 2019-08-15 20:33:13 +02:00
southerntofu 4695b029a0 Fix ToC generation for heading levels > 3 (bugfix) (#774)
* Fix ToC generation for heading levels > 3

* typo

* Add tests for deep ToCs

* Code style change
2019-08-15 10:19:32 +02:00
Vincent Prouillet 8942c15428 Add to changelog + rustfmt 2019-08-13 20:02:13 +02:00
Vincent Prouillet a6db79f89b Use fixed version for syntect
>3.2.0 has an updated onig version which requires llvm
which isn't built in azure pipelines in Windows
2019-08-12 22:48:39 +02:00
Katsutoshi Horie 0238e34047 Add trailing slash to multilingual section path (#772) 2019-08-12 18:59:04 +02:00
Vincent Prouillet e231818718 Add back subsections in basic section ser
Closes #733
2019-08-10 19:21:55 +02:00
Vincent Prouillet c503a9fe5d Fix test 2019-08-10 19:09:29 +02:00
Vincent Prouillet 7f459940e1 Allow multiple taxonomies with same name in different language
Closes #766
2019-08-10 18:54:32 +02:00
Vincent Prouillet e74dab535d Update deps & re-render on anchor-link.html changes
Closes #719
2019-08-08 00:37:38 +02:00
Vincent Prouillet 0199017d07 Slugify given slugs as well 2019-08-04 16:17:02 +02:00
Pyry Kovanen 4b43b75d22 Allow ignored_content to support markdown files (#759)
* Allow ignored_content to support markdown files

* Add test for markdown supported ignored_content
2019-08-01 10:18:42 +02:00
Thomas Hurst 0cd9e58a86 Allow relative paths in new_file()/new_section() (#763)
These functions expect that file_path can have base_path stripped from
it, but during reloading they can be given relative paths.  Maybe this
behaviour varies between the notify backends?

This fixes two zola serve panics on FreeBSD (poll backend).
2019-08-01 10:17:38 +02:00
Vincent Prouillet 7e618684da Ensure public exists for search index
Closes #756
2019-07-20 16:09:17 +02:00
Vincent Prouillet 0e4e0c35b3 Remove all draft specific code 2019-07-19 11:10:28 +02:00
Vincent Prouillet 99abbb87a1
Set up CI with Azure Pipelines (#750)
* Set up CI with Azure Pipelines

[skip ci]

* Remove other CI + remove newline in anchor link tpl

* Some more Windows specific changes
2019-07-19 10:35:31 +02:00
lsm d0167647a8 fixed tags in draft not found error (#753) 2019-07-19 09:45:15 +02:00
Vincent Prouillet af00a2e8f1 Add tests for custom url scheme 2019-07-15 20:18:24 +02:00
Vincent Prouillet 7c3a112d7d Render draft pages in serve mode 2019-07-12 23:47:15 +02:00
Vincent Prouillet 28ecf553d5 Add counts in zola check
Closes #726
2019-07-12 23:38:46 +02:00
Vincent Prouillet f5c7b44027 Add warning for old style internal link + fix one 2019-07-12 22:56:07 +02:00
Vincent Prouillet d2a62153d7 Do not load draft pages
Part fix of #742
2019-07-12 22:54:18 +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
Jakub Wieczorek b716401217 Fix warnings caused by unnecessary mut qualifiers (#735) 2019-07-12 22:54:18 +02:00
Vincent Prouillet 627222afad Update sitemaps namespace
Closes #722
2019-07-12 22:54:18 +02:00
Igor Gnatenko d43812dee6 chore: Update toml to 0.5 everywhere
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2019-07-12 22:54:18 +02:00
Vincent Prouillet df720a5baf Update deps 2019-06-21 09:24:14 +02:00
Vincent Prouillet fec33c8e8b
Merge pull request #706 from elbaro/next
Round up reading time
2019-06-20 10:00:22 +02:00
Vincent Prouillet dc4904dd5f Update escaping with latest version of Tera 2019-06-16 12:17:13 +02:00
elbaro 237671a0b2 Round up reading time 2019-06-16 15:38:49 +09:00
Vincent Prouillet 35138468ac Urlencode urls in xml templates 2019-06-15 11:49:47 +02:00
Vincent Prouillet 0aee33f9c5 Add very copy/pasty impl of anchor checking 2019-06-06 19:49:40 +02:00
Vincent Prouillet 83cf19877a
Merge pull request #703 from cbiffle/master
Add XML declarations to XML templates.
2019-06-05 19:21:28 +02:00
Cliff L. Biffle eba9726d07 Add XML declaration to XML templates.
Without this, at least one search engine spider was generating a
validation warning.
2019-06-05 08:03:22 -07:00
Vincent Prouillet 76dc62ac49 Copy static folders after processing images when building 2019-06-03 11:29:44 +02:00
Vincent Prouillet cb962f7a64 Add aliases to sections 2019-06-02 20:21:06 +02:00
Igor Gnatenko 1a05401ecd chore: Update glob to 0.3 (#700)
* chore: Update glob to 0.3

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>

* chore: Update ws to 0.8

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2019-05-31 22:46:48 +02:00
Vincent Prouillet debb1529ce Merge branch 'next' of github.com:getzola/zola into next 2019-05-30 20:08:51 +02:00
Stuart Small 12d2576fba Fix for #632 - add ability to get asset image dimensions (#670) 2019-05-30 20:06:24 +02:00
Vincent Prouillet fae644cffe Update pulldown_cmark
Close #693
2019-05-29 20:33:36 +02:00
Marcus Klaas de Vries bada9ab93f Touch up dead link error message (#698) 2019-05-27 16:24:42 +02:00
Vincent Prouillet ec61a57841 Use @/ for internal links rather than ./
Close #686
2019-05-27 14:35:18 +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
Chris Morgan 1a9ab968fe Allow manual specification of header IDs (#685)
Justification for this feature is added in the docs.

Precedent for the precise syntax: Hugo.

Hugo puts this syntax behind a preference named headerIds, and automatic
header ID generation behind a preference named autoHeaderIds, with both
enabled by default. I have not implemented a switch to disable this.

My suggestion for a workaround for the improbable case of desiring a
literal “{#…}” at the end of a header is to replace `}` with `&#125;`.

The algorithm I have used is not identical to [that
which Hugo uses][0], because Hugo’s looks to work at the source level,
whereas here we work at the pulldown-cmark event level, which is
generally more sane, but potentially limiting for extremely esoteric
IDs.

Practical differences in implementation from Hugo (based purely on
reading [blackfriday’s implementation][0], not actually trying it):

- I believe Hugo would treat `# Foo {#*bar*}` as a heading with text
  “Foo” and ID `*bar*`, since it is working at the source level; whereas
  this code turns it into a heading with HTML `Foo {#<em>bar</em>}`, as
  it works at the pulldown-cmark event level and doesn’t go out of its
  way to make that work (I’m not familiar with pulldown-cmark, but I get
  the impression that you could make it work Hugo’s way on this point).
  The difference should be negligible: only *very* esoteric hashes would
  include magic Markdown characters.

- Hugo will automatically generate an ID for `{#}`, whereas what I’ve
  coded here will yield a blank ID instead (which feels more correct to
  me—`None` versus `Some("")`, and all that).

In practice the results should be identical.

Fixes #433.

[0]: a477dd1646/block.go (L218-L234)
2019-05-20 13:08:49 -07: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 55a166ac9e Fix dodgy test 2019-05-17 07:53:07 -07:00
Vincent Prouillet 52f6072ea6 Use file path rather than page path for assets
Closes #674
2019-05-15 21:40:59 -07: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 603906de85 Add a test for local time in TOML 2019-04-18 18:55:09 +02:00
Vincent Prouillet 5604738048
Merge pull request #660 from bdjnk/strip_shortcode_outer_newlines
strip wrapping whitespace from newline outward from shortcodes
2019-04-17 19:29:07 +02:00
Konrad Gądek d9122b105e Sort sitemap elements by permalink
This feature was originally reported in #257 and got fixed in
3a2dab5974, however it seems this
got lost during development.

Closes #661
Ref #257
2019-04-13 19:06:39 +02:00
Michael Plotke 2804b40875 strip wrapping whitespace from newline outward from shortcodes 2019-04-10 13:31:33 -04:00
sebastien c2f682ede6 specify proper sitemap schema 2019-04-02 18:31:50 +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 97e796a724 More tests for load_data 2019-03-22 20:44:06 +01:00
Vincent Prouillet e00cd3e1b0 Always default to plain for load_data on unknown extensions 2019-03-22 20:34:02 +01:00
Vincent Prouillet 283a15cd93 Fix some deprecation notice of pest 2019-03-19 21:35:49 +01:00
Vincent Prouillet 2a8d0de532 Pass extra for page in sitemap entries 2019-03-19 20:42:16 +01:00
Vincent Prouillet c63b7fde44 load_data now defaults to plain type + fix bug with get_taxonomy fn 2019-03-16 10:01:11 +01:00
Vincent Prouillet 3eaf13d49b Update pulldown_cmark 2019-03-15 21:29:51 +01:00
Vincent Prouillet 8a802b1828 Make sitemap entries in a set
Close #633
2019-03-14 21:53:29 +01:00
Vincent Prouillet 9beaa26023 Add link to sitemap to robots.txt 2019-03-14 21:30:53 +01:00
Vincent Prouillet 7baf08cef2 Update docs for sitemap 2019-03-14 21:15:01 +01:00
Sébastien Mariaux 2a0d0b9b77 Split sitemap (#619)
Split sitemap when it is getting too big
2019-03-14 20:57:22 +01:00
Vincent Prouillet 3b8a95eb8f Generate assets before rendering templates 2019-03-11 20:25:28 +01:00
Vincent Prouillet 135dc5d5bc Change default directory for load_data 2019-03-11 20:21:13 +01:00
Vincent Prouillet eccb1e9986 Strip base_path from page/section paths
To ensure we will get the right `content`
directory.
Fix #629
2019-03-08 23:30:43 +01:00
Vincent Prouillet 974492bb7b Ensure we don't delete root index without
adding back default in rebuild

Fix #620
2019-02-22 21:48:31 +01:00
Vincent Prouillet 11c58458e8 Revert useless change in shortcodes 2019-02-22 21:02:42 +01:00
Vincent Prouillet 84f10f6b69 Use platform separator for shortcodes paths 2019-02-16 16:32:11 +01:00
Vincent Prouillet 25b943ec35 Print list of template names to debug Windows error 2019-02-16 15:40:59 +01:00
Vincent Prouillet 42089a18ba
Merge pull request #609 from mziter/next
Handle csv parsing error when encountering rows with different lengths
2019-02-16 08:59:56 +01:00
Vincent Prouillet 705a30aa8d Move toc to be a rendering page/section variable level 2019-02-09 20:49:18 +01:00
Vincent Prouillet 9bc675f2a7 Fix colocated dates + rustfmt
Closes #607
2019-02-09 19:54:47 +01:00