Commit graph

644 commits

Author SHA1 Message Date
southerntofu
84b75f9725
[feature] Shortcodes and anchor-link.html can access lang context (#1609)
* Pass lang to shortcodes context

* Add tests for lang in shortcodes

* Lang is passed to anchor-link.html template

* Document passing lang to shortcodes/anchor-link.html
Add a test to make sure lang can be overriden by passing an explicit argument to the shortcode,
for usage in the markdown filter where the language context is not available.

* Update docs for more information on shortcodes+i18n+markdown() filter

Co-authored-by: southerntofu <southerntofu@thunix.net>
2021-09-04 08:10:33 +02:00
southerntofu
2be1b417d1 config.default_language is exposed to templates 2021-09-01 18:12:35 +02:00
Vincent Prouillet
f7a4ef2617 Add draft to section variable in templates
Closes #1592
2021-08-20 19:47:41 +02:00
Koen Bolhuis
5ca2b29c49
Fix cachebust for files in the output path (#1586)
* Consider the site's output path in search_for_file

The search_for_file helper function now accepts an optional
output path. If passed, the file will also be searched there.
This is used in the get_url function to search in the
Site::output_path.

In practice, this means cachebust works for files in the
output path.

* Make output_dir required in search_for_file

* Update docs for file searching logic

* Add test for new file searching behavior
2021-08-19 07:55:40 +02:00
liushuyu
c658d171f8
cargo/manifests: allow user to use native-tls if ring is unsupported (#1587)
* cargo/manifests: allow user to use native-tls ...

... if `ring` can't be used on the user's platform (e.g. mips/ppc/riscv)

* CI: test for native tls build
2021-08-18 15:32:34 +02:00
Sam Vente
56dcfecce2
make clippy a bit happier (#1588) 2021-08-18 09:36:51 +02:00
Vincent Prouillet
8b43667a94 Ensure code block contents are always escaped
Closes #1581
2021-08-18 09:05:00 +02:00
Vincent Prouillet
88e5c6e167 Update deps 2021-08-12 08:54:55 +02:00
Vincent Prouillet
85f68f87cc Update minify and respect HTML spec 2021-08-09 20:28:17 +02:00
Vincent Prouillet
4a87689cfb Add class based syntax higlighting + line numbers (#1531)
* Add class based syntax higlighting + line numbers

* Use fork of syntect for now

* Fix tests

* Fix diff background on inline highlighter

Co-authored-by: evan-brass <evan-brass@protonmail.com>
2021-07-10 08:53:19 +02:00
Bert JW Regeer
57705aa82e
Add permalink to Taxonomy (#1516)
* Add permalink to Taxonomy

* Document permalink addition to TaxonomyConfig
2021-07-10 08:43:22 +02:00
David Ed Mellum
98b110ba14
Add support for Norwegian search (#1547) 2021-07-07 19:44:10 +02:00
Vojtech Kral
6f22132b8d
imgproc: Don't upscale images in the Fit op, fix a bug in comment in #1542 (#1545)
* imgproc: Don't upscale images in the Fit op, fix  #1542

* imgproc: Remove FIXMEs that have been addressed
2021-07-07 11:15:37 +02:00
Vincent Prouillet
3e1a934604 Fix tests and add note about translations 2021-06-25 10:12:05 +02:00
Vincent Prouillet
06bee578a0 Revert "Exclude self from translation list for page/section"
This reverts commit 0a7692ad85.
2021-06-25 10:09:55 +02:00
Marshall Bowers
93900fb623
Add num_format filter (#1460)
* Add `num_format` filter for displaying formatted numbers

* Register the filter

* Update docs

* Make `locale` argument required

* Revert "Make `locale` argument required"

This reverts commit 9cdbf28591.

* Pull the default locale from the site config

* Add note about defaults to the docs

* Add missing borrow
2021-06-25 10:07:52 +02:00
Vincent Prouillet
0a7692ad85 Exclude self from translation list for page/section
Closes #1410
2021-06-24 23:28:49 +02:00
Vincent Prouillet
545e766818 Allow functions to look into current theme static folder
Closes #1416
2021-06-24 23:12:05 +02:00
Vincent Prouillet
e62664b4ff Unify {page,section}.assets
Closes #1510
2021-06-24 22:22:50 +02:00
Vincent Prouillet
a8acf2cab7 Cache get_image_metadata result 2021-06-14 20:06:57 +02:00
Vincent Prouillet
1bf5cd7bf8 Update docs + sandbox files 2021-06-11 21:14:45 +02:00
Vincent Prouillet
0975b674c5 Hash imageproc on unified path 2021-06-10 10:26:12 +02:00
Vincent Prouillet
38ddb1c4d1 cargo fmt 2021-06-10 10:26:12 +02:00
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 eaaa8c3ddd

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