Commit graph

172 commits

Author SHA1 Message Date
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 dec5a8563c Fix language in rss.xml
Closes #1442
2021-05-09 23:19:56 +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
Vincent Prouillet d3caa56da2 Nest translations in languages 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
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 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
Vincent Prouillet aa57541c21 Force newline after front-matter
Closes #1287
2021-02-02 21:53:37 +01:00
Vincent Prouillet 024144ba78 cargo fmt 2021-02-02 20:49:57 +01:00
Vincent Prouillet 8e6c3f4fef Update changelog + deps 2021-02-02 20:25:27 +01:00
southerntofu 15e0ae6699
load_data() template function takes a required boolean flag (closes #1209) (#1306)
* load_data() template function takes a `required` boolean flag

* Update tests for load_data()

* Add test to make sure invalid data always fails in load_data

* Better documentation, fixing a few typos

Co-authored-by: southerntofu <southerntofu@thunix.net>
2021-02-02 20:19:44 +01:00
southerntofu 6950759eda
Internal links are supported in markdown filter (#1318)
* Internal links are resolved in tera markdown filter (close #1296 #1316)

* Add a test for internal links in markdown filter

Co-authored-by: southerntofu <southerntofu@thunix.net>
2021-01-20 09:24:55 +01:00
Vincent Prouillet 877f441422 Update reqwest 2021-01-05 22:11:15 +01:00
Rostislav 679af5b8c8 add Allow: / to default robots.txt template (#1258)
Also update the documentation about it.
2020-12-14 20:43:32 +01:00
Vincent Prouillet f20c52b872 Re-use markdown parser for markdown filter 2020-12-14 20:43:31 +01:00
Vincent Prouillet 047ce32efd Clippy 2020-12-14 20:43:31 +01:00
Vincent Prouillet 94634fe87d Move markdown config to its own section in config.toml 2020-12-14 20:43:31 +01:00
Renato Caldas 2673466998 Add bibtex support to load_data() (#1190)
* Add support for loading Bibtex data.

* Add load_data() documentation for the bibtex format

* Force bibtex tags to be lower case.

Bibtex tags are case-insensitive, and this works around tera's case-sensitiveness.

* Improve the load_data() documentation for the bibtex format
2020-12-14 20:43:31 +01:00
Vincent Prouillet 92282608fe Update changelog 2020-12-14 20:43:31 +01:00
Vincent Prouillet a26422d401 Update changelog 2020-12-14 20:43:31 +01:00
Cthulhux da37db1258 Enable YouTube privacy mode (#1201)
* Update themes gallery

* Enable YouTube privacy mode

As recommended: https://www.ghacks.net/2018/05/23/why-you-should-always-use-youtubes-privacy-enhanced-mode/

* Adjusted tests for privacy mode

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Vincent Prouillet <balthek@gmail.com>
2020-12-14 20:43:27 +01:00
Vincent Prouillet b313c97ceb Fix slugified taxonomies rendering
Closes #1177
2020-09-22 09:46:22 +02:00
Vincent Prouillet f786783299 Update pulldown_cmark 2020-09-03 21:22:20 +02:00
Sam Vente 2ac1d79f8f
fix get_taxonomy_url to handle merged taxonomies properly (#1155) 2020-09-02 11:40:06 +02:00
Yaroslav d571dea8c3
Per section/subsection feeds (#1128)
* Per section/subsection feeds

* Added `generate_feed` variable to section front matter.
* Generate atom/rss feeds for sections/subsections that have the
`generate_feed` variable set to true (false by default); this works
independent of the `generate_feed` variable in the root `config.toml`
file, however, the name (and template) of the feed file for each section
is the same as `feed_filename` in `config.toml`, just located in the
root of each section.
* Slightly edited `atom.xml` and `rss.xml` so that they include the
section title (if any), and the url of a section, if it's a section
feed.

* Section feeds: tests

* Changed a couple of sections' front matter in order to generate feeds
for them for the test.
* Changed the can_build_feed test in site package to can_build_feeds and
included some assertions to make sure that section feeds are generated
when requested.

* Section feeds: documentation

* Added information about the section front matter variable
`generate_feed` in the section content page.
* Added information about section feeds in the feeds template page.

* Section feeds fix: use section.path for feed path
2020-08-27 20:21:37 +02:00
Vincent Prouillet b4c5e9a34a Update changelog 2020-07-29 20:49:15 +02:00
Vincent Prouillet 9f20af1521 Update deps 2020-07-22 18:59:21 +02:00
Vincent Prouillet ade442a487 clippy + fmt + fix toml dates in extra arrays
Closes #1048
2020-06-18 21:12:46 +02:00
Matthias 5e31a32166
Add support for SVG files to get_image_metadata (Fixes #769) (#1063)
* Add support for SVG files to `get_image_metadata`

* Add support for SVG files to `get_image_metadata`

* Update documentation after adding SVG support
2020-06-18 11:36:11 +02:00
Hannu Hartikainen 6708f7637c
Implement get_file_hash (#1044)
* Fix get_url(cachebust=true)

The previous implementation looked for static files in the wrong place.
Look in static_path, output_path and content_path. If file can't be
found in any of them, print a warning to stderr and fall back to using
a timestamp.

Add a test to ensure it also works in practice, not just in theory.

* Implement get_file_hash
2020-06-09 22:38:29 +02:00
Vincent Prouillet ee594cfc3d Make alias template pass HTML validation 2020-05-27 21:17:12 +02:00
Stan Rozenraukh 8d32f8b3f3
Fix panic in load_data(url=%s) (#1036)
If there is no response from the server, `load_data` would panic
with: `response status`.

This patch removes the `expect` in favor of an error message that we
couldn't get a response from the server for a given url.
2020-05-25 09:25:41 +02:00
Hannu Hartikainen 36ec33f042
Change get_url(cachebust=true) to use a hash (#1032)
Cache-busting was previously done with a compile-time timestamp. Change
to the SHA-256 hash of the file to avoid refreshing unchanged files.

The implementation could be used to add a new global fn (say,
get_file_hash) for subresource integrity use, but that's for another
commit.

Fixes #519.

Co-authored-by: Vincent Prouillet <balthek@gmail.com>
2020-05-23 11:46:50 +02:00
Sven-Hendrik Haase e9b47dae59
Remove implicit dependency on openssl-sys (#1001) (#1005) 2020-04-27 09:49:05 +02:00
Vincent Prouillet b96b187eca Fix tests + rustfmt 2020-04-22 10:07:17 +02:00
Vincent Prouillet c04e6ebaf5 Some tweaks 2020-04-21 19:28:58 +02:00
Vincent Prouillet 0ac70cb242
Merge pull request #994 from chris-morgan/misc
Chris Morgan’s whole bunch of miscellaneous work for landing
2020-04-21 18:21:48 +02:00
Vincent Prouillet 8253adbcc0 Fix tests 2020-04-14 19:15:30 +02:00
Chris Morgan 4653e68715 Add lang, taxonomy and term to feed template
Also a FIXME on the rebuilding part, because it’s presently very wrong.
2020-04-14 17:29:51 +05:30
Chris Morgan eb7751955a WIP: add an 'updated' field to pages
Also change a few other things to use it, as noted in CHANGELOG.md.

TODO:

- Write a couple of tests: updated field, last_updated template variable

One slight open questions: should `updated` default to the value of
`date` rather than to None? Then pages with `date` could safely assume
`updated`.
2020-04-14 17:29:46 +05:30