Commit graph

777 commits

Author SHA1 Message Date
Vincent Prouillet
7208b86d77
Insert anchor as full heading (#1916)
* Add insert_anchor = "heading"

* Update CHANGELOG.md

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2022-07-10 15:02:07 +02:00
bemyak
065e8e64e5
Apply orientation transformation based on EXIF data (#1912) 2022-07-07 23:19:13 +02:00
Vincent Prouillet
cec65d0fa7 Stop printing invalid files in dirs
Too many invalid stuff like emacs files
2022-06-23 20:56:42 +02:00
Arnaud Grandville
18e8246fbc
fix windows EOL in markdown files (#1911)
* add a test

* CodeBlock text may be split on multiple parts

The CodeBlock text events are now concatenated and processed in a single stream at the end. cf https://github.com/raphlinus/pulldown-cmark/issues/457
2022-06-23 19:36:33 +02:00
Phil Lord
4f6a1c6bcc
Properly escape anchor names (#1908) 2022-06-21 19:08:16 +02:00
Phil Lord
afc6a71a79
Allow new lines before anchor (#1905)
Previously the heuristic check for links required spaces before the
attribute to ensure that attributes suffixed with `id` were not
identified. This has now been expanded to any white space character to
enable the `id` attribute to start on a new line.
2022-06-21 15:53:07 +02:00
Vincent Prouillet
5873e0319c Add title_bytes sorting method 2022-06-13 23:37:39 +02:00
Vincent Prouillet
4da81eb17e Fix feed location for taxonomies not in the default language 2022-06-13 22:34:47 +02:00
bemyak
d4b5c4fdc4
Make robots.txt compliant with RFC (#1895)
The [RFC](http://www.robotstxt.org/orig.html) mentions only `Disallow`
directive, so it must appear in the file.

`Allow` is an ad hoc agreement between search engines that no all of
them follow.
2022-06-12 21:41:38 +02:00
Vincent Prouillet
094900777b Do not assume themes are present for CSS export
Closes #1884
2022-06-10 20:54:21 +02:00
Vincent Prouillet
04ee5c85a3 Reenable link rewriting for colocated assets
All credits go to https://github.com/getzola/zola/pull/1779
2022-06-10 20:41:24 +02:00
Vincent Prouillet
e8fe51a344 Update changelog and deps 2022-06-10 20:14:38 +02:00
bemyak
49b310764a
Always follow symlinks (#1883) 2022-06-09 21:47:52 +02:00
bemyak
8029cf891a
Fix taxonomy current path (#1882)
* Fix current_path and current_url for taxonomies

* Fix language duplication in get_url fn
2022-06-09 21:47:03 +02:00
bemyak
6989eb73ab
Fix clippy lint warnings (#1888) 2022-06-04 20:29:33 +02:00
Matt Ickstadt
e9e6cadc6c
Update to elasticlunr-rs 3.0.0 (#1873) 2022-06-03 23:25:42 +02:00
Jake G
ed296d72a1
Your message (#1880) 2022-06-03 22:44:29 +02:00
Laurențiu Nicola
a385dbae29
Add rel="alternate" to Atom post links (#1868)
This improves compatibility with some readers, e.g. Miniflux, which otherwise don't detect these.
2022-05-21 23:28:58 +02:00
Vincent Prouillet
76b0b5f5dd Clippy 2022-05-11 22:34:36 +02:00
Vincent Prouillet
1a3b783120 DRY up the external link checking a bit 2022-05-11 22:31:54 +02:00
Michael Clayton
6240ed5469
add link_checker settings for external_level and internal_level (#1848)
* add external_level and internal_level

* remove unnecessary debug derive on LinkDef

* clarify doc comment about link check levels

* simplify link checker logging

* add missing warn prefix

* simplify link level logging, remove "Level" from linklevel variants

* remove link level config from test site

* switch back to using bail! from get_link_domain

* move console's deps to libs

* remove unnecessary reference

* calling console::error/warn directly

* emit one error, or one warning, per link checker run

* various link checker level changes

* add docs about link checker levels

* remove accidentally committed test site

* remove completed TODO
2022-05-11 21:54:34 +02:00
Vincent Prouillet
2291c6e9c3 Fix tests 2022-05-10 22:33:57 +02:00
Vincent Prouillet
beb93f2b0a Expose backlinks 2022-05-08 14:10:29 +02:00
Vincent Prouillet
413a68d8b2 Fix tests 2022-05-06 22:55:29 +02:00
Vincent Prouillet
e0043a7351 Ignore section with render=false when looking for path collisions
Closes #1656
2022-05-06 22:45:05 +02:00
Vincent Prouillet
a958305e58 Clone Zola Tera instance for Markdown filter 2022-05-06 22:16:56 +02:00
Vincent Prouillet
ee8de20a6e Update syntect 2022-05-05 23:41:06 +02:00
Vincent Prouillet
bdbe73e23e Clippy 2022-05-02 23:05:08 +02:00
Vincent Prouillet
df9061b5a0 Avoid cloning components when rendering feed 2022-05-02 23:01:57 +02:00
Vincent Prouillet
a297b11f2a More efficient sitemap building 2022-05-02 22:51:01 +02:00
Vincent Prouillet
a0630efb76 Rename links utils mod 2022-05-02 22:07:47 +02:00
Vincent Prouillet
e8b04bb11a Serialize transparent field in section front-matter
Closes #1840
2022-05-02 21:55:43 +02:00
Vincent Prouillet
bad0127c9f
Build taxonomies as pages are added (#1841) 2022-05-02 16:51:46 +02:00
Ken "Elf" Mathieu Sternberg
77eb9fef9b
Create pull request/add yaml to load data (#1842)
* Add YAML to formats supported by load_data()

A fairly trivial addition; JSON and YAML are handled so similarly
that this was a matter of copying the JSON-relevant handlers and
editing the copies to handle YAML as well.  The test file was
literally generated with 'json2yaml'.

The documentation has been updated to indicate that load_data() now
handles YAML code.

The CHANGELOG has been updated as well.

* After checking, I found that it's generally agreed the mime type is still application/x-yaml.

* Update comment, unify library importing.

I noticed one more place where the list of formats was supported,
and added YAML to that list.

I noticed that there's a singular place to load the `libs::` crate,
and unified by importing of serde_yaml in that place.
2022-04-29 20:22:02 +02:00
Vincent Prouillet
3a0800c702 Pass content_path to populate_library 2022-04-27 22:27:19 +02:00
Vincent Prouillet
84951d39e3 Allow taxonomies to not be rendered
Closes #1750
2022-04-27 21:11:42 +02:00
Vincent Prouillet
844576e32e Remove unused deps thanks to cargo-machete 2022-04-27 19:49:57 +02:00
Vincent Prouillet
27a200bb4e Some more refactoring 2022-04-26 23:13:27 +02:00
Vincent Prouillet
6851ade642 Print path on metadata call failure 2022-04-26 22:38:00 +02:00
Vincent Prouillet
c14b1fa746 Remove duplicate code 2022-04-26 22:27:20 +02:00
Vincent Prouillet
9ab1bf2e4e
Re-organise content and remove slotmap indirection level (#1827) 2022-04-26 20:51:04 +02:00
Michael Clayton
92e80b5451
apply skip_prefixes before parsing external link domain (#1833)
* apply skip_prefixes before parsing external link domain

* log number of links skipped by skip_prefixes
2022-04-26 20:07:50 +02:00
Vincent Prouillet
c11ae6ef28
Use anyhow (#1816)
Also fixes #1783
2022-04-01 21:37:38 +02:00
Vincent Prouillet
62a0e7b1fd Update deps 2022-03-23 10:00:55 +01:00
Spencer Scorcelletti
a13d41b47c
Allow load_data to take a literal (#1794) (#1794)
* Add `literal` as a new entry for `data source`, to be used by the `load_data` function

* Add tests to the module for plain text, json, xml, toml, and csv

* Update error messaging to include literal as a potential choice

* Update site documentation to include instructions for using `load_data` with a literal
2022-03-21 10:15:24 +01:00
Michael Clayton
336a2716e0
switch from chrono to time (#1790)
* switch from chrono to time

* remove some unused time features

* get utc offset before threading begins
2022-03-20 22:01:01 +01:00
Vincent Prouillet
1f5a524c12 Load extra themes even with theme=css
Closes #1775
2022-03-15 11:32:32 +01:00
Vincent Prouillet
2feda3ec61 Update deps 2022-03-04 21:36:35 +01:00
doomy
88e0624f11
Added XML support for load_data (#1769)
Co-authored-by: doomy <2640792-_doomy@users.noreply.gitlab.com>
2022-03-04 21:28:08 +01:00
Vincent Prouillet
a67370b8d8 Update pulldown_cmark 2022-03-04 00:16:48 +01:00
Vincent Prouillet
40d7208493 Refactoring rendering tests 2022-03-03 12:41:19 +01:00
Sam Vente
dde3531fd9
Make sure that zola serve/build can start from anywhere inside dir tree (#1761)
* Make sure that zola serve/build can start from anywhere inside dir tree

* make clippy and rustfmt a bit happier

* replace unecessary if-else with unwrap_or and display which path could not get canonicalized if it fails at startup

* canonicalize config_path to avoid crash when config.toml changes
2022-03-03 12:35:29 +01:00
southerntofu
fb347c2e02
Bugfix check links i18n (close #1694) (#1780)
* Treat _index.LANG.md as section, not page (close #1694)
Display more advanced information in case of a future crash here

* Add link to translated local section in test_site_i18n to catch #1694
It appears linking to another translated page does not trigger the bug,
but linking to a section within the same (translated) page does.

* Allow (and test for) homepage internal links in broken link detection

Co-authored-by: southerntofu <southerntofu@thunix.net>
2022-02-26 21:56:33 +01:00
Michael Clayton
a13279ea39 ignore links to '#' (#1756) 2022-02-14 11:08:40 +01:00
Kartavya Vashishtha
a5890a9901 Make ignored_content work with nested paths and directories (#1738)
* Make ignored_content work with directories
Just had to remove strip_prefix(path) from file ignore code.
Added tests for subdirectory globbing.

* Add documentation

* add more tests
to confim that simple filename globs still match paths
without strip_prefix
2022-02-14 11:08:40 +01:00
Vincent Prouillet
ae3a8b802e Add libs subcrate (#1747)
* Add libs subcrate

* Remove last direct lazy_static usage

* Update pinned ci version

* Update deps
2022-02-14 11:08:40 +01:00
Michael Clayton
78b19d7133 Fix markup for fenced code with linenos (#1746)
* fix fenced code blocks with linenos and minify_html

* fix test cases involving linenos
2022-02-14 11:08:40 +01:00
Vincent Prouillet
4bcbf2a545 Update deps 2022-02-14 11:08:40 +01:00
Jeremy Kerr
1b20acabde config: Don't skip extra syntax loading if highlight_theme = css (#1732)
Currently, init_extra_syntaxtes_and_highlight_themes will supress
loading anything if highlight_theme is "css". This makes sense for the
highlight themes, but will also skip loading any extra syntax
definitions too.

This change defers the theme = css check, so we still load syntaxes in
this case.

Fixes: #1723

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2022-01-23 14:33:51 +01:00
liushuyu
684bc2dd74 Fix shortcode handling in code-fences (#1720)
* rendering/markdown: fix shortcode handling in codefences

* rendering/tests: add a bunch of tests for codefence + shortcode usages
2022-01-23 14:33:51 +01:00
Teddy Heinen
ef3a16f3a8 make asset colocation find assets which have no extension (as opposed to ignoring them) (#1734) 2022-01-23 14:33:51 +01:00
liushuyu
37b31cb61f templates/load_data: add an optional parameter headers (#1710)
* templates/load_data: add an optional parameter headers ...

... now `load_data` function supports setting extra headers

* docs/templates/overview: cover some edge-cases in the explanation

* templates/load_data: fix caching logic with headers

* docs/templates: change wording for load_data headers explanations
2022-01-23 14:33:51 +01:00
Michael Clayton
78132a8d1d add theme's robots.txt to tera with name "robots.txt" (#1722)
* add theme's robots.txt to tera with correct name

* add TODO reminder to add tests
2022-01-23 14:33:51 +01:00
Tshepang Lekhonkhobe
faec345e84 remove compiler warning (#1698) 2022-01-23 14:33:51 +01:00
Phil Lord
5190b5eba5 Add heuristic checking for HTML anchors (#1716)
* Add heuristic checking for HTML anchors

Previously only anchors specified or generated in markdown could be
linked to, without complaint from the link checker. We now use a
simple heuristic check for `name` or `id` attributes.

Duplicate code has been refactored and all XML anchor checks updated
to use regex rather than substring match.

* Fix regexp and refactor
2022-01-23 14:33:51 +01:00
Jakub Kądziołka
0b7e3cb907 Various comment cleanups (#1726)
* Add a comment to clarify that this bodge is not a bug

* Fix rustdoc warnings
2022-01-23 14:33:51 +01:00
Jakub Kądziołka
4d14c46552 Reduce code repetition in CodeBlock::highlight (#1697) 2022-01-23 14:33:51 +01:00
Vincent Prouillet
3155662db2 Fix HTML shortcodes
Closes #1689
2021-12-09 22:11:21 +01:00
Vincent Prouillet
22dcfb963e Test config.title in integration tests 2021-12-07 21:46:44 +01:00
Vincent Prouillet
7ce4f75d09 Fix config data not getting to the templates
Closes #1687
2021-12-07 21:46:44 +01:00
Vincent Prouillet
9191a2726c Fix markdown shortcodes 2021-12-07 21:46:44 +01:00
Vincent Prouillet
b3139b7622
Only find assets recursively for pages (#1677) 2021-12-04 13:58:02 +01:00
Vincent Prouillet
51784aa60f Handle naked anchor link for internal links
Closes #1676
2021-12-03 23:30:32 +01:00
BezPowell
35359fb312
Add generic template fallbacks to taxonomies (#1651)
* Split checking for theme template off into separate function

Allows to check for fallbacks elsewhere in the code, without attempting to actually render the template.

* Add template fallback checking to taxonomy pages.

* Add template fallback checking to paginated taxonomies

Requires passing additional arguments to Paginator::from_taxonomy, which may not be desirable.

* Update documentation to reflect taxonomy template fallbacks.

* Update generic taxonomy template names.

* Make check_template_fallbacks() return &str.

* Add tests for check_template_fallbacks
2021-11-29 09:54:16 +01:00
Vincent Prouillet
19125e8dd2
Back to pest (#1665) 2021-11-23 22:58:51 +01:00
Vincent Prouillet
637b00547a
Shortcodes (#1640)
* Next version

* Added tests for shortcode insertion

* Added TOC tests

* Added test for #1475 and #1355

* Basic internal / external links tests

* Added integration test

* Added pseudocode and started on logos

* Logos parsing for shortcodes

* Fixed string literal parsing

Moved string literal parsing to a new lexer in order to have greater
control of control characters which are parsed. This fixes the bug that
was present in the `string_from_quoted` function and also moves the
`QuoteType` to be in the `ArgValueToken`.

* Moved string literal logic to seperate module

* Added square bracket notation for variables

* Error handling rewritten

Remove the Result from the `fetch_shortcodes` function. Added proper
messages within the internal parsing.

* Reorganized and documented the shortcode submodule

* Added all logic for ShortcodeContext spans

* Added working insertion code for MD files

* Made functions generic over Markdown or HTML

* Add check for embedding bodies

* Structure of main function clear

* Added test for `new_with_transforms` function

* It runs!

* Added the code for handling p-ed html shortcodes

* Removed placeholders in markdown function

* Adjusted integration tests

* fetch_shortcodes now also returns a string

* Start of HTML insertion

* Kinda working everything

* Loading of shortcodes and builtins

* Fix tests

* Some missed fixes

* Tweaks + fmt

* Remove string literal handling

* Fix benches

* Grab shortcode def only once per site

* Fix benches

* Rewrite of parser

* Fix tests

* Add test for #1655

* Re-enable integration test

* Add test for #1601

* Add test for #1600

* Add test for #1500

* Add test for #1320

* Fix test on windows?

Co-authored-by: Gijs Burghoorn <g.burghoorn@gmail.com>
2021-11-19 20:31:42 +01:00
Peter Kos
1434eebea4
Add check for export highlight theme CSS in Config (#1650)
* Add check for export themes

* Remove parens

* Add tests
2021-11-09 19:36:01 +01:00
scria1000
7fa58ef45b
Fix get_url resolving asset path to invalid url on Windows (#1632)
* Fix get_url resolving asset path to invalid url on Windows

* Make unit test available for all targets
2021-10-05 19:57:16 +02:00
Miguel de Moura
aaa25cee2a
Fix clippy warnings (#1618)
Fixes clippy warnings for the `needless_borrow` lint.
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Removes the unused `starts_with_schema` function
(dead code since 4086b075).
2021-10-02 11:07:04 +02:00
Vincent Prouillet
2e884e06cb Remove duplicate call to load syntax/themes 2021-09-13 21:13:51 +02:00
David
23064f57c8
Support custom syntax highlighting themes (#1499)
Related to #419

Gruvbox tmTheme added to test_site, it is taken from
https://github.com/Colorsublime/Colorsublime-Themes (MIT licensed)
2021-09-13 21:08:48 +02:00
acheronfail
b503d5cc86
feat: add required argument to taxonomy functions (#1598) 2021-09-04 08:25:03 +02:00
Tim Schumacher
4086b0755a
Support colocating subfolders (#1582)
* Support colocating subfolders

* Adjust tests
2021-09-04 08:23:03 +02:00
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