Commit graph

854 commits

Author SHA1 Message Date
Vincent Prouillet
6622078038 DRY things a bit 2021-01-05 21:48:35 +01:00
Sam Vente
369fb40dfe
move translation population and path collision checking to insert stage (#1272) 2021-01-05 21:39:25 +01:00
Vincent Prouillet
b9b4ef9f04 Add data-lang on code blocks 2021-01-02 09:29:28 +01:00
Vincent Prouillet
7540ecd58e Prefer custom syntax before built-in ones 2020-12-29 10:36:40 +01:00
Vincent Prouillet
2362cf2415 Move syntaxes around to make packing a two step process
Closes #1268
2020-12-28 17:39:54 +01:00
Vincent Prouillet
657905ed6e Remove watch-only 2020-12-22 21:35:15 +01:00
Vincent Prouillet
39870d8675 Move extra_syntax to markup.rs 2020-12-21 08:54:43 +01:00
Vincent Prouillet
96439df0e2 Add some debug log time 2020-12-21 08:54:35 +01:00
Vincent Prouillet
fc8b4066f2 Update syntaxes + replace js lang in rendering
Closes #1241, #1211
2020-12-15 10:42:35 +01:00
Vincent Prouillet
68cdfcbbe7 Fix panic with misnamed index section
Closes #1244
2020-12-14 22:51:30 +01:00
Nathanael Lane
a210abc5a3 Add shortcode 'invocation' variable to allow a shortcode to track how… (#1236)
* add shortcode 'invocation' variable to allow a shortcode to track how many times it has been invoked in a given Markdown file

* use closure (implicit struct) instead of explicit struct for invocation tracking

* update variable name to "nth"
2020-12-14 20:43:32 +01:00
Sylvain Kerkour
a93063ba4a search: Update elasticlunr.min.js to 0.9.6 (#1260) (#1261) 2020-12-14 20:43:32 +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
Kevin Ottens
4754cb5792 Yaml frontmatter (#990)
* Accept dates presented as strings

Still, if we find a string we involve the TOML parser to make sure the
content of said string would be a correct TOML date. In a pure TOML
world this isn't exactly relevant, but this will come in handy when
using a YAML deserializer.

Signed-off-by: Kevin Ottens <ervin@ipsquad.net>

* Add serde_yaml and test-case dependencies

This will be necessary for the YAML frontmatter handling and
corresponding unit tests.

Signed-off-by: Kevin Ottens <ervin@ipsquad.net>

* Add YAML front matter handling

Signed-off-by: Kevin Ottens <ervin@ipsquad.net>

* Switch RawFrontMatter enum to wrap &str instead of String

Signed-off-by: Kevin Ottens <ervin@ipsquad.net>

* Update the documentation to mention YAML frontmatter

This is just a light update on purpose. There would be no point in
pushing YAML too much, this is mainly here to help people with a backlog
of posts to transition.

Signed-off-by: Kevin Ottens <ervin@ipsquad.net>
2020-12-14 20:43:31 +01:00
Vincent Prouillet
f20c52b872 Re-use markdown parser for markdown filter 2020-12-14 20:43:31 +01:00
Vincent Prouillet
59d3d8a3da Enable smart punctuation
Closes #740
2020-12-14 20:43:31 +01:00
Vincent Prouillet
e58c2d6b6c More details on fs errors 2020-12-14 20:43:31 +01:00
Vincent Prouillet
2c681f3439 Add some external link markdown tweaking options
Closes #681, #695
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
Basix
944cba030e Allow to specify default language in filenames (#1233)
* Use default language if code is same as default

* Add test for specifying default locale

* Update docs to mention default languages
2020-12-14 20:43:31 +01:00
Vladislav Nikonov
b1091bbb45 Implemented emoji aliases support in markdown files (#1194)
* Implemented emoji aliases support in markdown files

* Added emoji aliases rendering unit tests

* Added bench for emoji
2020-12-14 20:43:31 +01:00
Vincent Prouillet
a26422d401 Update changelog 2020-12-14 20:43:31 +01:00
Sam Vente
c40fb91ba8 Make sections draftable (#1218)
* make sections draftable

* add documentation paragraph about drafting sections
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
areille
6a31ccff99 Enable html minification (#1208)
* Next version

* Remove lines forcing minify_html to false

* Update documentation about minify_html

* Update changelog

Co-authored-by: Vincent Prouillet <balthek@gmail.com>
2020-12-14 20:42:55 +01:00
Christoph Grabo
6ef81940b8 Add language class to code tag
class attribute is only added if a language is available.
It uses the format "language-xxx" as per commonmark spec:
https://spec.commonmark.org/0.29/#example-112 ff.
2020-12-14 20:42:55 +01:00
Takayuki Nakata
575c38f9c8 Support output_dir in config.toml 2020-12-14 20:42:55 +01:00
Vladislav Nikonov
4f5d9bd8b0 Fixed site benches compilation 2020-12-14 20:42:55 +01:00
Vincent Prouillet
664cb14ffd Add test for continue reading after shortcode 2020-09-24 20:02:43 +02:00
Vincent Prouillet
59d9d26f0e Fix shortcodes issues with newlines
Closes #1172
2020-09-24 20:02:43 +02:00
Vincent Prouillet
b313c97ceb Fix slugified taxonomies rendering
Closes #1177
2020-09-22 09:46:22 +02:00
John-John Tedro
f9ae897190 Use platform-neutral path comparison for in-memory serving (fixes #1169) (#1175)
This introduces `relative-path`, a crate I've written for the specific
purpose of providing platform-neutral operations over paths the same way
they are used in URLs.

This means that `///hello///` == `/hello`, which should do the same as
the existing stripping minus the platform-specific path separators
causing the [bug being referenced](#1169).
2020-09-22 09:46:22 +02:00
Thomas Etter
f7cd28c8d2 Fix a crash when --output_dir is used with serve (#1164) 2020-09-22 09:46:22 +02:00
bemyak
d9396213de Allow site path to contain underscores (#1162)
* Allow site path to contain underscores

Fixes site.css is not being generated if any part of the path contains
underscores

* Add tests for path with underscores
2020-09-22 09:46:22 +02:00
areille
5a61139719 Add better errors for minifying and upgrade crate 2020-09-22 09:46:22 +02:00
Alice Ryhl
826e701b4f Add line highlighting to code blocks (#1131)
* Add line highlighting to code blocks

* Fix highlighting of lines

Apparently every line to be highlighted is provided in one chunk.

* Add more documentation to codeblock.rs

* Turn FenceIter into an Iterator

* Move Range to fence.rs

* Add tests
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
Vincent Prouillet
6c2300f916 Disable minify_html for now 2020-09-01 21:07:18 +02:00
Sam Vente
c143d95c4e
Reverse pagination (#1147)
* mention code block output change

* Update snap

* Update themes gallery (#1082)

Co-authored-by: GitHub Action <action@github.com>

* Deployment guide for Vercel

* Change wording a bit

* Update themes gallery (#1122)

Co-authored-by: GitHub Action <action@github.com>

* Add feed autodiscovery documentation (#1123)

* Add feed autodiscovery documentation

* Fix link in template

* Docs/configuration update (#1126)

* Update configuration documentation

- Attempt to split the configuration file into sections to make it more readable and
  avoid configuration mistakes (#1056).
- Move translation instructions to the right part.
- Add a bit more explanations to the extra section.

* Take into account @Keats feedbacks

* Remove short notice about translation usage

- A i18n page should be created to better explain it.

* add fix for (#1135) Taxonomies with identical slugs now get merged (#1136)

* add test and implementation for reverse pagination

* incorporate review changes

Co-authored-by: Michael Plotke <bdjnks@gmail.com>
Co-authored-by: Vincent Prouillet <balthek@gmail.com>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Samyak Bakliwal <w3bcode@gmail.com>
Co-authored-by: René Ribaud <uggla@free.fr>
2020-09-01 21:00:21 +02:00
areille
0df3631b3d
Add minify support (#1146)
* Doc add a missing arg to `get_taxonomy_url` (#1139)

This feature is already exist, but not in the doc yet

Related #766

* Add minify support

* Add documentation

* Code review

* Fix error in documentation

* Update minify-html to 0.3.6

* Move minify into write_content function

* Fix multiple calls to minify()

* Add test for minified output

* Fix breaking test

Co-authored-by: Ken <2770219+ken0x0a@users.noreply.github.com>
2020-08-28 19:39:19 +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
Sam Vente
6e16dfdc29
A Fix for the permalinks in #1136 (#1142)
* add fix for (#1135) Taxonomies with identical slugs now get merged (#1136)

* update templates so they propperly render taxonomy names

* squash! add fix for (#1135) Taxonomies with identical slugs now get merged (#1136)

reimplement taxonomy deduping

* revert unwanted changes to templates

* add tests for unic in permalinks

* add tests for unic in permalinks
2020-08-26 19:36:02 +02:00
Nathan West
af0dd5ef32
Fixed unsound errors (#1143) 2020-08-20 19:51:17 +02:00
Nathan West
51a2213fcf
Replaced all impl Default with derive(Default), where possible (#1141) 2020-08-19 12:25:54 +02:00
Nathan West
159ce0f672
Fix toml parse error line number (kind of) (#1138)
- Minor change to how frontmatter is detected so that toml issues
correct line numbers
- split_content now returns (&str, &str)
2020-08-18 13:14:27 +02:00
Sam Vente
05646ab573
add fix for (#1135) Taxonomies with identical slugs now get merged (#1136) 2020-08-18 12:59:33 +02:00
Vincent Prouillet
ffaf5e04b8 Do not unwrap on invalid utf8 in link checker
Closes #1134
2020-08-17 18:58:08 +02:00
Vincent Prouillet
278cc82fc7
Change zola serve to load HTML from memory instead of disk (#1114)
* Change zola serve to load HTML from memory instead of disk

* Be smart about assets copying

* Be a tiny bit smarter on template changes

* Add zola serve --fast
2020-08-16 18:39:04 +02:00
Peter H. Ezetta
623817120c
Updating filetime to v0.2.12 for OpenBSD support (#1120) 2020-08-11 20:28:14 +02:00
liushuyu
6af7959fce
Making Chinese and Japanese search indexing optional... (#1115)
* This can shave ~80 MB off the binary size while allowing users
  speaking these two languages to easily switch them back on
2020-08-07 17:03:51 +02:00
Tuomas Siipola
4a3c1568a2
Support anchors without quotes in link checker (#1118)
* Support anchors without quotes in link checker

Not widely used but in many cases quotes in attributes are optional.

* Fix duplicate test
2020-08-07 17:02:02 +02:00
southerntofu
b04be90326
Fix benchmarks (#1113)
* Include test_site/static in benchmark sites

* Benches can run again
2020-08-04 12:39:09 +02:00
Vincent Prouillet
b4c5e9a34a Update changelog 2020-07-29 20:49:15 +02:00
yanghuidong
b9296f7985
Make current_path always start with a slash (#1101)
* Make {section, page}.path always start with a slash

Change tests accordingly

* Fix missing leading/trailing slash in current_path of Taxonomy ("tags") and TaxonomyItem ("some-tag")

* Make {Paginator, Pager}.path always start with a slash

Fix Paginator.path missing trailing slash in from_taxonomy()

Change tests accordingly

* Update documentation regarding current_path now always starting with a slash

* Fix asymptomatic inverted logic in filter() for {section, page}.assets

* Add to 3 integration tests several checks for current_path in different templates

* Add a check for current_path in a paginated index section, "/page/2/"

This requires adding two dummy pages in the content root.

* Fix false passing of test on paginator.last due to URL prefix matching

A string formatting such as {name: value} can help prevent this.
2020-07-29 20:44:09 +02:00
eaon
28523ac9ad
Allow emitting newlines and whitespace in shortcodes and introduce markdown shortcodes (#1085)
* Replace hack for newline support in shortcodes with new hack

* Be a bit more space efficient/accurate with naming

* Boil newline/whitespace shortcode test down to the essentials

* Make sure the new \n and \s chars in old tests are properly represented

* Support markdown templates and shortcodes

* Refactoring .md/.html shortcode behaviour

* Add test for markdown shortcodes

* Add an html output test for markdown based shortcodes

* Add documentation for Markdown based shortcodes
2020-07-29 20:20:43 +02:00
southerntofu
7e7bf2bcd3
Tables in config.extra can be merged with those in theme.extra (#1100)
* Tables in config.extra can be merged with those in theme.extra

* Don't panic with invalid config type, but propagate an error

* Recursively merge config/theme extra sections

Co-authored-by: southerntofu <southerntofu@thunix.net>
2020-07-29 09:37:49 +02:00
Vincent Prouillet
66aaf4e384 Use mod paths 2020-07-25 10:49:07 +02:00
Vincent Prouillet
d7b53687a5 Extract some feed logic out of site/lib.rs 2020-07-25 10:30:55 +02:00
Vincent Prouillet
5fe1036a1d Extract some Tera logic out of site/lib.rs 2020-07-24 23:46:27 +02:00
Vincent Prouillet
d9123a8ca4 Extract link_checking outside of site/lib.rs 2020-07-24 23:46:27 +02:00
Vincent Prouillet
9be7bc074d Extract sass code out of site/lib.rs 2020-07-24 23:46:27 +02:00
Justin Turpin
c3f59bceec
Fix pagination section memory issue (#1097)
* Update sitemap.rs

When paginate_by is zero, set number_pagers to 1 so at least 1 sitemap section is pushed

* paginate_by updates

Introduce section.paginate_by, use value if it exists, removes now
unnecessary filter

Co-authored-by: Justin Turpin <justinturpin@pop-os.localdomain>
2020-07-23 11:03:17 +02:00
Vincent Prouillet
9f20af1521 Update deps 2020-07-22 18:59:21 +02:00
Anna Harren
24d47845f4
Ignore sass directories starting with _ (#1084)
Prior to this change, only sass files starting with _ were ignored by
Zola's sass compiler. This made using sass frameworks incredibly
inconvenient, as Zola attempted to compile every single sass file in the
framework, and inevitably errored due to them not being standalone. For
example, to use the Bulma framework, you had to manually add an
underscore to the beginning of *every* sass file in it so Zola would
stop trying to compile them as standalone css files. Now you can change
the directory name to _bulma and have the same result.
2020-07-22 18:46:22 +02:00
Vincent Prouillet
fb994c71d7 Make search index configurable
Closes #961
2020-06-29 20:02:27 +02:00
Vincent Prouillet
7cea0bb432 Clean up config a bit 2020-06-18 23:11:09 +02:00
southerntofu
e47deccf43
Make themes more flexible (#1004)
* Site templates can replace theme templates

* Integrate test case within test_site/

* Full backwards-compatibility with testcase in test_site

* Refine test case

* Call parent's block in child template for test case

* Check both templates are applied

* Follow testing advice

* Test for 'include' in themes and shortcodes

* Documentation for themes and how to extend them

Co-authored-by: Vincent Prouillet <balthek@gmail.com>
2020-06-18 22:31:03 +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
Vincent Prouillet
752716f292 Not sure it changes anything but... 2020-06-15 19:14:35 +02:00
Vincent Prouillet
351c9b7ff3 Remove ja/zh in search index 2020-06-15 19:14:35 +02:00
Vincent Prouillet
2e9b7ba522 Enable task lists 2020-06-11 18:29:05 +02:00
Hannu Hartikainen
c4154bb8c4
Don't panic on bad date strings (#1051)
* Don't panic on bad date strings

Instead, show a helpful error message explaining only RFC3339 is
supported.

Fixes #993.

* Try to parse the full range of TOML date formats
2020-06-09 22:39:39 +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
b87f17570f Remove unneeded build_timestamp on config 2020-05-28 09:21:42 +02:00
Vincent Prouillet
b935dc6273 Fix tests 2020-05-27 22:05:56 +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
Tymoteusz Wiśniewski
974ae167a8
Make path to config.toml independent from root dir (#1023)
fixes #1022
2020-05-23 11:55:45 +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
Vincent Prouillet
e1c8c01149 Consistent path for defult index section
Closes #995
2020-05-23 11:43:24 +02:00
hui.liu
32ca1a14ed
Wrap highlight code blocks with <code> (#1026)
* Wrap highlight code blocks with <code>

* Fix tests for highlight code block
2020-05-18 09:41:56 +02:00
Vincent Prouillet
fbf431d612 Update syntect, using rust-onig with bindgen temporarily 2020-05-12 20:07:02 +02:00
Vincent Prouillet
bc496e6101 Update syntaxes and syntect 2020-04-29 22:35:28 +02:00
southerntofu
e3dc8bbab5
Access heading level in anchor-link.html (#1008)
* Add lvl variable in anchor-link context

* Add docs about lvl in anchor-link.html

* Rename lvl => level
2020-04-29 19:40:25 +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
Andrew Wonnacott
d19855e909
Rewrite link_checker to use a Result internally (#928) 2020-04-22 10:04:10 +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
Chris Morgan
0cc1435f35 Make config.description optional in atom.xml 2020-04-14 17:27:08 +05:30
Chris Morgan
048949ea31 Rename last_build_date to latest_date
The variable name matched the RSS tag it ended up in, but was misleading
about what it actually was—because if you actually want “last build
date”, you should use `now()`. (Due to the potential for edits, I think
that either there should be an official `updated` field on pages, or
that these templates should use `now()`.)
2020-04-14 17:27:08 +05:30
Chris Morgan
e25915b231 Support and default to generating Atom feeds
This includes several breaking changes, but they’re easy to adjust for.

Atom 1.0 is superior to RSS 2.0 in a number of ways, both technical and
legal, though information from the last decade is hard to find.
http://www.intertwingly.net/wiki/pie/Rss20AndAtom10Compared
has some info which is probably still mostly correct.

How do RSS and Atom compare in terms of implementation support? The
impression I get is that proper Atom support in normal content websites
has been universal for over twelve years, but that support in podcasts
was not quite so good, but getting there, over twelve years ago. I have
no more recent facts or figures; no one talks about this stuff these
days. I remember investigating this stuff back in 2011–2013 and coming
to the same conclusion. At that time, I went with Atom on websites and
RSS in podcasts. Now I’d just go full Atom and hang any podcast tools
that don’t support Atom, because Atom’s semantics truly are much better.

In light of all this, I make the bold recommendation to default to Atom.

Nonetheless, for compatibility for existing users, and for those that
have Opinions, I’ve retained the RSS template, so that you can escape
the breaking change easily.

I personally prefer to give feeds a basename that doesn’t mention “Atom”
or “RSS”, e.g. “feed.xml”. I’ll be doing that myself, as I’ll be using
my own template with more Atom features anyway, like author information,
taxonomies and making the title field HTML.

Some notes about the Atom feed template:

- I went with atom.xml rather than something like feed.atom (the .atom
  file format being registered for this purpose by RFC4287) due to lack
  of confidence that it’ll be served with the right MIME type. .xml is a
  safer default.

- It might be nice to get Zola’s version number into the <generator>
  tag. Not for any particularly good reason, y’know. Just picture it:

    <generator uri="https://www.getzola.org/" version="0.10.0">
	Zola
    </generator>

- I’d like to get taxonomies into the feed, but this requires exposing a
  little more info than is currently exposed. I think it’d require
  `TaxonomyConfig` to preferably have a new member `permalink` added
  (which should be equivalent to something like `config.base_url ~ "/" ~
  taxonomy.slug ~ "/"`), and for the feed to get all the taxonomies
  passed into it (`taxonomies: HashMap<String, TaxonomyTerm>`).
  Then, the template could be like this, inside the entry:

    {% for taxonomy, terms in page.taxonomies %}
        {% for term in terms %}
            <category scheme="{{ taxonomies[taxonomy].permalink }}"
		term="{{ term.slug }}" label="{{ term.name }}" />
	{% endfor %}
    {% endfor %}

Other remarks:

- I have added a date field `extra.updated` to my posts and include that
  in the feed; I’ve observed others with a similar field. I believe this
  should be included as an official field. I’m inclined to add author to
  at least config.toml, too, for feeds.
- We need to have a link from the docs to the source of the built-in
  templates, to help people that wish to alter it.
2020-04-14 17:27:08 +05:30
Chris Morgan
4a10d0497e Normalise built-in templates
Two main purposes of changes here:

- To make the formatting and indentation of the raw output prettier;
- To simplify the HTML yielded by dropping unnecessary bits.

The 404 changes are a tad more extensive, altering the actual wording to
match conventional stub 404 pages a little more.
2020-04-14 17:27:08 +05:30
Chris Morgan
cc01d3f82f Make live reload work with missing </body>
The HTML spec doesn’t require it, and I prefer to omit it. This has been
bothering me for ages, but I hadn’t gotten round to fixing it yet.

This can cause nominally invalid HTML to be emitted, if `</body>` was
omitted but `</html>` was present, but that’s unlikely to happen, and
this is for development purposes only, and the right thing will happen
anyway in all environments (per browser behaviour and spec).

I don’t think this warrants a changelog entry.
2020-04-14 17:27:08 +05:30
Chris Morgan
d519cdd0a1 chmod -x a couple of files that needed it 2020-04-14 17:27:08 +05:30
GaaH
41bbaeb970
Add an optionnal lang parameter to get_url (#982)
* get_url takes an optionnal  parameter

* Documentation about the 'lang' parameter of 'get_url'

Co-authored-by: Gaëtan Caillaut <gaetan.caillaut@live.com>
2020-04-12 19:23:17 +02:00
Vincent Prouillet
b2eb00a374 Ensure lang is always set on default sections 2020-04-12 19:17:29 +02:00
Vincent Prouillet
56e25132a9 Update deps + fix some misleading doc 2020-04-12 17:21:04 +02:00
Yusuke Tanaka
e3cb4ff0ea
Preserve timestamps when copying files (#974) (#983)
* Preserve timestamps when copying files (#974)

* Do not copy files with the same modification timestamps

* Clean temp dbg!

* Add filesize comparison
2020-04-04 11:05:24 +02:00
Gaëtan Caillaut
16a22e76fa Fail if a language is set both in config.default_languages and config.languages 2020-03-31 02:15:58 +02:00
Vincent Prouillet
01597adfd2 Pass lang to taxonomy list template
Closes #963
2020-03-25 20:05:10 +01:00
Vincent Prouillet
91bf91a88b Fix link checker not checking for capital id/name
Closes #948
2020-03-25 19:54:24 +01:00
Vincent Prouillet
2eb8dcdf87 Revert "Fix RSS template (#969)"
This reverts commit 4b0339377f.
2020-03-12 20:44:41 +01:00
Andrew Barchuk
4b0339377f
Fix RSS template (#969)
Remove a link tag mistakenly imported from Atom XML namespace. The tag
was used to specify the link to the feed itself which is not supported
by RSS 2.0:
https://cyber.harvard.edu/rss/rss.html

Fixes #967
2020-03-12 20:31:29 +01:00
Vincent Prouillet
457996046c Update deps and changelog 2020-03-12 18:44:31 +01:00
Vincent Prouillet
2eaa791349 Enable strikethrough in markdown filter 2020-02-28 08:17:01 +01:00
Luke Hsiao
661bd9c0fa Set default user agent for external requests
Many servers will return errors (e.g. 400/403) to requests that do not
set a User-Agent header. This results in issues in both the link_checker
and load_data components. With the link_checker these are false positive
dead links. In load_data, remote data fails to be fetched. To mitigate
this issue, this sets a default User-Agent of

    $CARGO_PKG_NAME/$CARGO_PKG_VERSION

Note that the root cause of this regression from zola v0.9.0 is that
reqwest 0.10 changed their default behavior and no longer sets a
User-Agent by default:

    https://github.com/seanmonstar/reqwest/pull/751

Fixes #950.
2020-02-17 17:40:06 -08:00
Vincent Prouillet
15a3ab1a51 One last deps update 2020-02-16 19:17:41 +01:00
Vincent Prouillet
855d2376df Fix some theme extension
Closes #937
2020-02-10 23:09:22 +01:00
Vincent Prouillet
0d5fefd446 Update image to 0.23 2020-02-10 20:48:52 +01:00
Vincent Prouillet
a903473a87 Use rustls reqwest feature 2020-02-07 21:16:44 +01:00
Aphek
cc67bf0c88
Change continue-reading to use a span with id instead of a named anchor in a paragraph (#941)
* Change continue-reading to use a span element instead of named anchor

* Fix all tests
2020-02-07 21:07:10 +01:00
Vincent Prouillet
ac3ced828b
Multiple slugification strategies (#929) 2020-02-05 09:13:14 +01:00
Vincent Prouillet
8c1faac761 Update deps + fix tera fn error msg 2020-02-02 17:48:43 -08:00
Travis Cross
983e021d5b Fix warning when building site tests (#936)
For the site integration tests, we have a file of common code which is
used by multiple files in `tests/`.  However, not all functions in
this file are used by all files in `tests/`.

As Cargo compiles each `tests/*.rs` file as a separate crate, this
means that some of these crates end up with unused code.  Rust notices
this and prints a warning.

Let's tell Rust that we don't care about dead code in this file so
that the warning is not printed.
2020-02-02 17:48:43 -08:00
ethereal
94445ae745 Add --root global argument. Fixes #899. (#932) 2020-02-02 17:48:43 -08:00
Sepehr Torab Parhiz
2fa442cead Add Markdown strikethrough rendering (#924)
Fixes #921
2020-02-02 17:48:43 -08:00
Rostislav
145671ed20 Detect empty links on markdown rendering and issue an error (#884)
* Detect empty links on markdown rendering and issue an error

* Add a test for empty links stopping rendering with an error

* Assert error message is the expected one

When testing for empty links detection compare the error message
to make sure it's the correct error that stopped the process
and not some unrelated issue.
2020-02-02 17:48:43 -08:00
Sam Ford
0c93e15b1f Update tokio and re-enable check_site test (#915)
The issue with the check_site test hanging and timing out seems to
be related to a similar reqwest issue, which was ultimately due to
an upstream bug in tokio and may be fixed in tokio 0.2.7 onward.
2020-02-02 17:48:43 -08:00
djugei
046213ce28 fixed warning (#912) 2020-02-02 17:48:43 -08:00
Vincent Prouillet
44a07a4a55 Disable check_site test for now 2020-02-02 17:48:43 -08:00
Vincent Prouillet
622b0f2965 Serialize toc level 2020-02-02 17:48:43 -08:00
Sam Ford
d7bad732f1 Update reqwest to v0.10 (#892) 2020-02-02 17:48:43 -08:00
Sam Ford
3ef62036ef Fix benchmarks (#901)
* Restore #![feature(test)] and extern crate test; statements, which
were mistakenly removed as part of the Rust 2018 edition migration.

* Fix rendering benchmark's usage of RenderContext. 6 parameters were
provided when 5 were expected.
2020-02-02 17:48:43 -08:00
Sam Ford
6b5768fd76 Treat 304 as valid, add mock tests, fix mock issue (#900)
* Treat 304 (Not Modified) requests as valid.

* Add tests for 301-to-200 links, 301-to-404 links, and 500 links.
This helps to test redirections and the previously-added
response.status() checking for non-success status codes in check_url().

* Make names for HTTP mock paths unique, to avoid weird behavior. It
seems like mocks with the same path can potentially bleed between
tests, so you may end up with an unexpected response which causes the
test to sometimes pass and sometimes fail.

* Fix Clippy warnings about String::from(format!()).
2020-02-02 17:48:43 -08:00
Sam Ford
11f7a6d114 Mock HTTP requests in tests (#898)
Certain tests involving HTTP requests were sometimes hanging
indefinitely, so this uses Mockito for HTTP mocking. This seemingly
resolves the issue and makes these tests more reliable.

The existing can_fail_404_links test has been renamed to
can_fail_unresolved_links, to represent what actually occurs in the
test. The can_fail_404_links test now deals with a proper 404
response.

Just to be clear, the check_site test in the site component will
still create outgoing HTTP requests (due to the URLs used in the
test_site), so this commit only uses HTTP mocking where possible.
2020-02-02 17:48:43 -08:00
Sam Ford
2f1b592ab4 link_checker: Handle non-success status codes (#897)
The can_fail_404_links() test doesn't encounter a 404 response in
actuality, since the google.comys domain doesn't resolve. When the
test is updated such that the response's status code is a 404, the
test fails because the check_url() function doesn't handle
non-success responses how the test's assertions expect. This commit
updates check_url() to handle non-success responses, treating them
much like errors.
2020-02-02 17:48:43 -08:00
Sam Ford
b63c563622 Format code using cargo fmt (#896) 2020-02-02 17:48:43 -08:00
Sam Ford
e804f907b2 Use Rust 2018 edition (#885) 2020-02-02 17:48:43 -08:00
Vincent Prouillet
ceb9bc8ed7 Optionally do not slugify paths (#875)
* maybe_slugify() only does simple sanitation if config.slugify is false

* slugify is disabled by default, turn on for backwards-compatibility

* First docs changes for optional slugification

* Remove # from slugs but not &

* Add/fix tests for utf8 slugs

* Fix test sites for i18n slugs

* fix templates tests for i18n slugs

* Rename slugify setting to slugify_paths

* Default slugify_paths

* Update documentation for slugify_paths

* quasi_slugify removes ?, /, # and newlines

* Remove forbidden NTFS chars in quasi_slugify()

* Slugification forbidden chars can be configured

* Remove trailing dot/space in quasi_slugify

* Fix NTFS path sanitation

* Revert configurable slugification charset

* Remove \r for windows newlines and \t tabulations in quasi_slugify()

* Update docs for output paths

* Replace slugify with slugify_paths

* Fix test

* Default to not slugifying

* Move slugs utils to utils crate

* Use slugify_paths for anchors as well
2020-02-02 17:48:43 -08:00
Sam Ford
0a0b6a3ad4 Fix Clippy warnings (#886)
This addresses the following Clippy warnings:

* clippy::option_and_then_some
* clippy::useless_format
2020-02-02 17:48:43 -08:00
Vincent Prouillet
8e3f1f59f6 Update Tera 2020-02-02 17:48:43 -08:00
Philipp Oppermann
72373bea9b Add path to TranslatedContent (#863)
* Add path to `TranslatedContent`

This makes it possible to retrieve the translated page through the `get_page` function.

* Use TranslatedContent::path field in test_site_i18n

Use it with the `get_page` function to get a reference to the page object.
2020-02-02 17:48:43 -08:00
Vincent Prouillet
73ea4b3b16 Finish path collision & fix paginate_path when empty
Closes #866
2020-02-02 17:48:43 -08:00
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 `&amp;` […] 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
Vincent Prouillet
a42e6dfec4 Fix benches 2019-02-08 19:06:01 +01:00
Matthew Ziter
844be88472 Handle csv parsing error to fix issue getzola/zola#588 2019-02-04 15:58:58 -05:00
Vincent Prouillet
97d11995c5 Skip render=false sections in sitemap
Fix #604
2019-01-31 19:55:36 +01:00
Vincent Prouillet
776bf41123 Show actual Tera source error 2019-01-30 20:42:53 +01:00
Vincent Prouillet
260c413de4 Fix double trailing slash for section permalinks
Only happens for sections with lang != default
2019-01-30 20:01:26 +01:00
Vincent Prouillet
5082e0f15a Render all relevant parent sections on rebuild 2019-01-30 09:15:46 +01:00
Vincent Prouillet
1c7729cac6 Default lang to config.default_language 2019-01-29 19:20:11 +01:00
Peng Guanwen
0b897ce7c7 Replace trim_{left, right} with trim_{start, end}
trim_{start, end} is introduced in rust 1.30.0 and
trim_{left, right} is deprecated since 1.33.0.
2019-01-29 16:30:54 +08:00
Vincent Prouillet
9398ab789c Clone-less toc making 2019-01-28 00:34:18 +01:00
Vincent Prouillet
21d67235ae Arc-ify Library 2019-01-27 18:57:07 +01:00
Vincent Prouillet
d1154d236f Comment out failing test while its getting fixed in Tera 2019-01-26 11:46:54 +01:00
Vincent Prouillet
7c260eb5b2 Fix multilingual tests 2019-01-25 16:18:48 +01:00
Vincent Prouillet
1e2dd9ce03 Update tera to v1 alpha 2019-01-23 19:20:43 +01:00
Vincent Prouillet
464e384760
Merge pull request #581 from peng1999/event-refined
Footnote is now supported in headers
2019-01-22 17:24:33 +01:00
Vincent Prouillet
e119b68533 Remove earlier/later/lighter/heavier from pages when rendering sections 2019-01-21 17:55:05 +01:00
Nicolas Pochet
b65979fac7
Render the theme template files if present
* Change the behavior of the template rendering:
    * Check if the template bare name is present
    * Check if the template is part of a theme
    * Fallback to defaults
* Change the behavior of the shortcode rendering:
    * Call the template rendering function
* Prepend `__zola_builtins/` to most of the default elements in `ZOLA_TERA`
* Add a test to verify the presence and content of a `404.html` page
from a theme's template
2019-01-19 18:06:51 +01:00
Peng Guanwen
5ab3466e2b Doc improvements 2019-01-18 22:50:35 +08:00
Vincent Prouillet
1b4cfd49d0 More early tera fns and mention limitation of shortcodes in docs 2019-01-17 18:29:18 +01:00
Vincent Prouillet
83472a53d7 Register load_data early
Closes #582
2019-01-17 18:18:03 +01:00
Vincent Prouillet
5caf24f06c Remove error-chain
Closes #576
2019-01-17 14:31:47 +01:00
Vincent Prouillet
69fb399726 Add failing shortcode body split test 2019-01-17 14:31:47 +01:00
Peng Guanwen
1dbd8874c0 derive Debug for HeaderIndex 2019-01-16 17:09:23 +08:00
Peng Guanwen
80786a2fbb Revert accidentally change 2019-01-12 17:25:01 +08:00
Peng Guanwen
c027cd97d6 Footnote is now supported in headers
This fixes #569 .

`markdown_to_html` is heavily refactored, header-related things is
handled in a second pass.
2019-01-12 16:55:52 +08:00
Vincent Prouillet
538866487b Add multilingual taxonomies 2019-01-07 21:03:34 +01:00
toidiu
09f691fa47 add id to continue reading p tag (#577)
* add id to continue reading p tag
2019-01-07 19:20:19 +01:00
Peng Guanwen
7130616f63 Minor fixes 2019-01-06 19:04:53 +08:00
Peng Guanwen
972aab1ac4 Add emphasis, strong and code support in header 2019-01-05 23:50:30 +08:00
Peng Guanwen
774514f4d4 refactor markdown_to_html
this commit contains two refactors:
- extract custom link transformations into a function.
- separate some trivial markup generation.
2019-01-05 23:50:30 +08:00
Vincent Prouillet
2e126b3a08 Fix race condition with language folder creation 2019-01-04 21:57:27 +01:00
Vincent Prouillet
f45293ab25 cargo fmt 2019-01-04 20:34:28 +01:00
Vincent Prouillet
19075191ff Add translations to page/sections 2019-01-04 20:31:31 +01:00
Vincent Prouillet
3d22b4f1f9 Generate per language RSS feed 2019-01-02 22:11:34 +01:00
Vincent Prouillet
832360f9b1 Update deps + rustfmt 2019-01-02 20:41:29 +01:00
Vincent Prouillet
fdb6a2864c
Merge pull request #566 from vojtechkral/imgproc
Implement suggestions in #546
2018-12-30 12:44:48 +01:00
Vincent Prouillet
a12e9512bc fmt/clippy 2018-12-29 11:17:43 +01:00
Vincent Prouillet
34708d6592 Handle editing language index colocated 2018-12-28 18:18:12 +01:00
Vincent Prouillet
7313b41f4d Start adding some tests for building multilingual sites 2018-12-28 17:30:47 +01:00
Vincent Prouillet
779511ae43 Pass down lang and start docs 2018-12-28 13:24:49 +01:00
Vincent Prouillet
1d06324a65 Load multi-languages pages/sections 2018-12-28 12:15:17 +01:00
Vincent Prouillet
b0f6963e4c Use lang code in permalinks 2018-12-28 10:42:26 +01:00
Vojtech Kral
9bd6a559c1 imageproc: Use Lanczos3 filter instead of Gaussian 2018-12-28 01:41:22 +01:00
Vojtech Kral
6e84eec32b imageproc: Add the format option, support for PNG thumbnails
Fix #546
2018-12-28 01:41:22 +01:00
Vincent Prouillet
e50d3daad1 Get language from filename 2018-12-27 13:26:53 +01:00
Vincent Prouillet
f0cafcd1d6 Add languages to config 2018-12-27 10:53:17 +01:00
Vincent Prouillet
c0bbe16eac cargo fmt + update 2018-12-10 18:21:08 +01:00
Anton Lazarev
885c7ded80
inject livereloader for 404 template 2018-12-07 20:47:01 -05:00
Anton Lazarev
7cff1d335c
add rendering for 404.html when running zola serve 2018-12-06 20:07:34 -05:00
Vincent Prouillet
814cec99e2 Allow RFC3339 datetimes in filenames
Closes #537
2018-11-30 22:21:00 +01:00
Vincent Prouillet
0cf8e8ca1c Fix pagers not being in sitemap
Closes #521
2018-11-29 21:48:04 +01:00
Vincent Prouillet
b3004c69ef Fix broken taxonomies pagination
Closes #533
2018-11-29 20:24:46 +01:00
Vincent Prouillet
4fa9d89ea8
Merge pull request #532 from sinkuu/redundant_clone
Remove redundant clone
2018-11-20 11:46:06 +01:00
Vincent Prouillet
9a99b40216 Add test for rebuild after deletion 2018-11-19 17:25:24 +01:00
Vincent Prouillet
a465d6a61e Fix deleting while zola serve 2018-11-19 17:19:05 +01:00
Shotaro Yamada
692103bff4 Remove redundant clone 2018-11-19 23:08:34 +09:00
Vincent Prouillet
aee41f279c Fix reload with taxonomies 2018-11-16 23:51:11 +01:00
Vincent Prouillet
e2c3bb2ce2 Fix shortcodes <-> markdown indentation 2018-11-16 18:19:38 +01:00
Vincent Prouillet
41a693a528 Ignore rename of non md files 2018-11-16 16:59:06 +01:00
Vincent Prouillet
7af314c61e Update deps + fmt 2018-11-14 17:34:21 +01:00
Vincent Prouillet
20a05da475 Fix bug with pages starting with dates 2018-11-13 00:08:46 +01:00
Vincent Prouillet
afc30543cc Handle file/dir renaming
Closes #385
2018-11-10 22:23:39 +01:00
Vincent Prouillet
59f3e54e4e Add test for nested page_template 2018-11-07 20:48:39 +01:00
Vincent Prouillet
2d324b3cee Do not clone tpl name for pages 2018-11-07 20:38:07 +01:00
Vincent Prouillet
9c2eeaf1f7 Fewer string cloning for tpl names 2018-11-07 20:38:07 +01:00
Vincent Prouillet
56af4ca7f9 Add page_template to sections
To override all child pages

Closes #397
Tests from PR #434
2018-11-07 19:42:23 +01:00
Vincent Prouillet
a3b0f1e103 Add transparent sections
Closes #413
Closes #408
2018-11-06 00:46:13 +01:00
Vincent Prouillet
3c8505ffb4 Fix 1.28 build for real 2018-11-05 22:22:15 +01:00
Vincent Prouillet
988811a4bd Fix build for 1.28 2018-11-02 08:30:57 +01:00
Vincent Prouillet
cb3c42078a Fix load_toml date handling and fix bug in date conversion 2018-11-01 10:36:19 +01:00
Vincent Prouillet
b7ce4e59fb rustfmt 2018-10-31 08:18:57 +01:00
Vincent Prouillet
8586bc1838 Some clippy fixes 2018-10-30 15:47:49 +01:00
Vincent Prouillet
d524482ac1 Cargo update & some doc tweak 2018-10-30 15:07:23 +01:00
Jake Howard
aad12d829f Remote data (#494) 2018-10-29 20:13:09 +01:00
Vincent Prouillet
a0da580f87 Do not error on files starting with utf-8 BOM
Close #501
2018-10-29 12:43:53 +01:00
Vincent Prouillet
db4def63dc Set date from filename
Fix #396
2018-10-25 16:22:02 +02:00
Vincent Prouillet
0f6c0736cb Serialize page/section assets only once 2018-10-24 11:49:09 +02:00
Vincent Prouillet
4e3d231ca9 Small refactor for serialized page/sections 2018-10-24 11:40:57 +02:00
Vincent Prouillet
dc94aa219b Do not paginate drafts
Fix #495
2018-10-23 13:37:24 +02:00
Vincent Prouillet
19b4341957 Fix test 2018-10-22 22:34:38 +02:00
Magnus Hovland Hoff
05b8bb4ac6 Ensure root output directory exists explicitly.
Aliases that have no directory nesting sneakily avoid the code path that ensures the directories exist
2018-10-22 22:17:51 +02:00
Vincent Prouillet
4c9fd0d302 Do not panic if something is already bound to 1111 in serve 2018-10-19 16:33:11 +02:00
Vincent Prouillet
e2b0ad47c6
Merge pull request #489 from jwatt/next
Remove unmatchable rules from render_shortcodes
2018-10-19 14:11:41 +02:00
Vincent Prouillet
465778c196 Always populate sections on section change 2018-10-19 08:59:45 +02:00
Jonathan Watt
f1b6f3082e Remove unmatchable rules from render_shortcodes 2018-10-19 01:00:11 +01:00
Vincent Prouillet
1811c18b4a No need for clone 2018-10-18 23:20:29 +02:00
Vincent Prouillet
0101e5cb12 Update docs to refer to zola 2018-10-18 23:11:36 +02:00
Vincent Prouillet
f84ae7c93b Rename all occurrences of gutenberg to zola in code 2018-10-18 22:50:06 +02:00
Vincent Prouillet
dffd39aa8f Do not have trailing slash for rss.xml
Closes #486
2018-10-18 18:09:32 +02:00
Vincent Prouillet
83b04a561c Expose relative path of pages & sections
Closes #485
2018-10-18 18:00:40 +02:00
Luke Frisken
1baa7750f3 CSV and TOML loading global functions (#379)
Local CSV/TOML/JSON loading Tera function
2018-10-18 17:32:30 +02:00
Vincent Prouillet
ad6e443ffa
Merge pull request #484 from Keats/subsections
section.subsections is now an array of paths
2018-10-18 17:17:57 +02:00
Vincent Prouillet
86c418372f Add metadata_only to get_section 2018-10-18 16:49:33 +02:00
Vincent Prouillet
957c6bed9d Have a list of ancestors instead of only parent section 2018-10-18 15:54:51 +02:00
Michael Plotke
4db629a060 prevent html tags from appearing in the toc 2018-10-18 08:58:50 -04:00
Vincent Prouillet
f14dbcbdf4 section.subsections is now an array of paths
Close #446
Close #260
Close #478
Close #284
Close #480
2018-10-15 22:28:27 +02:00
Vincent Prouillet
ce79f9881a
Merge pull request #474 from jwatt/next
Fix content parser's 'text' rule to use the correct production
2018-10-11 14:17:21 +02:00
Vincent Prouillet
7ecdc47b91 Remove line trimming for shortcode bodies
Can't remember why it was doing that even
with the comment and the test added in the
commit still pass so...

Fix #462
2018-10-10 15:26:33 +02:00
Vincent Prouillet
44a33c020c Clearer error message when failing to load theme.toml 2018-10-10 13:58:21 +02:00
Chris Krycho
56c5036abc
Allow inclusion of all items in RSS feeds.
Switch to an `Option<usize>` for the serialized value of `rss_items`.
This lets us just set a blank value in the configuration and thereby
include *all* items.

This is a backwards-compatible change; it does not affect the behavior
of existing configurations.

Fixes #468. Closes #471.
2018-10-09 20:20:09 -06:00
Jonathan Watt
324211159e Fix content parser's 'text' rule to use the correct production 2018-10-09 20:13:16 +01:00
Vincent Prouillet
0b0b4a86db Update pest for shortcode parser 2018-10-09 15:24:56 +02:00
Vincent Prouillet
ee3f4dc511 Update to syntect 3 2018-10-09 14:33:43 +02:00
Vincent Prouillet
0ce3a0f070
Merge pull request #459 from Keats/database
Slotmap refactor
2018-10-09 11:30:49 +02:00
Vincent Prouillet
6843ec5c9c Rebuild more things now that it is more performant to do so
Fix #122
2018-10-06 13:52:40 +02:00
Vincent Prouillet
cdcebaea26 Cleanup of slotmap impl
Fix #205
2018-10-05 19:46:04 +02:00
Vincent Prouillet
396d237673 Use Tera render_with_borrowed 2018-10-05 15:03:22 +02:00
Vincent Prouillet
10aba20fe5 Slotmap refactor 2018-10-03 16:29:29 +02:00
Greizgh
fec58054b4 Inject config in robots.txt context
This allow to use base_url in robots.txt, to reference a sitemap for
example.
2018-10-02 08:15:26 +02:00