Commit graph

621 commits

Author SHA1 Message Date
Vojtech Kral 9145af6b3e imageproc things for paths refactor (#1484)
* Move image loading code used by get_image_metadata from templates to imageproc

* resize_image: Compute image resize op beforehand and return metadata to caller

* get_image_metdata: Use a serializable response struct

* imageproc: Add integration tests

* imageproc: Assume webp is lossy

* get_image_metadata: Use webp crate for decoding WebP, image is still not very good at it

* imageproc: Test read_image_dimensions in integration tests

* imageproc: Rename read_image_dimensions() as read_image_metadata()

* imageproc: Fix a regression in hash computation

* imageproc: Don't hardcode hashes in integration tests, pattern match them instead

* imageproc: Style fixes

* imageproc: Fix integration tests on Windows (hopefully)
2021-06-10 10:26:12 +02:00
Vincent Prouillet 009d105210 Automatically trim / on Tera fn calls dealing with files 2021-06-10 10:26:12 +02:00
Vincent Prouillet ae916eb6c5 Some more tweaks 2021-06-10 10:26:12 +02:00
Vincent Prouillet a736d33afb Fix tests on Windows 2021-06-10 10:26:12 +02:00
Vincent Prouillet 9e0cac6d4d Cleanup of get_url and get_file_hash 2021-06-10 10:26:12 +02:00
Vincent Prouillet 7154e90542 Update load_data 2021-06-10 10:26:12 +02:00
Vincent Prouillet 7fb99eaa44 Revamp the images template functions 2021-06-10 10:26:12 +02:00
Vincent Prouillet b0937fa5b7 Some more cleanup 2021-06-10 10:26:12 +02:00
Vincent Prouillet a97779567e Split Tera functions in several files 2021-06-10 10:26:12 +02:00
Vincent Prouillet 2289b2f55a Fix config loading
Closes #1512
2021-06-02 21:46:20 +02:00
Tim Schumacher 16c123aa20
Include path in the search index with include_path (#1509) 2021-06-02 09:18:39 +02:00
Avinash Sonawane 4c22996e11
Fix typos (#1505) 2021-05-31 09:20:39 +02:00
Vincent Prouillet c38d9e56c8 Do not clone ancestors when serializing 2021-05-23 18:19:18 +02:00
Vincent Prouillet fe79798b0f Remove unused code + rustfmt 2021-05-23 18:13:28 +02:00
Eric Scouten 22c29fe936
Fix race condition in generating next/previous page references when using transparent mode. (#1456) 2021-05-17 22:05:22 +02:00
Waffle Lapkin f8c6ea2b00
Add new sorting: UpdateDate that sorts by meta.updated. (#1452)
* Add new sorting: UpdateDate that sorts by `meta.updated`.

* Use `max(created, updated)` for sort-by-update-date

This prevents created but never updated articles from appearing at the end/not
appearing at all.
2021-05-15 20:16:55 +02:00
François b244bcdfbb
Hide lines in code block (#1453)
* hide lines

* test hide ines

* add documentation

* fix test

* factor shared code with hl_lines
2021-05-14 20:25:13 +02:00
Vincent Prouillet dec5a8563c Fix language in rss.xml
Closes #1442
2021-05-09 23:19:56 +02:00
Vincent Prouillet 1fab9c664d Update slotmap + handle in memory XML content type in zola serve
Second part of #1308
2021-05-09 15:57:46 +02:00
Vincent Prouillet fecc3cf148 Strip footnotes link from summaries
Closes #1282
2021-05-08 23:27:23 +02:00
Vincent Prouillet 80843cdeff u16 for anchor levels
Closes #1436
2021-04-26 09:24:27 +02:00
Vincent Prouillet 4f6528cf37 Allow whitespace on the same line as closing front-matter chars 2021-04-26 09:23:57 +02:00
Vincent Prouillet e92e4f1003 Tweaks to load_data + update deps 2021-04-21 21:43:02 +02:00
Marco Tolk 1bd777f0e5
Add HTTP POST capability to load_data() (#1400)
* Fixed failing tests on windows when user is not VssAdministrator.

* Fixed windows specific testcases related to \r

* Added the ability to perform POST requests to load_data

* make tests on windows deal with both \r being there on windows, and \r not being generated as on my personal windows system.

* undo earlier commit eaaa8c3ddd65d474161073a6fb80599eea1a9a21

because it fails on azure buildserver

* added new arguments to the hash for the cache function.

So caching now works as it should

* added new arguments to the hash for the cache function.

* improved documentation of load_data POST with better example.

* added basic derive traits

* changed load_data param contenttype to content_type

* fixed caching issues that went missing?

* format

* made code more idiomatic as suggested by keats
2021-04-21 21:29:47 +02:00
Stanislas 47b920777a
link_checking: prevent rate-limiting (#1421)
* link_checking: prevent rate-limiting

Fix for https://github.com/getzola/zola/issues/1056.

- assign all links for a domain to the same thread
- reduce number of threads from 32 to 8
- add sleep between HTTP calls

* Add get_link_domain(), use for loops

* Do not sleep after last link for domain

* Avoid quadratic complexity

* remove prints
2021-04-21 21:13:38 +02:00
Luca Bruno 3346439a32
rendering: keep track of all internal links (#1424)
This updates rendered markdown structures in order to keep track
of all internal links, not anymore limiting to only those targeting
an explicit anchor fragment.
The goal of this rework is to allow building other features, such
as backlinks, on top of the existing collection of internal links.
2021-04-21 21:13:11 +02:00
Songmin Li 4f7b960985
Fix can not build with indexing-zh (#1433)
* fix can not build zola with search/indexing-zh feature

* fix can not build components/utils after enabled indexing-zh feature

error[E0252]: the name `Deserialize` is defined multiple times
 --> components/utils/src/de.rs:2:5
  |
1 | use serde::{Deserialize, Deserializer};
  |             ----------- previous import of the macro `Deserialize` here
2 | use serde_derive::Deserialize;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^ `Deserialize` reimported here
  |
  = note: `Deserialize` must be defined only once in the macro namespace of this module
2021-04-19 10:33:12 +02:00
Jason Miller 421a2512f7
Hash collision using the same quality level and incorrect quality for WebP (#1431)
* fix: webp quality level mismatch

* fix: hash collision using the same image ops

Using the same image operations, but for different formats, e.g. `.jpg` and
`.webp`, produced the same hash.

To differentiate between these, the image extension is added to the hash.
2021-04-18 11:07:10 +02:00
Vincent Prouillet fc808f2aa8 Some clippy fixes 2021-04-07 22:13:15 +02:00
Vincent Prouillet 0afd31d660 cargo fmt 2021-04-07 22:13:15 +02:00
Vincent Prouillet d3caa56da2 Nest translations in languages options 2021-04-07 22:13:15 +02:00
Vincent Prouillet 32433e7d6c Lang aware search indices settings 2021-04-07 22:13:15 +02:00
Vincent Prouillet 187bc30f00 Serializing lang aware configs 2021-04-07 22:13:15 +02:00
Vincent Prouillet 0812b603a6 Remove deprecated config options 2021-04-07 22:13:15 +02:00
Vincent Prouillet 86b42fc1ab Move taxonomies to language options dict 2021-04-07 22:13:15 +02:00
Vincent Prouillet 7484138a91 Add a LanguageOption for the default language if there is none 2021-04-07 22:13:15 +02:00
Vincent Prouillet 975800eb5b Enforce unic valid language codes 2021-04-07 22:13:15 +02:00
Vincent Prouillet 341ac3bfbd
Southerntofu bugfix index translations (#1417)
* Translations are also generated for the index page (fix #1332)

* More tests for translations

* Even better error message

* Update page count for test

* Patch to fix Windows tests

By @mtolk

Co-authored-by: southerntofu <southerntofu@thunix.net>
2021-03-22 20:56:11 +01:00
Bert JW Regeer 5bf9ebc43a
Feature: allow spaces between dashes in filename for page (#1323)
* Allow optional whitespace around dash/underscore in filename

Allow file names that are as follows:

    2021-01-01 - test.md

To be parsed the same as if they were

    2021-01-01-test.md

The slug for both will now just be "test" instead of previously the
first example would have become "2021-01-01-test".

* Add documentation for optional whitespace in filename

* Test that updated regex does not take space after dash
2021-03-22 20:00:25 +01:00
Bert JW Regeer 5b005b48aa
Allow frontmatter to have optional newline if no content (#1408)
Without content it should be possible to create a file that contains no
newlines after the frontmatter at all, rather than forcing a newline
after the frontmatter.
2021-03-15 08:52:10 +01:00
Vincent Prouillet 25ef603990 Error on invalid file/section 2021-03-06 23:00:56 +01:00
snake66 67f9b9499b
Fix language specific non-internal urls for get_url. (#1381)
* Fix language specific non-internal urls for get_url.

* get_url: PathBuf for URL's don't work on Windows.
2021-03-06 22:49:04 +01:00
Vincent Prouillet 2a46e07e74 Add path to TaxonomyTerm
Closes #1336
2021-02-22 21:27:52 +01:00
Vincent Prouillet 7fc7ef4720 Add tests for slug strategy in filenames with dates 2021-02-22 20:39:31 +01:00
Vincent Prouillet 2bbd3bd424 Fix compute_hash 2021-02-21 09:09:02 +01:00
Vincent Prouillet 3262f69bb0 Single compute_hash fn + cargo fmt 2021-02-20 14:07:36 +01:00
Skyper d3ab3936de
[WIP] Add support for base64-encoded hash values to 'get_file_hash' (#1339)
* Add support for base64-encoded hash values

The global template function 'get_file_hash' can now return a
base64-encoded hash value when its 'base64' parameter is set to true.

See discussion in #519.

* Fix integrity attribute's value in test site

SRI hash values must be base64-encoded.

* Update documentation about 'get_file_hash'

* Fix 'can_get_hash_for_static_files' unit test
2021-02-20 13:31:37 +01:00
Hanno Braun 6d6df45f23
Make shortcodes work in markdown filter (#1358)
* Move `load_tera` to `templates`

I don't know if this is a good place for it, conceptually. I'm moving it
there because I need to use it from `templates`, and `templates` can't
depend on `site`, because there's already a dependency in the opposite
direction.

* Load templates in `markdown` filter

This enables the `markdown` filter to handle shortcodes, as long as
those shortcodes don't access any context variables.

Addresses #1350

* Update documentation of `markdown` filter

* Only load templates for `markdown` filter once

* Clarify `markdown` filter documentation

This is a lightly edited version of what @southerntofu suggested.
2021-02-19 20:51:08 +01:00
Philip Kristoffersen 8eac5a5994
WebP support in resize_image (#1360)
* Removing unused webpl

* Adding clarification comment

* Updating documentation

* Adding webp
2021-02-18 22:30:10 +01:00
Chiu-Hsiang Hsu 3cb61c3bcd
Support embed YouTube playlist (#1342) 2021-02-07 17:13:03 +01:00