diff --git a/docs/api/build/artifact/index.html b/docs/api/build/artifact/index.html index f42e9388..64215f77 100644 --- a/docs/api/build/artifact/index.html +++ b/docs/api/build/artifact/index.html @@ -196,7 +196,7 @@ instances.

The most important function of an artifact is open which can open the artifact for reading or writing. If the build goes well, Lektor will commit those changes and persist them.

-

Example

ctx = get_ctx()
+

Example

ctx = get_ctx()
 @ctx.sub_artifact('artifact.txt')
 def build_stylesheet(artifact):
     with artifact.open('w') as f:
diff --git a/docs/api/build/artifact/open/index.html b/docs/api/build/artifact/open/index.html
index 57e4fda4..b851bc45 100644
--- a/docs/api/build/artifact/open/index.html
+++ b/docs/api/build/artifact/open/index.html
@@ -196,7 +196,7 @@ automatically is created.  This can be disabled or enabled with the
 

If the artifact is opened for writing, a copy will be created and only committed when the entire build process goes through smoothly and the changes are committed by the builder.

-

Example

ctx = get_ctx()
+

Example

ctx = get_ctx()
 @ctx.sub_artifact('artifact.txt')
 def build_stylesheet(artifact):
     with artifact.open('w') as f:
diff --git a/docs/api/build/artifact/render-template-into/index.html b/docs/api/build/artifact/render-template-into/index.html
index 45eec558..346d88c9 100644
--- a/docs/api/build/artifact/render-template-into/index.html
+++ b/docs/api/build/artifact/render-template-into/index.html
@@ -194,7 +194,7 @@ catch the error and render it into the template with a failure marker.  This
 can be changed with the fail parameter.  This is similar to the behavior of
 the render_template method of the
 environment.

-

Example

class MyBuildProgram(BuildProgram):
+

Example

class MyBuildProgram(BuildProgram):
     ...
 
     def build_artifact(self, artifact):
diff --git a/docs/api/build/artifact/replace-with-file/index.html b/docs/api/build/artifact/replace-with-file/index.html
index be117e38..f505dd58 100644
--- a/docs/api/build/artifact/replace-with-file/index.html
+++ b/docs/api/build/artifact/replace-with-file/index.html
@@ -193,7 +193,7 @@
 on commit.  This is useful when you are dealing with external applications
 that create temporaries.  By default the file is moved as this is what's
 common with temporaries but this can be changed into a copy with copy=True.

-

Example

ctx = get_ctx()
+

Example

ctx = get_ctx()
 @ctx.sub_artifact('artifact.txt')
 def build_stylesheet(artifact):
     temporary_file = invoke_external_program()
diff --git a/docs/api/build/context/changed-base-url/index.html b/docs/api/build/context/changed-base-url/index.html
index 6fc274eb..38830f3f 100644
--- a/docs/api/build/context/changed-base-url/index.html
+++ b/docs/api/build/context/changed-base-url/index.html
@@ -199,7 +199,7 @@
 but in some cases this can lead to issues when plugins attempt more complex
 operations.  In these cases the base URL can temporarily be overridden
 with this method.

-

Example

with get_ctx().changed_base_url('/downloads/'):
+

Example

with get_ctx().changed_base_url('/downloads/'):
     url = url_to('/')
 
diff --git a/docs/api/build/context/gather-dependencies/index.html b/docs/api/build/context/gather-dependencies/index.html index 9448eaff..ca97352e 100644 --- a/docs/api/build/context/gather-dependencies/index.html +++ b/docs/api/build/context/gather-dependencies/index.html @@ -200,7 +200,7 @@ automatically track dependencies. However in some cases it might be useful for a plugin to know exactly which dependencies are recorded.

In this case this method can be used as a context manager. Whenever Lektor encounters a dependency it will invoke the passed function.

-

Example

deps = set()
+

Example

deps = set()
 with get_ctx().gather_dependencies(deps.add):
     items = pad.query('/path/to/some/pages').all()
 print('The dependencies are: %s' % deps)
diff --git a/docs/api/build/context/index.html b/docs/api/build/context/index.html
index 03185450..3c044dad 100644
--- a/docs/api/build/context/index.html
+++ b/docs/api/build/context/index.html
@@ -200,7 +200,7 @@ will look at the context to decide on further operations to perform.

The current context can be discovered by calling the get_ctx function which will return it. If there is no artifact build ongoing then the return value will be None.

-

Basic Example

from lektor.context import get_ctx
+

Basic Example

from lektor.context import get_ctx
 
 ctx = get_ctx()
 print('The current source is %s' % ctx.source)
diff --git a/docs/api/build/context/locale/index.html b/docs/api/build/context/locale/index.html
index 05da10a3..5e3653bb 100644
--- a/docs/api/build/context/locale/index.html
+++ b/docs/api/build/context/locale/index.html
@@ -200,7 +200,7 @@ term for language and territory) the context provides this information.  It's
 automatically resolved based on configuration from the current alt.

This is primarily useful for plugins that want to change their behavior based on the current requested language.

-

Example

print get_ctx().locale
+

Example

print get_ctx().locale
 
diff --git a/docs/api/build/context/pad/index.html b/docs/api/build/context/pad/index.html index d288b38c..dd2422df 100644 --- a/docs/api/build/context/pad/index.html +++ b/docs/api/build/context/pad/index.html @@ -197,7 +197,7 @@

To access the current pad from the context, this attribute can be used. It refers to the active Pad.

-

Example

from lektor.context import get_ctx
+

Example

from lektor.context import get_ctx
 
 ctx = get_ctx()
 for child in ctx.pad.root.children:
diff --git a/docs/api/build/context/record-dependency/index.html b/docs/api/build/context/record-dependency/index.html
index 12abe2d5..d36a8f34 100644
--- a/docs/api/build/context/record-dependency/index.html
+++ b/docs/api/build/context/record-dependency/index.html
@@ -208,7 +208,7 @@ to record this as a dependency.

is possible to dependend to things outside of it, but the automatic watch system of the builder will not track files there so they will not show up unless a manual build is instructed.

-

Example

import os
+

Example

import os
 from lektor.pluginsystem import Plugin
 
 class IncludeFilePlugin(Plugin):
diff --git a/docs/api/build/context/record/index.html b/docs/api/build/context/record/index.html
index 155d309d..cdcd1313 100644
--- a/docs/api/build/context/record/index.html
+++ b/docs/api/build/context/record/index.html
@@ -198,7 +198,7 @@
       

This works almost exactly like the source property but the difference is that it is None if the source object is not a Record.

-

Example

from lektor.context import get_ctx
+

Example

from lektor.context import get_ctx
 
 ctx = get_ctx()
 print ctx.record.record_label
diff --git a/docs/api/build/context/source/index.html b/docs/api/build/context/source/index.html
index defa721f..1b91b961 100644
--- a/docs/api/build/context/source/index.html
+++ b/docs/api/build/context/source/index.html
@@ -199,7 +199,7 @@
 created from Source Objects, it's typically possible
 to refer back to it.  Note that there are situations in which artifacts are
 created but no source is available.  In this case the value will be None.

-

Example

from lektor.context import get_ctx
+

Example

from lektor.context import get_ctx
 
 ctx = get_ctx()
 print ctx.source.source_filename
diff --git a/docs/api/build/context/sub-artifact/index.html b/docs/api/build/context/sub-artifact/index.html
index db579613..faaa52fd 100644
--- a/docs/api/build/context/sub-artifact/index.html
+++ b/docs/api/build/context/sub-artifact/index.html
@@ -213,7 +213,7 @@ artifact is already considered up to date.

provided it can identify the configuration that the artifact was created from. If the hash changes the artifact will be rebuilt. Such a hash can for instance be generated with get_structure_hash.

-

Example

import os
+

Example

import os
 from lektor.pluginsystem import Plugin
 
 class IncludeFilePlugin(Plugin):
@@ -229,7 +229,7 @@ can for instance be generated with self.env.jinja_env.globals['get_demo_css'] = get_css
 

Inside a template it can be used like this:

-
<link rel=stylesheet href="{{ get_demo_css()|url }}">
+
<link rel=stylesheet href="{{ get_demo_css()|url }}">
 
diff --git a/docs/api/build/get-ctx/index.html b/docs/api/build/get-ctx/index.html index a2734514..54f1e788 100644 --- a/docs/api/build/get-ctx/index.html +++ b/docs/api/build/get-ctx/index.html @@ -174,7 +174,7 @@ if not. This means that if plugins only call that method in places where they know a build is access it's not necessary to check if the context is available.

For more information: Context.

-

Example

from lektor.context import get_ctx
+

Example

from lektor.context import get_ctx
 
 ctx = get_ctx()
 
diff --git a/docs/api/build/program/iter-child-sources/index.html b/docs/api/build/program/iter-child-sources/index.html index 87b29e16..a06340d6 100644 --- a/docs/api/build/program/iter-child-sources/index.html +++ b/docs/api/build/program/iter-child-sources/index.html @@ -189,7 +189,7 @@

Optionally a builder can yield further sources that are then picked up by the builder and processed normally. This is how the recursive build process in Lektor is implemented for normal records.

-

Example

def iter_child_sources(self):
+

Example

def iter_child_sources(self):
     for child in self.sources.children:
         yield child
 
diff --git a/docs/api/databags/index.html b/docs/api/databags/index.html index 843fa99f..8f31951c 100644 --- a/docs/api/databags/index.html +++ b/docs/api/databags/index.html @@ -197,11 +197,11 @@ which can for instance be used with the

Example Databag

This is a basic example of a data bag that contains configuration values for google maps. It's stored in databags/gmaps.ini:

-
key = 1233456ABCDEFG
+
key = 1233456ABCDEFG
 api_url = https://www.google.com/maps/embed/v1/
 

This can then be usde to good effect in templates:

-
{% macro render_map(location, width=600, height=450) %}
+
{% macro render_map(location, width=600, height=450) %}
   <iframe
     width="{{ width }}" height="{{ height }}"
     frameborder="0" style="border:0"
diff --git a/docs/api/databags/lookup/index.html b/docs/api/databags/lookup/index.html
index 3789d78a..77404b7f 100644
--- a/docs/api/databags/lookup/index.html
+++ b/docs/api/databags/lookup/index.html
@@ -167,7 +167,7 @@
 Python code.  Within templates you can also use the bag function which is easier to call.

The key is in dotted notation. For more information about this refer to the main databags documentation.

-

Example

def translate(pad, alt, key):
+

Example

def translate(pad, alt, key):
     return pad.databags.lookup('i18n.%s.%s' % (alt, key), key)
 
diff --git a/docs/api/db/expression/and/index.html b/docs/api/db/expression/and/index.html index 3050678e..3fab34b2 100644 --- a/docs/api/db/expression/and/index.html +++ b/docs/api/db/expression/and/index.html @@ -237,7 +237,7 @@ expression on the right are true. This is one of the few operators that differs between Python and templates. In templates you have to use the and method whereas in Python have to use the & operator.

-

Template Example

<h3>3 Star or Higher</h3>
+

Template Example

<h3>3 Star or Higher</h3>
 <ul>
 {% for item in this.children.filter(
     (F.type == 'hotel').and(F.stars >= 3)) %}
@@ -245,7 +245,7 @@ differs between Python and templates.  In templates you have to use the
 {% endfor %}
 </ul>
 
-

Python Example

def get_hotels(page):
+

Python Example

def get_hotels(page):
     return page.children.filter(
         (F.type == 'hotel') & (F.stars >= 3))
 
diff --git a/docs/api/db/expression/contains/index.html b/docs/api/db/expression/contains/index.html index 8904763d..14c63982 100644 --- a/docs/api/db/expression/contains/index.html +++ b/docs/api/db/expression/contains/index.html @@ -234,7 +234,7 @@

This expression evaluates to true if an item is contained within a field. This works with fields that are lists in nature or strings. For instance a string can be contained in another string or a item can be contained within a list.

-

Template Example

<h3>Projects Tagged 'amazing'</h3>
+

Template Example

<h3>Projects Tagged 'amazing'</h3>
 <ul>
 {% for item in this.children.filter(F.tags.contains('amazing')) %}
   <li>{{ item.name }}</li>
diff --git a/docs/api/db/expression/endswith-cs/index.html b/docs/api/db/expression/endswith-cs/index.html
index 886882b4..72b1d28e 100644
--- a/docs/api/db/expression/endswith-cs/index.html
+++ b/docs/api/db/expression/endswith-cs/index.html
@@ -235,7 +235,7 @@
 on the left side ends with the string on the right side.  This method
 operates in a case-sensitive manner.  For the case-insensitive method
 see endswith.

-

Example

<ul>
+

Example

<ul>
 {% for item in this.children.filter(F.name.endswith_cs('House')) %}
   <li>{{ item.name }}</li>
 {% endfor %}
diff --git a/docs/api/db/expression/endswith/index.html b/docs/api/db/expression/endswith/index.html
index ba504039..93726945 100644
--- a/docs/api/db/expression/endswith/index.html
+++ b/docs/api/db/expression/endswith/index.html
@@ -235,7 +235,7 @@
 on the left side ends with the string on the right side.  This method
 operates in a case-insensitive manner.  For the case-sensitive method
 see endswith_cs.

-

Example

<ul>
+

Example

<ul>
 {% for item in this.children.filter(F.name.endswith('house')) %}
   <li>{{ item.name }}</li>
 {% endfor %}
diff --git a/docs/api/db/expression/eq/index.html b/docs/api/db/expression/eq/index.html
index af1c8454..3bc4b5bc 100644
--- a/docs/api/db/expression/eq/index.html
+++ b/docs/api/db/expression/eq/index.html
@@ -233,7 +233,7 @@
 
       

This checks if the left side of the expression matches the right side. Typically it compares if a value matches a specific value exactly:

-

Example

<h2>Our Houses</h2>
+

Example

<h2>Our Houses</h2>
 <ul>
 {% for project in this.children.filter(F.type == 'house') %}
   <li>{{ project.name }}</li>
diff --git a/docs/api/db/expression/ge/index.html b/docs/api/db/expression/ge/index.html
index c985ba78..099573bd 100644
--- a/docs/api/db/expression/ge/index.html
+++ b/docs/api/db/expression/ge/index.html
@@ -233,7 +233,7 @@
 
       

This evaluates to true if the left side compares larger than the right side or equal to it. This behavior works best with integers or floats.

-

Template Example

<h3>3 or more Stars</h3>
+

Template Example

<h3>3 or more Stars</h3>
 <ul>
 {% for item in this.children.filter(F.stars >= 3) %}
   <li>{{ item.name }}: {{ item.stars }} stars</li>
diff --git a/docs/api/db/expression/gt/index.html b/docs/api/db/expression/gt/index.html
index a7668300..f9ec8940 100644
--- a/docs/api/db/expression/gt/index.html
+++ b/docs/api/db/expression/gt/index.html
@@ -234,7 +234,7 @@
       

This evaluates to true if the left side compares larger than the right side. This behavior works best with integers or floats.

-

Template Example

<h3>Well Rated Items</h3>
+

Template Example

<h3>Well Rated Items</h3>
 <ul>
 {% for item in this.children.filter(F.stars > 3) %}
   <li>{{ item.name }}: {{ item.stars }} stars</li>
diff --git a/docs/api/db/expression/index.html b/docs/api/db/expression/index.html
index 1ba39935..eb08883a 100644
--- a/docs/api/db/expression/index.html
+++ b/docs/api/db/expression/index.html
@@ -235,7 +235,7 @@ of it can create more expressive expressions.  F.name literally jus
 that a field by that name exists and is set to a value.

The query syntax is mostly the same in Python as well as in the Jinja 2 templates, the main difference are and and or.

-

Example

>>> p.children.filter((F.name == 'foo') | (F.name == 'bar')).all()
+

Example

>>> p.children.filter((F.name == 'foo') | (F.name == 'bar')).all()
 [<Page model=u'page' id=u'bar'>, <Page model=u'page' id=u'foo'>]
 
diff --git a/docs/api/db/expression/le/index.html b/docs/api/db/expression/le/index.html index 95f84ed7..65d049f7 100644 --- a/docs/api/db/expression/le/index.html +++ b/docs/api/db/expression/le/index.html @@ -233,7 +233,7 @@

This evaluates to true if the left side compares smaller than the right side or equal to it. This behavior works best with integers or floats.

-

Template Example

<h3>Projects From Before Including 2000</h3>
+

Template Example

<h3>Projects From Before Including 2000</h3>
 <ul>
 {% for item in this.children.filter(F.year <= 2000) %}
   <li>{{ item.name }} ({{ item.year }})</li>
diff --git a/docs/api/db/expression/lt/index.html b/docs/api/db/expression/lt/index.html
index 56b00b72..089630e5 100644
--- a/docs/api/db/expression/lt/index.html
+++ b/docs/api/db/expression/lt/index.html
@@ -233,7 +233,7 @@
 
       

This evaluates to true if the left side compares smaller than the right side or equal to it. This behavior works best with integers or floats.

-

Template Example

<h3>Projects From Before 2000</h3>
+

Template Example

<h3>Projects From Before 2000</h3>
 <ul>
 {% for item in this.children.filter(F.year < 2000) %}
   <li>{{ item.name }} ({{ item.year }})</li>
diff --git a/docs/api/db/expression/ne/index.html b/docs/api/db/expression/ne/index.html
index 00172ceb..1603705d 100644
--- a/docs/api/db/expression/ne/index.html
+++ b/docs/api/db/expression/ne/index.html
@@ -233,7 +233,7 @@
 
       

This checks if the left side of the expression does not match the right side by doing an exact comparison:

-

Example

<h2>Everything Other Than Houses</h2>
+

Example

<h2>Everything Other Than Houses</h2>
 <ul>
 {% for project in this.children.filter(F.type != 'house') %}
   <li>{{ project.name }}</li>
diff --git a/docs/api/db/expression/or/index.html b/docs/api/db/expression/or/index.html
index 9387584c..cae7dcff 100644
--- a/docs/api/db/expression/or/index.html
+++ b/docs/api/db/expression/or/index.html
@@ -237,7 +237,7 @@
 expression on the right are true.  This is one of the few operators that
 differs between Python and templates.  In templates you have to use the
 or method whereas in Python have to use the | operator.

-

Template Example

<h3>Hotels or Apartments</h3>
+

Template Example

<h3>Hotels or Apartments</h3>
 <ul>
 {% for item in this.children.filter(
     (F.type == 'hotel').or(F.type == 'apartment')) %}
@@ -245,7 +245,7 @@ differs between Python and templates.  In templates you have to use the
 {% endfor %}
 </ul>
 
-

Python Example

def get_hotels_or_apartments(page):
+

Python Example

def get_hotels_or_apartments(page):
     return page.children.filter(
         (F.type == 'hotel') | (F.type == 'apartment'))
 
diff --git a/docs/api/db/expression/startswith-cs/index.html b/docs/api/db/expression/startswith-cs/index.html index 7d78405c..fbc4831a 100644 --- a/docs/api/db/expression/startswith-cs/index.html +++ b/docs/api/db/expression/startswith-cs/index.html @@ -235,7 +235,7 @@ on the left side starts with the string on the right side. This method operates in a case-sensitive manner. For the case-insensitive method see startswith.

-

Example

<h1>A</h1>
+

Example

<h1>A</h1>
 <ul>
 {% for item in this.children.filter(F.name.startswith_cs('A')) %}
   <li>{{ item.name }}</li>
diff --git a/docs/api/db/expression/startswith/index.html b/docs/api/db/expression/startswith/index.html
index 7415f048..1e4f6f25 100644
--- a/docs/api/db/expression/startswith/index.html
+++ b/docs/api/db/expression/startswith/index.html
@@ -235,7 +235,7 @@
 on the left side starts with the string on the right side.  This method
 operates in a case-insensitive manner.  For the case-sensitive method
 see startswith_cs.

-

Example

<h1>A</h1>
+

Example

<h1>A</h1>
 <ul>
 {% for item in this.children.filter(F.name.startswith('a')) %}
   <li>{{ item.name }}</li>
diff --git a/docs/api/db/f/index.html b/docs/api/db/f/index.html
index 817acd0f..db64a7bc 100644
--- a/docs/api/db/f/index.html
+++ b/docs/api/db/f/index.html
@@ -195,7 +195,7 @@ field of an arbitrary record.  This can be achieved with the F obje
 attribute of it refers to a field in the record.  To make this clearer, have a
 look at the example below.

Accessing an attributes creates an Expression.

-

Example

<ul>
+

Example

<ul>
 {% for item in this.children.filter(F.status == 'published') %}
   <li>{{ item.title }}</li>
 {% endfor %}
diff --git a/docs/api/db/get-alts/index.html b/docs/api/db/get-alts/index.html
index 929c4735..97fc6aaa 100644
--- a/docs/api/db/get-alts/index.html
+++ b/docs/api/db/get-alts/index.html
@@ -197,7 +197,7 @@ value is an empty list.

This returns only the list of alt short IDs. Access to the configured name of the alt within the project config is not available. Databags should be used to provide alts with a humand readable title.

-

Example

<p>Other languages:
+

Example

<p>Other languages:
 <ul>
 {% for alt in get_alts(this) %}
   <li><a href="{{ '.'|url(alt=alt) }}">{{ alt|title }}</a></li>
diff --git a/docs/api/db/obj/alt/index.html b/docs/api/db/obj/alt/index.html
index c48c34ce..112ca6ea 100644
--- a/docs/api/db/obj/alt/index.html
+++ b/docs/api/db/obj/alt/index.html
@@ -230,7 +230,7 @@
 
       

For most source records there will be an associated alt. This attribute points to it. If the content is not associated with an alt this can be None.

-

Example

<!-- generated from alt {{ this.alt }} -->
+

Example

<!-- generated from alt {{ this.alt }} -->
 
diff --git a/docs/api/db/obj/index.html b/docs/api/db/obj/index.html index c160b3d1..c5c36235 100644 --- a/docs/api/db/obj/index.html +++ b/docs/api/db/obj/index.html @@ -248,7 +248,7 @@ in the path. The part after the at sign is called the “virtual path”.

the record's path + @source. So if the record was /hello then the path would be /hello@source. The true base record it belongs to can be referenced from the record property.

-
from lektor.sourceobj import VirtualSourceObject
+
from lektor.sourceobj import VirtualSourceObject
 from lektor.utils import build_url
 
 class Source(VirtualSourceObject):
diff --git a/docs/api/db/obj/is-child-of/index.html b/docs/api/db/obj/is-child-of/index.html
index 12ae5e00..39176a9d 100644
--- a/docs/api/db/obj/is-child-of/index.html
+++ b/docs/api/db/obj/is-child-of/index.html
@@ -233,7 +233,7 @@ page or not.  The default behavior is to consider a page to be a child of
 itself as this is more convenient in most situations but this can be
 changed with the strict parameter.  This method is particularly useful
 when building a navigation.

-

Example

<a href="{{ '/projects'|url }}"{% if this.is_child_of('/projects')
+

Example

<a href="{{ '/projects'|url }}"{% if this.is_child_of('/projects')
   %} class="active"{% endif %}>Projects</a>
 
diff --git a/docs/api/db/obj/is-discoverable/index.html b/docs/api/db/obj/is-discoverable/index.html index 3a0c1c6c..84da61c8 100644 --- a/docs/api/db/obj/is-discoverable/index.html +++ b/docs/api/db/obj/is-discoverable/index.html @@ -241,7 +241,7 @@ to implement drafts of blog posts or similar things.

This property is implemented on the level of source objects to make it possible to use this API in all cases. The default implementation of source objects will always return true for discoverability checks.

-

Example

{% set downloads = site.get('/downloads') %}
+

Example

{% set downloads = site.get('/downloads') %}
 {% if downloads.is_discoverable %}
   <p><a href="{{ downloads|url }}">Go to downloads</a>
 {% endif %}
diff --git a/docs/api/db/obj/is-hidden/index.html b/docs/api/db/obj/is-hidden/index.html
index e2dc0b9a..582f92bd 100644
--- a/docs/api/db/obj/is-hidden/index.html
+++ b/docs/api/db/obj/is-hidden/index.html
@@ -238,7 +238,7 @@ instance hidden pages can be used to store configuration values.

This property is implemented on the level of source objects to make it possible to use this API in all cases though the default implementation for source objects is that they are always visible.

-

Example

{% set downloads = site.get('/downloads') %}
+

Example

{% set downloads = site.get('/downloads') %}
 {% if downloads.is_hidden %}
   <p>Downloads are currently unavailable
 {% endif %}
diff --git a/docs/api/db/obj/is-visible/index.html b/docs/api/db/obj/is-visible/index.html
index 6dbdd679..1610ae62 100644
--- a/docs/api/db/obj/is-visible/index.html
+++ b/docs/api/db/obj/is-visible/index.html
@@ -229,7 +229,7 @@
       
 
       

This is exactly the opposite of is_hidden.

-

Example

{% set downloads = site.get('/downloads') %}
+

Example

{% set downloads = site.get('/downloads') %}
 {% if downloads.is_visible %}
   <p><a href="{{ downloads|url }}">go to downloads</a>
 {% endif %}
diff --git a/docs/api/db/obj/parent/index.html b/docs/api/db/obj/parent/index.html
index a33ec2f9..fc9acef7 100644
--- a/docs/api/db/obj/parent/index.html
+++ b/docs/api/db/obj/parent/index.html
@@ -232,7 +232,7 @@
 this property.  It's not a requirement that this property is implemented but
 most will have it.  In particular it's useful for virtual source objects
 where this property can be used to discover the associated parent object.

-

Example

<p>My parent is: {{ this.parent.path }}
+

Example

<p>My parent is: {{ this.parent.path }}
 
diff --git a/docs/api/db/obj/record/index.html b/docs/api/db/obj/record/index.html index d060c5ea..2591ccd4 100644 --- a/docs/api/db/obj/record/index.html +++ b/docs/api/db/obj/record/index.html @@ -239,7 +239,7 @@ for virtual sources this refers back to the record that was associated with the virtual source. Most of the time this matches parent but for nested source objects it's useful to be able to refer back to the base in all cases without having to walk up the parents.

-

Example

{% if this != this.record %}
+

Example

{% if this != this.record %}
   <a href="{{ this.record|url }}">go back to overview</a>
 {% endif %}
 
diff --git a/docs/api/db/obj/source-filename/index.html b/docs/api/db/obj/source-filename/index.html index 75681ecf..8b15bb18 100644 --- a/docs/api/db/obj/source-filename/index.html +++ b/docs/api/db/obj/source-filename/index.html @@ -232,7 +232,7 @@ instance if this is an asset it will be the path to it, if it is a record it will be the path to the lektor contents file. The path is relative to the project folder.

-

Example

<p>
+

Example

<p>
   Generated from {{ this.source_filename }}
 </p>
 
diff --git a/docs/api/db/obj/url-to/index.html b/docs/api/db/obj/url-to/index.html index 117f17d9..d960ec3e 100644 --- a/docs/api/db/obj/url-to/index.html +++ b/docs/api/db/obj/url-to/index.html @@ -239,7 +239,7 @@ domain part to the URL (if configured). The default behavior is to use the configured URL style (which is relative) unless absolute or external were explicitly provided. For more information read about this in the Project Configuration.

-

Example

{% set downloads = site.get('/downloads') %}
+

Example

{% set downloads = site.get('/downloads') %}
 Path from downloads to here: {{ downloads.url_to(this) }}
 
diff --git a/docs/api/db/pad/get-root/index.html b/docs/api/db/pad/get-root/index.html index dc759cbe..003ec243 100644 --- a/docs/api/db/pad/get-root/index.html +++ b/docs/api/db/pad/get-root/index.html @@ -214,7 +214,7 @@ Alternatives. This method can be used to target the root page of a specific one. If no alt is provided, then the primary alt is loaded.

-

Example

{% set root = site.get_root(alt='de') %}
+

Example

{% set root = site.get_root(alt='de') %}
 <a href="{{ root|url }}">Go to German Page</a>
 
diff --git a/docs/api/db/pad/get/index.html b/docs/api/db/pad/get/index.html index ef467071..201adc80 100644 --- a/docs/api/db/pad/get/index.html +++ b/docs/api/db/pad/get/index.html @@ -222,17 +222,17 @@ want to select a specific page for pagination, then you need to pass page_num with a valid page number or you use the virtual path (@1 for the first page for instance).

Examples

This is a simple example that shows how to use the method in a template:

-
{% set root = site.get('/') %}
+
{% set root = site.get('/') %}
 <title>{{ this.title }} | {{ root.title }}</title>
 

Here another example that loads the current page but in another language:

-
{% set other_lang = site.get(this._path, alt='ru') %}
+
{% set other_lang = site.get(this._path, alt='ru') %}
 <p>This page in Russian: {{ other_lang.title }}
 

Virtual Paths

This method can also be used to look up virtual paths. For instance to fetch a specific version of a pagination you can use a virtual path instead of using the page_num parameter:

-
>>> pad.get('/blog@3')
+
>>> pad.get('/blog@3')
 <Page model=u'blog' path='/blog' page_num=3>
 
diff --git a/docs/api/db/pad/index.html b/docs/api/db/pad/index.html index e37e5c91..7ac0dd8e 100644 --- a/docs/api/db/pad/index.html +++ b/docs/api/db/pad/index.html @@ -227,12 +227,12 @@ command line scripts.

Template Usage

A ready-configured pad is always available under the site name which allows you to easily discover other pages. Here is a basic example of how to do this through the get method:

-
{% set root = site.get('/') %}
+
{% set root = site.get('/') %}
 <title>{{ this.title }} | {{ root.title }}</title>
 

Plugin Usage

Within plugins it's typically not a good idea to construct a new Pad. Instead you can get access to the current pad from the active context:

-
from lektor.context import get_ctx
+
from lektor.context import get_ctx
 
 ctx = get_ctx()
 if ctx is not None:
@@ -244,7 +244,7 @@ instance.

Manual Pad Creation

If you want to work with the database from a script, you can create a pad from the Environment with the help of the new_pad method:

-
from lektor.project import Project
+
from lektor.project import Project
 
 project = Project.discover()
 env = project.make_env()
diff --git a/docs/api/db/pad/query/index.html b/docs/api/db/pad/query/index.html
index c7a0b3ed..6bf3ac6a 100644
--- a/docs/api/db/pad/query/index.html
+++ b/docs/api/db/pad/query/index.html
@@ -214,7 +214,7 @@
 Lektor.  It creates a query at a specific path and alt.  This is an
 alternative to accessing the children of the root record
 and will also include hidden pages.

-

Example

<ul>
+

Example

<ul>
 {% for project in site.query('/projects') %}
   <li>{{ project.name }}: {{ project.year }}</li>
 {% endfor %}
diff --git a/docs/api/db/pad/resolve-url-path/index.html b/docs/api/db/pad/resolve-url-path/index.html
index 3e6f23d9..f9448b84 100644
--- a/docs/api/db/pad/resolve-url-path/index.html
+++ b/docs/api/db/pad/resolve-url-path/index.html
@@ -218,7 +218,7 @@ happening in Lektor.

want to resolve to records you can pass include_assets=False and only records will be included.

Examples

Shows an example of how to resolve paths into assets:

-
>>> pad.resolve_url_path('/docs/api')
+
>>> pad.resolve_url_path('/docs/api')
 <Page model=u'doc-page' path=u'/docs/api'>
 >>> pad.resolve_url_path('/header.jpg')
 <Image model='none' path=u'/header.jpg'>
diff --git a/docs/api/db/pad/root/index.html b/docs/api/db/pad/root/index.html
index 52052754..9f8b1552 100644
--- a/docs/api/db/pad/root/index.html
+++ b/docs/api/db/pad/root/index.html
@@ -212,7 +212,7 @@
 
       

This works exactly like get_root but always returns the primary alternative and is implemented as a property.

-

Example

<a href="{{ site.root|url }}">Go to Index</a>
+

Example

<a href="{{ site.root|url }}">Go to Index</a>
 
diff --git a/docs/api/db/query/all/index.html b/docs/api/db/query/all/index.html index b612b2d6..75f165d8 100644 --- a/docs/api/db/query/all/index.html +++ b/docs/api/db/query/all/index.html @@ -235,7 +235,7 @@ the query as a list. In many cases just iterating over the query achieve the same result, but if you want an actual list this method comes in handy.

-

Example

{% items = site.query('/projects').include_hidden(false).all() %}
+

Example

{% items = site.query('/projects').include_hidden(false).all() %}
 {% if items %}
   <ul>
   {% for item in items %}
diff --git a/docs/api/db/query/count/index.html b/docs/api/db/query/count/index.html
index 51ab1efd..8c4eac8f 100644
--- a/docs/api/db/query/count/index.html
+++ b/docs/api/db/query/count/index.html
@@ -232,7 +232,7 @@
       
 
       

This is a simple way to count the total number of items a query matches.

-

Example

{% set project_count = site.query('/projects').count() %}
+

Example

{% set project_count = site.query('/projects').count() %}
 <p>We built {{ project_count }} projects.
 
diff --git a/docs/api/db/query/distinct/index.html b/docs/api/db/query/distinct/index.html index 2a73ca59..aa80438c 100644 --- a/docs/api/db/query/distinct/index.html +++ b/docs/api/db/query/distinct/index.html @@ -236,14 +236,14 @@

Returns a set with all values for field_name of all Records in this query.

Example

If your blog posts have a field called tags:

-
# blog-post.ini
+
# blog-post.ini
 
 [field.tags]
 name = Tags
 type = strings
 

You can display all your blog posts' tags with:

-
{% set tags = site.query('/blog').distinct('tags') %}
+
{% set tags = site.query('/blog').distinct('tags') %}
 {% if tags %}
   <ul>
     {% for tag in tags|sort %}
diff --git a/docs/api/db/query/filter/index.html b/docs/api/db/query/filter/index.html
index b85e2c08..56db244a 100644
--- a/docs/api/db/query/filter/index.html
+++ b/docs/api/db/query/filter/index.html
@@ -237,7 +237,7 @@ which allows you to perform comparisons with values that fields have.

Multiple filter calls can be chained as an alternative to using an and expression.

Example

Here a basic example of how to filter something in a template:

-
<ul>
+
<ul>
 {% for item in this.children.filter(F.status == 'published') %}
   <li>{{ item.title }}</li>
 {% endfor %}
diff --git a/docs/api/db/query/first/index.html b/docs/api/db/query/first/index.html
index b5030498..27edb7de 100644
--- a/docs/api/db/query/first/index.html
+++ b/docs/api/db/query/first/index.html
@@ -233,7 +233,7 @@
 
       

This method returns the first Record that matches the query. If no such record can be produced, None is returned.

-

Example

{% set first_visible = this.children.first() %}
+

Example

{% set first_visible = this.children.first() %}
 {% if first_visible %}
   <h2>Explore More ...</h2>
   <p>{{ first_visible.title }}
diff --git a/docs/api/db/query/get/index.html b/docs/api/db/query/get/index.html
index 867153e0..3317f8ef 100644
--- a/docs/api/db/query/get/index.html
+++ b/docs/api/db/query/get/index.html
@@ -235,7 +235,7 @@
 the get method of the pad but respects the currently
 applied filtering.  If page_num is provided it overrides the currently
 requested page number from the query for pagination.

-

Example

{% set p1 = this.children.get('project-1') %}
+

Example

{% set p1 = this.children.get('project-1') %}
 <h2>{{ p1.name }}</h2>
 <p>Our favorite!
 
diff --git a/docs/api/db/query/include-hidden/index.html b/docs/api/db/query/include-hidden/index.html index 84c16739..f3f35cec 100644 --- a/docs/api/db/query/include-hidden/index.html +++ b/docs/api/db/query/include-hidden/index.html @@ -239,7 +239,7 @@ method of the pad.

The parameter can be set to True to include hidden or False to exclude hidden records.

Example

Here a basic example of how to filter something in a template:

-
<ul>
+
<ul>
 {% for item in this.children.include_hidden(true) %}
   <li>{{ item.title }}{% if item.is_hidden %} (hidden){% endif %}</li>
 {% endfor %}
diff --git a/docs/api/db/query/include-undiscoverable/index.html b/docs/api/db/query/include-undiscoverable/index.html
index d6e2bec9..6e5a985a 100644
--- a/docs/api/db/query/include-undiscoverable/index.html
+++ b/docs/api/db/query/include-undiscoverable/index.html
@@ -240,7 +240,7 @@ include undiscoverable records by default.

If undiscoverable records should included this method needs to be used. Set it to True to include hidden or False to exclude them (default).

Example

Here a basic example of how to filter something in a template:

-
<ul>
+
<ul>
 {% for item in this.children.include_undiscoverable(true) %}
   <li>{{ item.title }}</li>
 {% endfor %}
diff --git a/docs/api/db/query/index.html b/docs/api/db/query/index.html
index 76d52418..d831dcdd 100644
--- a/docs/api/db/query/index.html
+++ b/docs/api/db/query/index.html
@@ -233,7 +233,7 @@ through either the Pad or through things like
 

Most operations on a query object return another one which will return a more filtered result.

Example

Here a basic example of how to filter something in a template:

-
<ul>
+
<ul>
 {% for item in this.children.filter(F.status == 'published') %}
   <li>{{ item.title }}</li>
 {% endfor %}
diff --git a/docs/api/db/query/limit/index.html b/docs/api/db/query/limit/index.html
index 192e892b..a2dc862e 100644
--- a/docs/api/db/query/limit/index.html
+++ b/docs/api/db/query/limit/index.html
@@ -233,7 +233,7 @@
 
       

The offset method can be used to limit the return value to a certain number of matching records.

-

Example

<h3>Our Top 3</h3>
+

Example

<h3>Our Top 3</h3>
 <ul>
 {% for item in this.children.order_by('-rating').limit(3) %}
   <li>{{ item.title }}</li>
diff --git a/docs/api/db/query/offset/index.html b/docs/api/db/query/offset/index.html
index 7ab787cd..ea9f01f1 100644
--- a/docs/api/db/query/offset/index.html
+++ b/docs/api/db/query/offset/index.html
@@ -235,7 +235,7 @@
 this is not useful as pagination comes built-in, but it can be helpful in
 some manual scenarios when working with data from the shell.

This is typically combined with limit.

-

Example

>>> pad.query('/projects').limit(5).offset(10).all()
+

Example

>>> pad.query('/projects').limit(5).offset(10).all()
 [...]
 
diff --git a/docs/api/db/query/order-by/index.html b/docs/api/db/query/order-by/index.html index 7bb076e2..f07267e9 100644 --- a/docs/api/db/query/order-by/index.html +++ b/docs/api/db/query/order-by/index.html @@ -239,7 +239,7 @@ order is reversed.

If two records have the same value for a field, then the ordering is defined on the next argument given. So if you order by ('year', 'name') it will first order by year and within a year it will order by name.

-

Example

<ul>
+

Example

<ul>
 {% for project in this.children.order_by('-year', 'name') %}
   <li>{{ project.year }}: {{ project.name }}</li>
 {% endif %}
diff --git a/docs/api/db/query/request-page/index.html b/docs/api/db/query/request-page/index.html
index 388f8fe6..31ec9158 100644
--- a/docs/api/db/query/request-page/index.html
+++ b/docs/api/db/query/request-page/index.html
@@ -238,7 +238,7 @@ this parameter it's possible to change this.  The parameter is the number
 of the page to access.

Truth be told: this method exists mostly for consistency and less because there is a good reason to use it.

-

Example

<ul>
+

Example

<ul>
 {% for child in this.children.request_page(1) %}
   <li>
     Items on the first page of {{ child.title }}:
diff --git a/docs/api/db/query/self/index.html b/docs/api/db/query/self/index.html
index 4e76cfc1..448684c1 100644
--- a/docs/api/db/query/self/index.html
+++ b/docs/api/db/query/self/index.html
@@ -234,7 +234,7 @@
       

Because a query object filters "downwards" there this is a way access the item at the level of the query object. It's particularly useful for debugging in the shell:

-

Example

>>> root = pad.root
+

Example

>>> root = pad.root
 >>> root.children.query.self == root
 True
 
diff --git a/docs/api/db/record/attachments/index.html b/docs/api/db/record/attachments/index.html index 0734da3c..4e1063f9 100644 --- a/docs/api/db/record/attachments/index.html +++ b/docs/api/db/record/attachments/index.html @@ -240,7 +240,7 @@

This returns a Query to all attachments of a page. This query can be further filtered to access specific types of attachments if needed.

-

Example

<div class="images">
+

Example

<div class="images">
 {% for image in this.attachments.images %}
   <img src="{{ image.thumbnail(240) }}">
 {% endfor %}
diff --git a/docs/api/db/record/children/index.html b/docs/api/db/record/children/index.html
index 4e85982c..f6abeb5b 100644
--- a/docs/api/db/record/children/index.html
+++ b/docs/api/db/record/children/index.html
@@ -249,7 +249,7 @@ available.

What's important to know about children is that the default query will exclude hidden children. This is different from creating a query object via the query method of the pad.

-

Example

<ul>
+

Example

<ul>
 {% for child in this.children %}
   <li>{{ child.title }}</li>
 {% endfor %}
diff --git a/docs/api/db/record/contents/index.html b/docs/api/db/record/contents/index.html
index 631930dc..0c51a98e 100644
--- a/docs/api/db/record/contents/index.html
+++ b/docs/api/db/record/contents/index.html
@@ -305,7 +305,7 @@ contents of that file:

Example

Here are some ideas of what you can do with it:

-
<img src="{{ image.contents.as_data_url() }}" alt="">
+
<img src="{{ image.contents.as_data_url() }}" alt="">
 
diff --git a/docs/api/db/record/exif/index.html b/docs/api/db/record/exif/index.html index 27fec6a0..468058df 100644 --- a/docs/api/db/record/exif/index.html +++ b/docs/api/db/record/exif/index.html @@ -348,7 +348,7 @@ into a dictionary that can be dumped to JSON for instance.

-

Example

{% if image.exif.location %}
+

Example

{% if image.exif.location %}
   <h2>Picture Location</h2>
   <iframe width="600" height="450" frameborder="0" style="border:0"
     src="https://www.google.com/maps/embed/v1/place?q={{
diff --git a/docs/api/db/record/format/index.html b/docs/api/db/record/format/index.html
index 119326ac..a9f787d1 100644
--- a/docs/api/db/record/format/index.html
+++ b/docs/api/db/record/format/index.html
@@ -239,7 +239,7 @@
 
       

This returns the format of the attachment as a string. This is currently only implemented for attachments that are images.

-

Example

{% for image in this.attachments.images %}
+

Example

{% for image in this.attachments.images %}
   <p>{{ image._id }}: {{ image.format }}
 {% endfor %}
 
diff --git a/docs/api/db/record/get_siblings/index.html b/docs/api/db/record/get_siblings/index.html index 7b731a5f..1accb42c 100644 --- a/docs/api/db/record/get_siblings/index.html +++ b/docs/api/db/record/get_siblings/index.html @@ -245,7 +245,7 @@ filter and order the children. Otherwise, the parent's standard configuration for children is used. See the pagination guide and the page order guide.

-

Example

{% set siblings = this.get_siblings() %}
+

Example

{% set siblings = this.get_siblings() %}
 
 {% if siblings.prev_page %}
   <a href="{{ siblings.prev_page|url }}">previous</a>
diff --git a/docs/api/db/record/getitem/index.html b/docs/api/db/record/getitem/index.html
index e6353984..2ed04e13 100644
--- a/docs/api/db/record/getitem/index.html
+++ b/docs/api/db/record/getitem/index.html
@@ -243,7 +243,7 @@ is why you can typically access foo.bar instead of foo['bar']
 conflict with a record property exists.

All available fields can be accessed this way (model defined fields as well as system fields which are prefixed by an underscore).

-

Example

for child in this.children:
+

Example

for child in this.children:
     print('ID: %s' % child['_id'])
 
diff --git a/docs/api/db/record/has_next/index.html b/docs/api/db/record/has_next/index.html index 2cc211a8..34cffc7c 100644 --- a/docs/api/db/record/has_next/index.html +++ b/docs/api/db/record/has_next/index.html @@ -243,7 +243,7 @@ filter and order the children. Otherwise, the parent's standard configuration for children is used. See the pagination guide and the page order guide.

-

Example

{% if this.has_next() %}
+

Example

{% if this.has_next() %}
   <a href="{{ this.get_siblings().next_page|url }}">next</a>
 {% else %}
   <p>This is the last entry.
diff --git a/docs/api/db/record/has_prev/index.html b/docs/api/db/record/has_prev/index.html
index 17e2aab0..f81218f7 100644
--- a/docs/api/db/record/has_prev/index.html
+++ b/docs/api/db/record/has_prev/index.html
@@ -243,7 +243,7 @@ filter and order the children. Otherwise, the parent's standard configuration
 for children is used.
 See the pagination guide and the
 page order guide.

-

Example

{% if this.has_prev() %}
+

Example

{% if this.has_prev() %}
   <a href="{{ this.get_siblings().prev_page|url }}">previous</a>
 {% else %}
   <p>This is the first entry.
diff --git a/docs/api/db/record/height/index.html b/docs/api/db/record/height/index.html
index 474a0492..5be5751f 100644
--- a/docs/api/db/record/height/index.html
+++ b/docs/api/db/record/height/index.html
@@ -240,7 +240,7 @@
       

If you are dealing with an attachment that is an image, this property becomes available and indicates the height of the image in pixels if that information is available.

-

Example

{% for image in this.attachments.images %}
+

Example

{% for image in this.attachments.images %}
   <img src="{{ image|url }}"
     height="{{ image.height }}"
     height="{{ image.height }}">
diff --git a/docs/api/db/record/index.html b/docs/api/db/record/index.html
index 58752c0a..9c91a147 100644
--- a/docs/api/db/record/index.html
+++ b/docs/api/db/record/index.html
@@ -244,7 +244,7 @@ objects from templates they give access to their built-in attributes as well
 as custom fields through the attribute syntax.  If however a built-in
 attribute overlaps with your custom field, you need to access the fields
 with the subscript syntax ([]):

-
<p>Built-in Path: {{ obj.path }}
+
<p>Built-in Path: {{ obj.path }}
 <p>Path field: {{ obj['path'] }}
 
diff --git a/docs/api/db/record/is-attachment/index.html b/docs/api/db/record/is-attachment/index.html index f1ae4cb9..aa3f6126 100644 --- a/docs/api/db/record/is-attachment/index.html +++ b/docs/api/db/record/is-attachment/index.html @@ -241,7 +241,7 @@ an attachment this will be true. Because some functionality only exists on one type but not the other this can be useful in some utility code to change the behavior.

-

Example

{% macro render_record_link(record) %}
+

Example

{% macro render_record_link(record) %}
   <a href="{{ record|url }}">{{ record.record_label }}</a>
   {% if record.is_attachment %} ({{ record._attachment_type }}){% endif %}
 {% endmacro %}
diff --git a/docs/api/db/record/pagination/index.html b/docs/api/db/record/pagination/index.html
index c7fb1fb6..c7b24269 100644
--- a/docs/api/db/record/pagination/index.html
+++ b/docs/api/db/record/pagination/index.html
@@ -302,7 +302,7 @@ the other page.  For more information also see the virtual path example
 below.

Changed in Lektor 2.0: The for_page() method was added.

Item Query Example

Simple example that shows how to iterate over the items specific to a page:

-
<ul>
+
<ul>
 {% for child in this.pagination.items %}
   <li>{{ child.title }}</li>
 {% endfor %}
@@ -310,7 +310,7 @@ page:

Pagination Example

This example shows how to render a basic pagination with a previous and next page link as well as the number of the current page:

-
<div class="pagination">
+
<div class="pagination">
   {% if this.pagination.has_prev %}
     <a href="{{ this.pagination.prev_page|url }}">&laquo;</a>
   {% else %}
@@ -328,11 +328,11 @@ next page link as well as the number of the current page:

a virtual path below the record itself. The value of the path is just the number of the page. So for instance to link to the second page you can just do this:

-
<a href="{{ '@2'|url }}">Go to Page 2</a>
+
<a href="{{ '@2'|url }}">Go to Page 2</a>
 

Alternatively you can also use the for_path() function which returns the entire pagination for a page:

-
<a href="{{ this.pagination.for_page(2)|url }}">Go to Page 2</a>
+
<a href="{{ this.pagination.for_page(2)|url }}">Go to Page 2</a>
 
diff --git a/docs/api/db/record/record-label/index.html b/docs/api/db/record/record-label/index.html index 11b9e1b1..e5061ff3 100644 --- a/docs/api/db/record/record-label/index.html +++ b/docs/api/db/record/record-label/index.html @@ -242,7 +242,7 @@ admin interface to show a human readable version of it. Typically this is the title or something similar. This functionality can also be used outside of the admin panel. This is particularly useful when rendering children of a page that might use different independent models.

-

Example

<ul>
+

Example

<ul>
 {% for child in this.children %}
   <li><a href="{{ child|url }}">{{ child.record_label }}</a></li>
 {% endfor %}
diff --git a/docs/api/db/record/thumbnail/index.html b/docs/api/db/record/thumbnail/index.html
index 2347681d..146ec991 100644
--- a/docs/api/db/record/thumbnail/index.html
+++ b/docs/api/db/record/thumbnail/index.html
@@ -263,15 +263,15 @@ image. In this case the original is returned instead.
 
  • url_path the URL path of the thumbnail. This is absolute and needs to be made relative with the |url filter.
  • -

    Example

    {% for image in this.attachments.images %}
    +

    Example

    {% for image in this.attachments.images %}
       <img src="{{ image.thumbnail(64)|url }}">
     {% endfor %}
     
    -
    {% for image in this.attachments.images %}
    +
    {% for image in this.attachments.images %}
       <img src="{{ image.thumbnail(height=64)|url }}">
     {% endfor %}
     
    -
    <img src="{{ image.thumbnail(1920, 1080, mode="crop", quality=40)|url }}">
    +
    <img src="{{ image.thumbnail(1920, 1080, mode="crop", quality=40)|url }}">
     
    diff --git a/docs/api/db/record/width/index.html b/docs/api/db/record/width/index.html index d066ef95..acb0aad4 100644 --- a/docs/api/db/record/width/index.html +++ b/docs/api/db/record/width/index.html @@ -240,7 +240,7 @@

    If you are dealing with an attachment that is an image, this property becomes available and indicates the width of the image in pixels if that information is available.

    -

    Example

    {% for image in this.attachments.images %}
    +

    Example

    {% for image in this.attachments.images %}
       <img src="{{ image|url }}"
         width="{{ image.width }}"
         height="{{ image.height }}">
    diff --git a/docs/api/db/system-fields/gid/index.html b/docs/api/db/system-fields/gid/index.html
    index ef223c4d..68854862 100644
    --- a/docs/api/db/system-fields/gid/index.html
    +++ b/docs/api/db/system-fields/gid/index.html
    @@ -227,7 +227,7 @@
     is useful in situations where a stable ID is needed that follows a certain
     format.  For instance it can come in useful when a ID is needed for a DOM
     element.

    -

    Example

    <body class="page-{{ this._gid }}">
    +

    Example

    <body class="page-{{ this._gid }}">
     ...
     </body>
     
    diff --git a/docs/api/db/system-fields/id/index.html b/docs/api/db/system-fields/id/index.html index 4bc0816c..402e24d1 100644 --- a/docs/api/db/system-fields/id/index.html +++ b/docs/api/db/system-fields/id/index.html @@ -233,7 +233,7 @@ filename of the attachment: screenshot.jpg.

    Note that IDs are not globally unique! There is also the _path which is the entire path if the record.

    The _id is automatically set and cannot be overridden.

    -

    Example

    <ul class="nav">
    +

    Example

    <ul class="nav">
     {% for item in site.query('/projects') %}
       <li{% if item._id == this._id %} class="active"{%
         endif %}>{{ item.name }}</li>
    diff --git a/docs/api/db/system-fields/model/index.html b/docs/api/db/system-fields/model/index.html
    index f337aa0f..9aaeb2dc 100644
    --- a/docs/api/db/system-fields/model/index.html
    +++ b/docs/api/db/system-fields/model/index.html
    @@ -227,7 +227,7 @@
     many situations the model is picked automatically but for equally many
     situations it needs to be selected manually.

    This field is most useful for filtering when operating on mixed collections.

    -

    Example

    <ul class="projects">
    +

    Example

    <ul class="projects">
     {% for child in this.children.filter(F._model == 'project') %}
       <li>{{ child.name }}</li>
     {% endfor %}
    diff --git a/docs/api/db/system-fields/path/index.html b/docs/api/db/system-fields/path/index.html
    index 3f3f86b9..fc20bead 100644
    --- a/docs/api/db/system-fields/path/index.html
    +++ b/docs/api/db/system-fields/path/index.html
    @@ -230,7 +230,7 @@ would be docs/api/db.

    The path can be used to uniquely identify a page but for that purpose the _gid can also be used which is a hashed hexadecimal version of the page.

    -

    Example

    <!-- generated from {{ this._path }} -->
    +

    Example

    <!-- generated from {{ this._path }} -->
     
    diff --git a/docs/api/db/system-fields/source-alt/index.html b/docs/api/db/system-fields/source-alt/index.html index 311864d5..fafda07c 100644 --- a/docs/api/db/system-fields/source-alt/index.html +++ b/docs/api/db/system-fields/source-alt/index.html @@ -228,7 +228,7 @@ to support the builder. In particular the difference to the _alt f that this one will indicate if an alt falls back to a different alternative. At present pages can only fall back to the _primary alternative which will be reflected by this field.

    -

    Example

    <!-- generated from language {{ this._source_alt }} -->
    +

    Example

    <!-- generated from language {{ this._source_alt }} -->
     
    diff --git a/docs/api/db/type/index.html b/docs/api/db/type/index.html index e9403219..ca4c9a57 100644 --- a/docs/api/db/type/index.html +++ b/docs/api/db/type/index.html @@ -201,7 +201,7 @@ method and set the widget property as a very basic requirement.

    to match the type name. If you want to name your type mything then it needs to be called MyThingType. Afterwards you can register it with the environment in setup_env:

    -
    from lektor.types import Type
    +
    from lektor.types import Type
     
     class MyThingType(Type):
         widget = 'singleline-text'
    diff --git a/docs/api/db/type/value-from-raw/index.html b/docs/api/db/type/value-from-raw/index.html
    index 8900b97d..a031c310 100644
    --- a/docs/api/db/type/value-from-raw/index.html
    +++ b/docs/api/db/type/value-from-raw/index.html
    @@ -211,7 +211,7 @@ database layer.  This can be any Python type for as long as it makes sense.
     It must either return a valid value or a special value that indicates a bad
     value.  For more information see the raw value information below and the
     example provided.

    -

    Example

    from lektor.types import Type
    +

    Example

    from lektor.types import Type
     
     class LocationType(Type):
         widget = 'singleline-text'
    diff --git a/docs/api/db/type/widget/index.html b/docs/api/db/type/widget/index.html
    index cf5fb0a8..317f1f3e 100644
    --- a/docs/api/db/type/widget/index.html
    +++ b/docs/api/db/type/widget/index.html
    @@ -210,7 +210,7 @@ but you can select one of the built-in widgets for your own type.  Note that
     not all widgets will necessarily will work directly with your type as such.
     For instance the select widget and some others will currently require some
     extra values be supplied in the to_json method.

    -

    Example

    from lektor.types import Type
    +

    Example

    from lektor.types import Type
     
     class MyThingType(Type):
         widget = 'singleline-text'
    diff --git a/docs/api/db/types/boolean/index.html b/docs/api/db/types/boolean/index.html
    index 3568cf56..b9ea59af 100644
    --- a/docs/api/db/types/boolean/index.html
    +++ b/docs/api/db/types/boolean/index.html
    @@ -264,13 +264,13 @@ It's most useful for representing flags that can be enabled or disabled.

    The checkbox_label attribute can be used to give a description to the checkbox which otherwise looks a little bit lonely in the admin panel.

    -

    Field Usage

    [fields.render_big]
    +

    Field Usage

    [fields.render_big]
     label = Render big
     type = boolean
     checkbox_label = If true, then the page will be rendered larger.
     default = false
     
    -

    Template Usage

    <div class="page{% if this.render_big %} page-large{% endif %}">
    +

    Template Usage

    <div class="page{% if this.render_big %} page-large{% endif %}">
       ...
     </div>
     
    diff --git a/docs/api/db/types/checkboxes/index.html b/docs/api/db/types/checkboxes/index.html index 5a9f0f4e..49dae3a3 100644 --- a/docs/api/db/types/checkboxes/index.html +++ b/docs/api/db/types/checkboxes/index.html @@ -258,13 +258,13 @@ default which means that the record's configured title will be used as label.

    In the contents file the values are stored as comma separated list.

    -

    Field Usage

    [fields.slideshow]
    +

    Field Usage

    [fields.slideshow]
     label = Slideshow
     type = checkboxes
     description = Attached images to include in the slidehow
     source = record.attachments.images
     
    -

    Template Usage

    {% for image in this.attachments.images %}
    +

    Template Usage

    {% for image in this.attachments.images %}
       {% if image._id in this.slideshow %}
         <img src="{{ image.thumbnail(500) }}" class="slide">
       {% endif %}
    diff --git a/docs/api/db/types/date/index.html b/docs/api/db/types/date/index.html
    index b16eaa7e..f04bdfe3 100644
    --- a/docs/api/db/types/date/index.html
    +++ b/docs/api/db/types/date/index.html
    @@ -241,11 +241,11 @@
     than a plain old string some basic operations can be provided in the
     templates.

    The canonical format for the type in text form is YYYY-MM-DD.

    -

    Field Usage

    [fields.pub_date]
    +

    Field Usage

    [fields.pub_date]
     label = Publication date
     type = date
     
    -

    Template Usage

    <p>Published: {{ this.pub_date.strftime('%d/%m/%Y') }}
    +

    Template Usage

    <p>Published: {{ this.pub_date.strftime('%d/%m/%Y') }}
     
    diff --git a/docs/api/db/types/datetime/index.html b/docs/api/db/types/datetime/index.html index 59d63bce..c2cc1bae 100644 --- a/docs/api/db/types/datetime/index.html +++ b/docs/api/db/types/datetime/index.html @@ -271,11 +271,11 @@ or pub_date: 2016-01-13 07:53:22 +0900
    -

    Field Usage

    [fields.pub_date]
    +

    Field Usage

    [fields.pub_date]
     label = Publication date
     type = datetime
     
    -

    Template Usage

    <p>Published: {{ this.pub_date.strftime('%Y-%m-%d %H:%M:%S') }}
    +

    Template Usage

    <p>Published: {{ this.pub_date.strftime('%Y-%m-%d %H:%M:%S') }}
     
    diff --git a/docs/api/db/types/float/index.html b/docs/api/db/types/float/index.html index 089eb087..642ba264 100644 --- a/docs/api/db/types/float/index.html +++ b/docs/api/db/types/float/index.html @@ -239,13 +239,13 @@

    The float type is similar to the integer one but it can store floating points instead of just integer values.

    -

    Field Usage

    [fields.percentage]
    +

    Field Usage

    [fields.percentage]
     label = Percentage
     type = float
     description = Just a percentage of a progress bar.
     addon_label = %
     
    -

    Template Usage

    <div class="progress-bar">
    +

    Template Usage

    <div class="progress-bar">
       <span class="progress" style="width: {{ this.percentage }}%"></span>
       <span class="label">{{ this.percentage }}%</span>
     </div>
    diff --git a/docs/api/db/types/flow/index.html b/docs/api/db/types/flow/index.html
    index f4a53b45..a6289f9c 100644
    --- a/docs/api/db/types/flow/index.html
    +++ b/docs/api/db/types/flow/index.html
    @@ -267,17 +267,17 @@ field-2: value 2
     within it, but the blocks can be individually accessed through the
     blocks attribute.  Each block's attributes are the individual fields which
     you are free to access if so desired.

    -

    Field Usage

    [fields.body]
    +

    Field Usage

    [fields.body]
     label = Body
     type = flow
     flow_blocks = text, image
     
    -

    Template Usage

    <div class="body">
    +

    Template Usage

    <div class="body">
       {{ this.body }}
     </div>
     

    or more complex:

    -
    <div class="body">
    +
    <div class="body">
       {% for item in this.body.blocks %}
         <div class="block">{{ item }}</div>
       {% endfor %}
    diff --git a/docs/api/db/types/html/index.html b/docs/api/db/types/html/index.html
    index 40307262..8c39643e 100644
    --- a/docs/api/db/types/html/index.html
    +++ b/docs/api/db/types/html/index.html
    @@ -240,12 +240,12 @@
           

    The html type is basically the same as the text type but in templates it's rendered directly as HTML instead of being escaped.

    It renders as a multi-line input field in the admin interface.

    -

    Field Usage

    [fields.tracking_code]
    +

    Field Usage

    [fields.tracking_code]
     label = Tracking Code
     description = raw HTML that is inserted for ad tracking purposes.
     type = html
     
    -

    Template Usage

    {{ this.tracking_code }}
    +

    Template Usage

    {{ this.tracking_code }}
     
    diff --git a/docs/api/db/types/integer/index.html b/docs/api/db/types/integer/index.html index e68d214a..b36b9ecc 100644 --- a/docs/api/db/types/integer/index.html +++ b/docs/api/db/types/integer/index.html @@ -241,13 +241,13 @@ arbitrary natural numbers both negative and positive. It should be used instead of a string when a real number with such behavior is wanted as it sorts numbers correctly and the numbers can be manipulated.

    -

    Field Usage

    [fields.image_width]
    +

    Field Usage

    [fields.image_width]
     label = Image width
     type = integer
     description = The intended image width in pixels.
     addon_label = px
     
    -

    Template Usage

    <img
    +

    Template Usage

    <img
       src="{{ this.image.thumbnail(this.image_width - 10) }}"
       alt="a thumbnail of that image"
       style="border: 5px;">
    diff --git a/docs/api/db/types/markdown/index.html b/docs/api/db/types/markdown/index.html
    index e49bf3d6..05f388f6 100644
    --- a/docs/api/db/types/markdown/index.html
    +++ b/docs/api/db/types/markdown/index.html
    @@ -261,11 +261,11 @@ there are some special attributes on it to access more information:

    Additional attributes can become available through the use of plugins.

    -

    Field Usage

    [fields.body]
    +

    Field Usage

    [fields.body]
     label = Body
     type = markdown
     
    -

    Template Usage

    <div class="body">
    +

    Template Usage

    <div class="body">
       {{ this.body }}
     </div>
     
    diff --git a/docs/api/db/types/select/index.html b/docs/api/db/types/select/index.html index 5a991449..826aea37 100644 --- a/docs/api/db/types/select/index.html +++ b/docs/api/db/types/select/index.html @@ -241,13 +241,13 @@ but unlike it you can only select a single item. For configuration options refer directly to the checkboxes type.

    In the contents file the values are stored as a single textual item.

    -

    Field Usage

    [fields.class]
    +

    Field Usage

    [fields.class]
     label = Class
     type = select
     choices = full-width, pull-left, pull-right
     choice_labels = Full Width, Pull Left, Pull Right
     
    -

    Template Usage

    <div class="{{ this.class }}">
    +

    Template Usage

    <div class="{{ this.class }}">
       ...
     </div>
     
    diff --git a/docs/api/db/types/sort-key/index.html b/docs/api/db/types/sort-key/index.html index f471ac51..f32dd1dc 100644 --- a/docs/api/db/types/sort-key/index.html +++ b/docs/api/db/types/sort-key/index.html @@ -240,7 +240,7 @@ basic ones in Lektor. It can store arbitrary natural numbers both negative and positive. It's intended for giving pages a sort order. The reason it's a special type is that future versions of Lektor can take advantage of this to implement a widget for ordering.

    -

    Field Usage

    [fields.sort_key]
    +

    Field Usage

    [fields.sort_key]
     label = Sort order
     type = sort_key
     
    diff --git a/docs/api/db/types/string/index.html b/docs/api/db/types/string/index.html index 1ebda821..36bbe066 100644 --- a/docs/api/db/types/string/index.html +++ b/docs/api/db/types/string/index.html @@ -241,14 +241,14 @@ arbitrary text. It's useful for many places where you want to show a bit of text without any special formatting (titles, basic summaries and more).

    It renders as a basic input field in the admin interface.

    -

    Field Usage

    [fields.title]
    +

    Field Usage

    [fields.title]
     label = Title
     type = string
     size = large
     description = The title of the page
     addon_label = [[header]]
     
    -

    Template Usage

    <h1>{{ this.title }}</h1>
    +

    Template Usage

    <h1>{{ this.title }}</h1>
     
    diff --git a/docs/api/db/types/strings/index.html b/docs/api/db/types/strings/index.html index ccaebb41..12b76422 100644 --- a/docs/api/db/types/strings/index.html +++ b/docs/api/db/types/strings/index.html @@ -242,12 +242,12 @@ and text type. It renders as a multi-line te admin but the template will see each line of text separately. It's primarily useful for some advanced scenarios where enumerations and other things should be rendered.

    -

    Field Usage

    [fields.things_to_buy]
    +

    Field Usage

    [fields.things_to_buy]
     label = Things to buy
     type = strings
     description = A list of things that would be good to buy
     
    -

    Template Usage

    <h2>Shopping List</h2>
    +

    Template Usage

    <h2>Shopping List</h2>
     <ul>
     {% for item in this.things_to_buy %}
       <li>{{ item }}</li>
    diff --git a/docs/api/db/types/text/index.html b/docs/api/db/types/text/index.html
    index 9a4ac2d7..b0a48e5e 100644
    --- a/docs/api/db/types/text/index.html
    +++ b/docs/api/db/types/text/index.html
    @@ -241,11 +241,11 @@
     can store multiple lines.  It does not support any formatting but is very
     useful for storing code and other things.

    It renders as a multi-line input field in the admin interface.

    -

    Field Usage

    [fields.code]
    +

    Field Usage

    [fields.code]
     label = Code
     type = text
     
    -

    Template Usage

    <pre>{{ this.code }}</pre>
    +

    Template Usage

    <pre>{{ this.code }}</pre>
     
    diff --git a/docs/api/db/types/url/index.html b/docs/api/db/types/url/index.html index c8ad4723..cbeb20b9 100644 --- a/docs/api/db/types/url/index.html +++ b/docs/api/db/types/url/index.html @@ -288,11 +288,11 @@ other attributes that are useful:

    -

    Field Usage

    [fields.website]
    +

    Field Usage

    [fields.website]
     label = Website
     type = url
     
    -

    Template Usage

    <a href="{{ this.url }}">{{ this.url.host }}</a>
    +

    Template Usage

    <a href="{{ this.url }}">{{ this.url.host }}</a>
     
    diff --git a/docs/api/environment/add-build-program/index.html b/docs/api/environment/add-build-program/index.html index 47edeb56..9b2f99dd 100644 --- a/docs/api/environment/add-build-program/index.html +++ b/docs/api/environment/add-build-program/index.html @@ -195,7 +195,7 @@ custom source objects. This can be used to implement virtual items. This works in combination with generator and urlresolver and is responsible for generating artifacts out of source objects.

    -

    Example

    from lektor.sourceobj import VirtualSourceObject
    +

    Example

    from lektor.sourceobj import VirtualSourceObject
     from lektor.build_programs import BuildProgram
     from lektor.utils import build_url
     
    @@ -233,7 +233,7 @@ artifacts out of source objects.

    return Source(record)

    And here the example view_source.html template:

    -
    <h2>Source for {{ this.parent.path }}</h2>
    +
    <h2>Source for {{ this.parent.path }}</h2>
     <pre>{{ this.source_content }}</pre>
     
    diff --git a/docs/api/environment/add-publisher/index.html b/docs/api/environment/add-publisher/index.html index 02a29686..6bf58eef 100644 --- a/docs/api/environment/add-publisher/index.html +++ b/docs/api/environment/add-publisher/index.html @@ -195,7 +195,7 @@

    This method can be used to register a new publisher for a given URL scheme with Lektor. This allows plugins to provide custom deployment methods. For more information on implementing these see Publisher.

    -

    Example

    from lektor.publisher import Publisher
    +

    Example

    from lektor.publisher import Publisher
     
     class MyPublisher(Publisher):
         pass
    diff --git a/docs/api/environment/add-type/index.html b/docs/api/environment/add-type/index.html
    index 924cedad..06815f41 100644
    --- a/docs/api/environment/add-type/index.html
    +++ b/docs/api/environment/add-type/index.html
    @@ -193,7 +193,7 @@
           
     
           

    This registers a new Field Type with the environment

    -

    Example

    from lektor.types import Type
    +

    Example

    from lektor.types import Type
     
     class MyThingType(Type):
         widget = 'singleline-text'
    diff --git a/docs/api/environment/generator/index.html b/docs/api/environment/generator/index.html
    index 3f1b9341..904a2145 100644
    --- a/docs/api/environment/generator/index.html
    +++ b/docs/api/environment/generator/index.html
    @@ -197,7 +197,7 @@ the equation.

    The registered function is invoked for each source after it was build. As such it's important to only return items if a virtual sub resource actually exists for a page.

    -

    Example

    from lektor.sourceobj import VirtualSourceObject
    +

    Example

    from lektor.sourceobj import VirtualSourceObject
     from lektor.db import Record
     from lektor.utils import build_url
     
    diff --git a/docs/api/environment/index.html b/docs/api/environment/index.html
    index f75f1bbb..da4d3b6a 100644
    --- a/docs/api/environment/index.html
    +++ b/docs/api/environment/index.html
    @@ -192,7 +192,7 @@ holds state that is immutable after initialization.  For instance it
     will hold all loaded plugins, the configuration for the Jinja 2
     template engine and more.

    Plugins have access to the environment at any point by accessing self.env.

    -

    Example

    from lektor.project import Project
    +

    Example

    from lektor.project import Project
     
     project = Project.discover()
     env = project.make_env()
    diff --git a/docs/api/environment/jinja-env/index.html b/docs/api/environment/jinja-env/index.html
    index 68a8d81f..8d838ec7 100644
    --- a/docs/api/environment/jinja-env/index.html
    +++ b/docs/api/environment/jinja-env/index.html
    @@ -194,7 +194,7 @@
     refer to the Jinja 2 Documentation.

    This is where plugins can inject additional data like custom filters, tests or global functions.

    -

    Plugin Example

    from lektor.pluginsystem import Plugin
    +

    Plugin Example

    from lektor.pluginsystem import Plugin
     
     class MyPlugin(Plugin):
         ...
    @@ -205,7 +205,7 @@ or global functions.

    self.env.jinja_env.filters['shout'] = shout_filter

    Then you can use this filter from templates:

    -
    <h1>{{ page.title|shout }}</h1>
    +
    <h1>{{ page.title|shout }}</h1>
     
    diff --git a/docs/api/environment/load-config/index.html b/docs/api/environment/load-config/index.html index 02e607f7..9ab5c66a 100644 --- a/docs/api/environment/load-config/index.html +++ b/docs/api/environment/load-config/index.html @@ -197,7 +197,7 @@ gives access to the settings in the project file.

    These settings are work in progress and if you want to know how to use the config file and what to do with it, you have to consult the source code.

    -

    Example

    from lektor.project import Project
    +

    Example

    from lektor.project import Project
     
     project = Project.discover()
     env = project.make_env()
    diff --git a/docs/api/environment/load-plugins/index.html b/docs/api/environment/load-plugins/index.html
    index 206276e3..ebb12732 100644
    --- a/docs/api/environment/load-plugins/index.html
    +++ b/docs/api/environment/load-plugins/index.html
    @@ -193,7 +193,7 @@
           

    Normally when an environment is constructed plugins are loaded automatically. If you disabled this when creating the environment you can still at a later point load the plugins by invoking this method.

    -

    Example

    from lektor.project import Project
    +

    Example

    from lektor.project import Project
     
     project = Project.discover()
     env = project.make_env(load_plugins=False)
    diff --git a/docs/api/environment/new-pad/index.html b/docs/api/environment/new-pad/index.html
    index 9a1946a2..103fbd95 100644
    --- a/docs/api/environment/new-pad/index.html
    +++ b/docs/api/environment/new-pad/index.html
    @@ -194,7 +194,7 @@
     first construct a Pad.  This method can do that for
     you.  For more information about how the pad works, you can refer to the
     general documentation of it.

    -

    Example

    from lektor.project import Project
    +

    Example

    from lektor.project import Project
     
     project = Project.discover()
     env = project.make_env()
    diff --git a/docs/api/environment/render-template/index.html b/docs/api/environment/render-template/index.html
    index f622875d..29207b96 100644
    --- a/docs/api/environment/render-template/index.html
    +++ b/docs/api/environment/render-template/index.html
    @@ -206,7 +206,7 @@ be the closest renderable thing.  Typically this is a this and it will default to _primary if no other
     information can be found.
     
    -

    Example

    from lektor.project import Project
    +

    Example

    from lektor.project import Project
     
     project = Project.discover()
     env = project.make_env(load_plugins=False)
    diff --git a/docs/api/environment/urlresolver/index.html b/docs/api/environment/urlresolver/index.html
    index 26d0913e..e4bc13f7 100644
    --- a/docs/api/environment/urlresolver/index.html
    +++ b/docs/api/environment/urlresolver/index.html
    @@ -197,7 +197,7 @@ This works in combination with generator
     URL matching part of the equation.

    The registered function is invoked with a source object and a list of URL path segments.

    -

    Example

    from lektor.sourceobj import VirtualSourceObject
    +

    Example

    from lektor.sourceobj import VirtualSourceObject
     from lektor.utils import build_url
     
     class Source(VirtualSourceObject):
    diff --git a/docs/api/environment/virtualpathresolver/index.html b/docs/api/environment/virtualpathresolver/index.html
    index 92826175..b6c4ec0e 100644
    --- a/docs/api/environment/virtualpathresolver/index.html
    +++ b/docs/api/environment/virtualpathresolver/index.html
    @@ -207,7 +207,7 @@ segments).  If they would request /my-page@feed/recent then it woul
     pass ['recent'] as path segments.

    Example

    Here an example that would implement a virtual source for feeds and an associated virtual path resolver:

    -
    from lektor.sourceobj import VirtualSourceObject
    +
    from lektor.sourceobj import VirtualSourceObject
     from lektor.utils import build_url
     
     class Feed(VirtualSourceObject):
    diff --git a/docs/api/plugins/events/before-build-all/index.html b/docs/api/plugins/events/before-build-all/index.html
    index 8e1dd693..4c2777fb 100644
    --- a/docs/api/plugins/events/before-build-all/index.html
    +++ b/docs/api/plugins/events/before-build-all/index.html
    @@ -213,7 +213,7 @@ most useful for preprocessing sources on the file system before the rest of
     the build process should pick it up.  For instance here a plugin could inject
     additional files into the asset folder and similar things.

    As an example, this is what the Webpack Support uses.

    -

    Example

    import subprocess
    +

    Example

    import subprocess
     
     def on_before_build_all(self, builder, **extra):
         root = ospath.join(self.env.root_path, 'webpack')
    diff --git a/docs/api/plugins/events/before-build/index.html b/docs/api/plugins/events/before-build/index.html
    index 04b4b0d2..379a52d1 100644
    --- a/docs/api/plugins/events/before-build/index.html
    +++ b/docs/api/plugins/events/before-build/index.html
    @@ -224,7 +224,7 @@ the usefulness is limited.

    Note that currently both the builder as well as the build state are undocumented and unsupported! This means that if a plugin choses to use those references to do something with it they should consider that they might break -in future versions.

    Example

    def on_before_build(self, source, prog, **extra):
    +in future versions.

    Example

    def on_before_build(self, source, prog, **extra):
         print('building %s' % source.source_filename)
     
    diff --git a/docs/api/plugins/events/index.html b/docs/api/plugins/events/index.html index db3945ee..c17d148f 100644 --- a/docs/api/plugins/events/index.html +++ b/docs/api/plugins/events/index.html @@ -218,7 +218,7 @@ catch extra parameters in a **extra parameter so that the plugin do not break if an event starts sending additional parameters in the future.

    Emitting Events

    If you want to emit your own events you can do that from the environment's plugin controller:

    -
    self.emit('your-signal', parameter='value')
    +
    self.emit('your-signal', parameter='value')
     

    This emits a signal named your-plugin-your-signal. The signal prefix is taken from the plugin ID which is set in setup.py.

    diff --git a/docs/api/plugins/events/markdown-config/index.html b/docs/api/plugins/events/markdown-config/index.html index 68e5f514..670077a5 100644 --- a/docs/api/plugins/events/markdown-config/index.html +++ b/docs/api/plugins/events/markdown-config/index.html @@ -210,7 +210,7 @@

    Future versions of Lektor may change its Markdown parser away from Mistune, and the various markdown related event hooks may be completely removed or work differently if that happens.

    This event is emitted right after MarkdownConfig is instantiated, in which configuration can be set. This is done before the renderer is made.

    Example

    lektor-markdown-header-anchors uses this to register a renderer mixin:

    -
    def on_markdown_config(self, config, **extra):
    +
    def on_markdown_config(self, config, **extra):
         class HeaderAnchorMixin(object):
             def header(renderer, text, level, raw):
                 if self.get_config().get('anchor-type') == "random":
    diff --git a/docs/api/plugins/events/markdown-meta-init/index.html b/docs/api/plugins/events/markdown-meta-init/index.html
    index 058df2a5..e65e3493 100644
    --- a/docs/api/plugins/events/markdown-meta-init/index.html
    +++ b/docs/api/plugins/events/markdown-meta-init/index.html
    @@ -210,7 +210,7 @@
     
           

    Future versions of Lektor may change its Markdown parser away from Mistune, and the various markdown related event hooks may be completely removed or work differently if that happens.

    This event is emitted before the markdown meta information is set. This can be used to add custom meta variables to the markdown object.

    Example

    lektor-markdown-header-anchors uses this to initialize a meta var as an empty list:

    -
    def on_markdown_meta_init(self, meta, **extra):
    +
    def on_markdown_meta_init(self, meta, **extra):
         meta['toc'] = []
     
    diff --git a/docs/api/plugins/events/markdown-meta-postprocess/index.html b/docs/api/plugins/events/markdown-meta-postprocess/index.html index c9be08db..5b917335 100644 --- a/docs/api/plugins/events/markdown-meta-postprocess/index.html +++ b/docs/api/plugins/events/markdown-meta-postprocess/index.html @@ -210,7 +210,7 @@

    Future versions of Lektor may change its Markdown parser away from Mistune, and the various markdown related event hooks may be completely removed or work differently if that happens.

    This event is emitted after the markdown has been rendered. This can be used to change the markdown object meta information after the fact.

    Example

    lektor-markdown-header-anchors uses this to populate a meta var:

    -
    def on_markdown_meta_postprocess(self, meta, **extra):
    +
    def on_markdown_meta_postprocess(self, meta, **extra):
         prev_level = None
         toc = []
         stack = [toc]
    diff --git a/docs/api/plugins/events/process-template-context/index.html b/docs/api/plugins/events/process-template-context/index.html
    index 242a0e01..9858a8de 100644
    --- a/docs/api/plugins/events/process-template-context/index.html
    +++ b/docs/api/plugins/events/process-template-context/index.html
    @@ -222,7 +222,7 @@ unless they are explicitly passed to it.

    if the template was indeed loaded from the templates folder. There are many more places where templates are rendered in those cases the value will not be provided.

    -

    Example

    def on_process_template_context(self, context, **extra):
    +

    Example

    def on_process_template_context(self, context, **extra):
         context['my_variable'] = 'my value'
     
    diff --git a/docs/api/plugins/events/server-spawn/index.html b/docs/api/plugins/events/server-spawn/index.html index d956209d..5cb3e430 100644 --- a/docs/api/plugins/events/server-spawn/index.html +++ b/docs/api/plugins/events/server-spawn/index.html @@ -213,7 +213,7 @@ to spawn their own development tools. For instance it can be used to start a background process that kicks off webpack or similar tools. There is a second event called server-stop which can be used to detect server shutdowns.

    -

    Example

    import os
    +

    Example

    import os
     from subprocess import Popen
     
     class MyPlugin(Plugin):
    diff --git a/docs/api/plugins/events/setup-env/index.html b/docs/api/plugins/events/setup-env/index.html
    index 4ab4cbbd..c37551cb 100644
    --- a/docs/api/plugins/events/setup-env/index.html
    +++ b/docs/api/plugins/events/setup-env/index.html
    @@ -212,7 +212,7 @@
     with the environment.  This can be used to
     reconfigure it.  For instance this is the perfect place to inject Jinja 2
     filters and global variables.

    -

    Example

    def on_setup_env(self, **extra):
    +

    Example

    def on_setup_env(self, **extra):
         self.env.jinja_env.globals['my_variable'] = 'my value'
     
    diff --git a/docs/api/plugins/get-plugin/index.html b/docs/api/plugins/get-plugin/index.html index 9443659b..0cba022f 100644 --- a/docs/api/plugins/get-plugin/index.html +++ b/docs/api/plugins/get-plugin/index.html @@ -168,7 +168,7 @@ or plugin class. This is particularly useful to retrieve state from a plugin. If the env is not given a context needs to be active and the env of the context is used.

    -

    Example

    from lektor.pluginsystem import get_plugin
    +

    Example

    from lektor.pluginsystem import get_plugin
     
     plugin = get_plugin('the-plugin-id')
     cfg = plugin.get_config()
    diff --git a/docs/api/plugins/plugin/config-filename/index.html b/docs/api/plugins/plugin/config-filename/index.html
    index af2085d8..9a18e7fc 100644
    --- a/docs/api/plugins/plugin/config-filename/index.html
    +++ b/docs/api/plugins/plugin/config-filename/index.html
    @@ -191,7 +191,7 @@ plugin in the loaded project.  This is by default in configs/<plugin-id
     Plugins could override this in theory but it's not recommended.  The primary
     use of this property is to track dependencies.

    For a convenient way to load the config see get_config.

    -

    Example

    from lektor.pluginsystem import Plugin
    +

    Example

    from lektor.pluginsystem import Plugin
     from lektor.context import get_ctx
     
     
    diff --git a/docs/api/plugins/plugin/description/index.html b/docs/api/plugins/plugin/description/index.html
    index 210adcf7..9bdd7d8a 100644
    --- a/docs/api/plugins/plugin/description/index.html
    +++ b/docs/api/plugins/plugin/description/index.html
    @@ -188,7 +188,7 @@
     
           

    This is a short string with some more explanation of what the plugin does. It's shown in the UI to give the user some ideas about its operation.

    -

    Example

    from lektor.pluginsystem import Plugin
    +

    Example

    from lektor.pluginsystem import Plugin
     
     
     class MyPlugin(Plugin):
    diff --git a/docs/api/plugins/plugin/emit/index.html b/docs/api/plugins/plugin/emit/index.html
    index 3bd014f0..ca0da668 100644
    --- a/docs/api/plugins/plugin/emit/index.html
    +++ b/docs/api/plugins/plugin/emit/index.html
    @@ -188,7 +188,7 @@
     
           

    This method can be used to emit an event that other plugins can hook. The event name is prefixed with the plugin ID.

    -

    Example

    from lektor.pluginsystem import Plugin
    +

    Example

    from lektor.pluginsystem import Plugin
     
     
     class MyPlugin(Plugin):
    @@ -197,7 +197,7 @@ event name is prefixed with the plugin ID.

    self.emit('setup', foo=42)

    Another plugin can then hook this:

    -
    from lektor.pluginsystem import Plugin
    +
    from lektor.pluginsystem import Plugin
     
     
     class MyPlugin(Plugin):
    diff --git a/docs/api/plugins/plugin/get-config/index.html b/docs/api/plugins/plugin/get-config/index.html
    index 8966b54a..2049e6e3 100644
    --- a/docs/api/plugins/plugin/get-config/index.html
    +++ b/docs/api/plugins/plugin/get-config/index.html
    @@ -189,7 +189,7 @@
           

    This loads the config of the plugin as an Ini File.

    Dotted paths are used to navigate into sections. So get('foo.bar') would navigate to the bar key in the [foo] section.

    -

    Example

    from lektor.pluginsystem import Plugin
    +

    Example

    from lektor.pluginsystem import Plugin
     
     
     class MyPlugin(Plugin):
    diff --git a/docs/api/plugins/plugin/name/index.html b/docs/api/plugins/plugin/name/index.html
    index 89a1bba1..3329010b 100644
    --- a/docs/api/plugins/plugin/name/index.html
    +++ b/docs/api/plugins/plugin/name/index.html
    @@ -188,7 +188,7 @@
     
           

    This property needs to be set to a human readable name for the plugin. It's what's shown in the UI to show the UI.

    -

    Example

    from lektor.pluginsystem import Plugin
    +

    Example

    from lektor.pluginsystem import Plugin
     
     
     class MyPlugin(Plugin):
    diff --git a/docs/api/project/discover/index.html b/docs/api/project/discover/index.html
    index 2c9c9478..855d1bb5 100644
    --- a/docs/api/project/discover/index.html
    +++ b/docs/api/project/discover/index.html
    @@ -170,7 +170,7 @@
     out with the current path (of a given base path) and search upwards until it
     finds a folder with a single project file in and then loads this.  If none
     of that leads to a file then None is returned.

    -

    Example

    from lektor.project import Project
    +

    Example

    from lektor.project import Project
     
     project = Project.discover()
     
    diff --git a/docs/api/project/from-file/index.html b/docs/api/project/from-file/index.html index bc097ab5..24e83836 100644 --- a/docs/api/project/from-file/index.html +++ b/docs/api/project/from-file/index.html @@ -169,7 +169,7 @@

    This is the most common way to create a project instance. It's a class method that given the path to a project file will load the project. If the file does not exist then None is returned.

    -

    Example

    from lektor.project import Project
    +

    Example

    from lektor.project import Project
     
     project = Project.from_file('/path/to/the/project.lektorproject')
     
    diff --git a/docs/api/project/make-env/index.html b/docs/api/project/make-env/index.html index 5c925440..285923b8 100644 --- a/docs/api/project/make-env/index.html +++ b/docs/api/project/make-env/index.html @@ -171,7 +171,7 @@ preferred way to construct such a thing.

    By default plugins will be loaded and initialized but this can be disabled by passing load_plugins=False.

    -

    Example

    from lektor.project import Project
    +

    Example

    from lektor.project import Project
     
     project = Project.discover()
     env = project.make_env()
    diff --git a/docs/api/publisher/fail/index.html b/docs/api/publisher/fail/index.html
    index 004be11c..2811cb34 100644
    --- a/docs/api/publisher/fail/index.html
    +++ b/docs/api/publisher/fail/index.html
    @@ -173,7 +173,7 @@
     
           

    This method takes a message and raises an appropriate failure that aborts the publishing process. This is invoked from within the publish method to indicate a failure:

    -

    Example

    from lektor.publisher import Publisher
    +

    Example

    from lektor.publisher import Publisher
     
     
     class MyPublisher(Publisher):
    diff --git a/docs/api/publisher/publish/index.html b/docs/api/publisher/publish/index.html
    index 504ba249..cbb49a27 100644
    --- a/docs/api/publisher/publish/index.html
    +++ b/docs/api/publisher/publish/index.html
    @@ -191,7 +191,7 @@ keyword arguments.
     the output in the console or in the deploy/publish window in the admin UI.

    Example

    This example implements a simple publisher that just copies all built files into a new location.

    -
    import os
    +
    import os
     import shutil
     from lektor.publisher import Publisher
     
    @@ -230,7 +230,7 @@ into a new location.

    self.env.add_publisher('copy', CopyPublisher)

    This publisher registers with the copy scheme and could be used like this:

    -
    target_url = copy:///path/to/destination/folder
    +
    target_url = copy:///path/to/destination/folder
     
    diff --git a/docs/api/templates/filters/asseturl/index.html b/docs/api/templates/filters/asseturl/index.html index 6c2754ea..290334ae 100644 --- a/docs/api/templates/filters/asseturl/index.html +++ b/docs/api/templates/filters/asseturl/index.html @@ -194,7 +194,7 @@ the assets/ folder. However unlike |url it will append a dummy query string with a hash of the source asset. This ensures that when the asset changes it will be newly cached.

    -

    Example

    <link rel="stylesheet" href="{{ '/static/styles.css'|asseturl }}">
    +

    Example

    <link rel="stylesheet" href="{{ '/static/styles.css'|asseturl }}">
     
    diff --git a/docs/api/templates/filters/dateformat/index.html b/docs/api/templates/filters/dateformat/index.html index 29176b4f..6b593787 100644 --- a/docs/api/templates/filters/dateformat/index.html +++ b/docs/api/templates/filters/dateformat/index.html @@ -222,10 +222,10 @@ current context which is based on the locale of the current alt.

    In addition to that format codes from the CLDR project can be used. For more information see CLDR Date/Time Symbols.

    -

    Examples

    <p>Date: {{ this.pub_date|dateformat('full') }}
    +

    Examples

    <p>Date: {{ this.pub_date|dateformat('full') }}
     

    Or with custom CLDR format strings:

    -
    <p>Date: {{ this.pub_date|dateformat('EEE, MMM d, ''yy') }}
    +
    <p>Date: {{ this.pub_date|dateformat('EEE, MMM d, ''yy') }}
     
    diff --git a/docs/api/templates/filters/datetimeformat/index.html b/docs/api/templates/filters/datetimeformat/index.html index 557fd531..dbc600bf 100644 --- a/docs/api/templates/filters/datetimeformat/index.html +++ b/docs/api/templates/filters/datetimeformat/index.html @@ -222,10 +222,10 @@ current context which is based on the locale of the current alt.

    In addition to that format codes from the CLDR project can be used. For more information see CLDR Date/Time Symbols.

    -

    Examples

    <p>Date: {{ this.pub_date|datetimeformat('full') }}
    +

    Examples

    <p>Date: {{ this.pub_date|datetimeformat('full') }}
     

    Or with custom CLDR format strings:

    -
    <p>Date: {{ this.pub_date|datetimeformat('yyyyy.MMMM.dd GGG hh:mm a') }}
    +
    <p>Date: {{ this.pub_date|datetimeformat('yyyyy.MMMM.dd GGG hh:mm a') }}
     
    diff --git a/docs/api/templates/filters/latformat/index.html b/docs/api/templates/filters/latformat/index.html index 92295add..6bef8b79 100644 --- a/docs/api/templates/filters/latformat/index.html +++ b/docs/api/templates/filters/latformat/index.html @@ -193,7 +193,7 @@

    This formats a latitude in float format into a human readable string in the format degrees, minutes and seconds. See also longformat and latlongformat.

    -

    Examples

    <p>Lat: {{ image.exif.latitude|latformat }}
    +

    Examples

    <p>Lat: {{ image.exif.latitude|latformat }}
     <p>Long: {{ image.exif.longitude|longformat }}
     
    diff --git a/docs/api/templates/filters/latlongformat/index.html b/docs/api/templates/filters/latlongformat/index.html index 426b447d..ea5428ff 100644 --- a/docs/api/templates/filters/latlongformat/index.html +++ b/docs/api/templates/filters/latlongformat/index.html @@ -192,7 +192,7 @@

    This formats a latitude and longitude tuple into a human readable string in the format degrees, minutes and seconds. See also latformat and longformat.

    -

    Examples

    <p>Location: {{ image.exif.location|latlongformat }}
    +

    Examples

    <p>Location: {{ image.exif.location|latlongformat }}
     
    diff --git a/docs/api/templates/filters/longformat/index.html b/docs/api/templates/filters/longformat/index.html index f315fe47..f1a6f27c 100644 --- a/docs/api/templates/filters/longformat/index.html +++ b/docs/api/templates/filters/longformat/index.html @@ -193,7 +193,7 @@

    This formats a longitude in float format into a human readable string in the format degrees, minutes and seconds. See also latformat and latlongformat.

    -

    Examples

    <p>Lat: {{ image.exif.latitude|latformat }}
    +

    Examples

    <p>Lat: {{ image.exif.latitude|latformat }}
     <p>Long: {{ image.exif.longitude|longformat }}
     
    diff --git a/docs/api/templates/filters/markdown/index.html b/docs/api/templates/filters/markdown/index.html index 416a1e3f..0fe199a2 100644 --- a/docs/api/templates/filters/markdown/index.html +++ b/docs/api/templates/filters/markdown/index.html @@ -194,7 +194,7 @@

    This filter converts a markdown string into HTML. This behaves the same as the Markdown Type.

    -

    Example

    <div class="example">
    +

    Example

    <div class="example">
       {{ "Hello **World**"|markdown }}
     </div>
     
    diff --git a/docs/api/templates/filters/tojson/index.html b/docs/api/templates/filters/tojson/index.html index f9f5eee8..cd93582a 100644 --- a/docs/api/templates/filters/tojson/index.html +++ b/docs/api/templates/filters/tojson/index.html @@ -195,12 +195,12 @@ supported by JSON directly and the return value will be in a format that allows safe embedding in HTML. However if you want to use this value in an attribute of an element it needs to use single quotes otherwise it will generate a syntax error due to the embedded quotes.

    -

    Examples

    <script type="text/javascript">
    +

    Examples

    <script type="text/javascript">
       var options = {{ {'foo': 'bar'}|tojson }};
     </script>
     

    If used in attributes, single quotes are required:

    -
    <a href="#" data-foo='{{ my_data|tojson }}'>Click here</a>
    +
    <a href="#" data-foo='{{ my_data|tojson }}'>Click here</a>
     
    diff --git a/docs/api/templates/filters/url/index.html b/docs/api/templates/filters/url/index.html index d17bab5d..34fc85d5 100644 --- a/docs/api/templates/filters/url/index.html +++ b/docs/api/templates/filters/url/index.html @@ -205,18 +205,18 @@ if you are currently at /info/about/ and you want to link to it will generate a link in the form of ../../projects/. This makes it possible to easily deploy the website to a folder outside of the root of the website.

    -

    Examples

    <ul class="nav">
    +

    Examples

    <ul class="nav">
       <li><a href="{{ '/'|url }}">Index</a></li>
       <li><a href="{{ '/about'|url }}">About</a></li>
     </ul>
     

    Same page to other alternative:

    -
    <a href="{{ '.'|url(alt='ru') }}">Русский</a>
    +
    <a href="{{ '.'|url(alt='ru') }}">Русский</a>
     

    If you already know 100% where to link to, and you do not want any resolving to take place, then you can prefix a path with !. For instance this always links to the root of the website:

    -
    <a href="{{ '!/'|url }}">To Root</a>
    +
    <a href="{{ '!/'|url }}">To Root</a>
     
    diff --git a/docs/api/templates/globals/bag/index.html b/docs/api/templates/globals/bag/index.html index 71123d70..b8c6bb2b 100644 --- a/docs/api/templates/globals/bag/index.html +++ b/docs/api/templates/globals/bag/index.html @@ -182,14 +182,14 @@

    This handy function can look up data from Databags. The path to the values is a dotted path but alternatively multiple parameters can be provided that will be concatenated into a dotted path.

    -

    Simple Example

    <title>{{ bag('site.title') }}</title>
    +

    Simple Example

    <title>{{ bag('site.title') }}</title>
     

    alternative method that does the same:

    -
    <title>{{ bag('site', 'title') }}</title>
    +
    <title>{{ bag('site', 'title') }}</title>
     

    Example with Alternatives

    Because you can use arbitrary variables in it, this is a simple way to load translations from a data bag:

    -
    <a href="#">{{ bag('i18n', alt, 'CLICK_HERE') }}</a>
    +
    <a href="#">{{ bag('i18n', alt, 'CLICK_HERE') }}</a>
     
    diff --git a/docs/api/templates/globals/get-random-id/index.html b/docs/api/templates/globals/get-random-id/index.html index e3fe1f99..9547031e 100644 --- a/docs/api/templates/globals/get-random-id/index.html +++ b/docs/api/templates/globals/get-random-id/index.html @@ -179,7 +179,7 @@

    In some situations it can be very useful to generate a unique ID in templates. This is particularly useful when creating templates for the Flow system and you need unique IDs for the DOM.

    -

    Example

    {% set id = get_random_id() %}
    +

    Example

    {% set id = get_random_id() %}
     <div id="{{ id }}">
       <button data-target="{{ id }}" class="toggle">Hide This</button>
     </div>
    diff --git a/docs/api/utils/build-url/index.html b/docs/api/utils/build-url/index.html
    index 53dc6608..398477c6 100644
    --- a/docs/api/utils/build-url/index.html
    +++ b/docs/api/utils/build-url/index.html
    @@ -181,7 +181,7 @@ of path segments and returns an absolute path.  The default behavior is to
     guess the trailing slash based on the presence of a dot in the last path
     segment.  If you want to override the detection you can explicitly pass
     True to enforce a trailing slash or False to avoid it.

    -

    Example

    >>> from lektor.utils import build_url
    +

    Example

    >>> from lektor.utils import build_url
     >>> build_url(['foo', 42])
     u'/foo/42/'
     >>> build_url(['foo', None, 23])
    diff --git a/docs/api/utils/get-structure-hash/index.html b/docs/api/utils/get-structure-hash/index.html
    index 13219a64..b1393415 100644
    --- a/docs/api/utils/get-structure-hash/index.html
    +++ b/docs/api/utils/get-structure-hash/index.html
    @@ -176,7 +176,7 @@
           

    Given a Python object (typically a dictionary or tuple) it generates a stable MD5 hash from those recursively. This is useful for the config_hash parameter with artifacts.

    -

    Example

    >>> from lektor.utils import get_structure_hash
    +

    Example

    >>> from lektor.utils import get_structure_hash
     >>> get_structure_hash([1, 2, 3])
     'fbcf00cb8f6fc7631af7fbff70ca6f87'
     >>> get_structure_hash([1, 2, 3, 4])
    diff --git a/docs/api/utils/join-path/index.html b/docs/api/utils/join-path/index.html
    index 8f2ec620..43dea1ea 100644
    --- a/docs/api/utils/join-path/index.html
    +++ b/docs/api/utils/join-path/index.html
    @@ -178,7 +178,7 @@
           

    Given two Lektor paths this joins them together with the rules that Lektor set up for this. In particular this is important in the presence of virtual paths which have their own join semantics.

    -

    Example

    >>> from lektor.utils import join_path
    +

    Example

    >>> from lektor.utils import join_path
     >>> join_path('/blog', 'hello-world')
     '/blog/hello-world'
     >>> join_path('/blog', '@archive')
    @@ -192,7 +192,7 @@ virtual paths which have their own join semantics.

    Special note should be taken for the numeric virtual path of paginations. It is considered to be on the same level as the actual record:

    -
    >>> join_path('/blog@2', '..')
    +
    >>> join_path('/blog@2', '..')
     '/'
     >>> join_path('/blog@2', '.')
     '/blog@2'
    diff --git a/docs/api/utils/parse-path/index.html b/docs/api/utils/parse-path/index.html
    index 76b563d3..0715cc0f 100644
    --- a/docs/api/utils/parse-path/index.html
    +++ b/docs/api/utils/parse-path/index.html
    @@ -178,7 +178,7 @@
           

    This function parses a path into the individual components it's made from. The path is always assumed to be absolute and made absolute if it's not yet so. The root path is the empty list.

    -

    Example

    >>> from lektor.utils import parse_path
    +

    Example

    >>> from lektor.utils import parse_path
     >>> parse_path('/foo/bar')
     ['foo', 'bar']
     >>> parse_path('/')
    diff --git a/docs/api/utils/process-image/index.html b/docs/api/utils/process-image/index.html
    index 8c47d904..b297cf1b 100644
    --- a/docs/api/utils/process-image/index.html
    +++ b/docs/api/utils/process-image/index.html
    @@ -181,7 +181,7 @@ width and/or height, and the operation mode.
     In the default mode, if width or height are None, they are calculated
     from the source image's dimensions so that the image is scaled proportionally.

    Used internally for the implementation of thumbnail, and exposed as an API for image-processing plugins.

    -

    Example

    from lektor.build_programs import AttachmentBuildProgram
    +

    Example

    from lektor.build_programs import AttachmentBuildProgram
     from lektor.context import get_ctx
     from lektor.db import Image
     from lektor.imagetools import process_image, ThumbnailMode
    diff --git a/docs/content/alts/index.html b/docs/content/alts/index.html
    index 977d767d..07d5775f 100644
    --- a/docs/content/alts/index.html
    +++ b/docs/content/alts/index.html
    @@ -165,7 +165,7 @@ the system will refuse to build the website.

    -
    [alternatives.en]
    +
    [alternatives.en]
     name = English
     primary = yes
     locale = en_US
    diff --git a/docs/content/databags/index.html b/docs/content/databags/index.html
    index 28cbc715..10f05ada 100644
    --- a/docs/content/databags/index.html
    +++ b/docs/content/databags/index.html
    @@ -157,12 +157,12 @@ menu or similar things.

    folder. The files there are accessible by their name sans the file extension. All ordering in the source files is retained. So for instance this could be the main-nav.ini data file for a basic navigation:

    -
    /downloads = Download
    +
    /downloads = Download
     /docs = Documentation
     /blog = Blog
     

    And the template could access it like this:

    -
    <ul class="nav">
    +
    <ul class="nav">
     {% for path, label in bag('main-nav').items() %}
       <li{% if this.is_child_of(path) %} class="active"{% endif
         %}><a href="{{ path|url }}">{{ label }}</a>
    @@ -178,7 +178,7 @@ within the bag.  For instance you could use this to look up values that might
     change depending on the alternative of a page for instance.

    In this case the system is used to translate buttons. Take buttons.ini as an example:

    -
    [en]
    +
    [en]
     download = Download
     
     [de]
    @@ -188,7 +188,7 @@ as an example:

    download = Скачать

    And in a template it could be used like this:

    -
    <h2>{{ bag('buttons', this.alt, 'download') }}</h2>
    +
    <h2>{{ bag('buttons', this.alt, 'download') }}</h2>
     
    diff --git a/docs/content/flow/index.html b/docs/content/flow/index.html index a56cb9a9..357640bf 100644 --- a/docs/content/flow/index.html +++ b/docs/content/flow/index.html @@ -181,14 +181,14 @@ named text it will render from templates/blocks/text.htmlthis points to the current block and record points to the record the block is contained in.

    This is a simple example of a typical template of a flow block:

    -
    <div class="text-block text-block-{{ this.class }}">
    +
    <div class="text-block text-block-{{ this.class }}">
       {{ this.text }}
     </div>
     

    Some more involved templates might also refer back to the page to do something with it. Here for instance is a simple flow block for including a thumbnail of an attached image:

    -
    {% set img = record.attachments.images.get(this.image) %}
    +
    {% set img = record.attachments.images.get(this.image) %}
     {% if img %}
       <div class="thumbnail-block">
         <img src="{{ img.thumbnail(480)|url }}" alt="">
    @@ -204,7 +204,7 @@ enough.  Because of that you can access the blocks individually.  This is
     particularly useful for more complex situations where you either deal with
     nested flows or where you want to wrap the individual blocks somehow.

    For instance in this case the blocks are wrapped before rendering:

    -
    {% for blk in this.demo_flow.blocks %}
    +
    {% for blk in this.demo_flow.blocks %}
       <div class="block block-{{ blk._flowblock }}">
         {{ blk }}
       </div>
    @@ -215,7 +215,7 @@ of the data model that defines it.  This is a good way to also specifically
     customize individual blocks in a flow without having to invoke their
     templates.  You can for instance completely manually render blocks without
     using their templates:

    -
    {% for blk in this.demo_flow.blocks %}
    +
    {% for blk in this.demo_flow.blocks %}
       {% if blk._flowblock == 'text' %}
         <p>{{ blk.text }}
       {% elif blk._flowblock == 'image' %}
    diff --git a/docs/deployment/ftp/index.html b/docs/deployment/ftp/index.html
    index 6ea0c5b5..7c556204 100644
    --- a/docs/deployment/ftp/index.html
    +++ b/docs/deployment/ftp/index.html
    @@ -163,7 +163,7 @@ and not very portable.

    The system supports FTP (ftp://) and FTP over TLS (ftps://). Passive mode can be enabled/disabled with the optional ?passive parameter. It defaults to true.

    -

    Example

    [servers.production]
    +

    Example

    [servers.production]
     target = ftps://myuser:mypassword@ftp.example.com/var/www/example
     

    Credentials

    FTP is considered a largely insecure protocol for Lektor. As such if you diff --git a/docs/deployment/ghpages/index.html b/docs/deployment/ghpages/index.html index fb5a9e26..840b4511 100644 --- a/docs/deployment/ghpages/index.html +++ b/docs/deployment/ghpages/index.html @@ -163,7 +163,7 @@ can also accept username:password@ in the URL to hold the credentia addition to accepting username and password from the command line or environment variables.

    Example:

    -
    [servers.ghpages]
    +
    [servers.ghpages]
     target = ghpages://your-user/your-repository
     

    Credentials

    This deployment method has two implementations: ghpages (also known as @@ -180,7 +180,7 @@ with behavior for GitHub Pages.

    CNAME Support

    If you want to use a custom domain with GitHub pages (also known as a CNAME), provide the intended CNAME in the target URL using the ?cname parameter:

    -
    [servers.production]
    +
    [servers.production]
     target = ghpages://your-user/your-repository?cname=www.example.com
     

    Note that this will overwrite whatever custom domain you may have set on diff --git a/docs/deployment/glpages/index.html b/docs/deployment/glpages/index.html index d9e8a059..feebe6f9 100644 --- a/docs/deployment/glpages/index.html +++ b/docs/deployment/glpages/index.html @@ -168,7 +168,7 @@ repository for it needs to be named <username>.gitlab.io.

    .gitlab-ci.yml which contains a configuration for gitlab pages.

    Configuration

    To enable support for Lektor you need to create a .gitlab-ci.yml config next to your .lektorproject file with the following contents:

    -
    image: python:latest
    +
    image: python:latest
     
     pages:
       script:
    @@ -192,7 +192,7 @@ To do so, you have to:

  • configure Gitlab to cache this directory.
  • See the example below.

    -
    image: python:latest
    +
    image: python:latest
     
     default:
       cache:
    diff --git a/docs/deployment/index.html b/docs/deployment/index.html
    index f10596da..abe8c4f3 100644
    --- a/docs/deployment/index.html
    +++ b/docs/deployment/index.html
    @@ -179,7 +179,7 @@ keys are name for an optional human readable name of the server, true) and target which is the URL to
     publish to.  Additionally one of the servers can have default set to yes
     to set it as default.  Here is an example:

    -
    [servers.production]
    +
    [servers.production]
     name = Production
     enabled = yes
     default = yes
    diff --git a/docs/deployment/rsync/index.html b/docs/deployment/rsync/index.html
    index 1bb3d66a..1d7db00d 100644
    --- a/docs/deployment/rsync/index.html
    +++ b/docs/deployment/rsync/index.html
    @@ -154,7 +154,7 @@ way.  It uses the system's SSH config so for authentication just configure
     SSH as you would normally do.  The username part is optional and defaults
     to the current user that is signed into the machine or whatever is picked up
     as default from the .ssh/config.

    -

    Example

    [servers.production]
    +

    Example

    [servers.production]
     target = rsync://deploy@example.com/var/www/example.com
     

    Credentials

    The rsync deploy method supports both username and password parameter @@ -175,7 +175,7 @@ assumed.

    it's necessary to explicitly tell rsync to remove files or directories on target that don't exist on source anymore. This can be done using the ?delete URL parameter:

    -
    [servers.production]
    +
    [servers.production]
     target = rsync://server/path/to/folder?delete
     

    If the parameter is provided Lektor will issue a rsync --delete-delay, @@ -186,7 +186,7 @@ on target that does not exist on source. This means that if you have files in the target tree that are not managed by lektor, they will get removed.

    Exclusion Support

    You can exclude items from being synced by using one or more exclude parameters. This is also useful in combination with delete to prevent removal of files in the target tree that are not managed by lektor:

    -
    [servers.production]
    +
    [servers.production]
     target = rsync://server/path/to/folder?delete&exclude=target_item_1&exclude=target_item_2
     
    diff --git a/docs/deployment/travisci/index.html b/docs/deployment/travisci/index.html index ec38bcdb..39796654 100644 --- a/docs/deployment/travisci/index.html +++ b/docs/deployment/travisci/index.html @@ -167,7 +167,7 @@ GitHub account.

    This guide is also available as a 7 minute screencast.

    Travis Config

    Once you have signed up for Travis-CI you need to add a .travis.yml config file into your repository. You can copy paste this over:

    -
    language: python
    +
    language: python
     python: 3.6
     install: "pip install Lektor"
     script: "lektor build"
    @@ -182,7 +182,7 @@ the build step we invoke lektor build, and for the deploy step we i
     to configure that.

    Project Server Config

    For the above example the best way to configure the server for the deployment in the project file would be to use ghpages+https like this:

    -
    [servers.ghpages]
    +
    [servers.ghpages]
     target = ghpages+https://username/repository
     

    You need to add this to your .lektorproject file.

    @@ -227,7 +227,7 @@ the Travis CI documentation.

    Speeding up Builds with Caching

    In the default setting Travis will have to rebuild everything because between builds it does not cache the build results. You can change this by enabling caching. Adjust your .travis.yml file to look like this:

    -
    language: python
    +
    language: python
     python: 3.6
     cache:
       directories:
    @@ -245,7 +245,7 @@ as done with Gitlab pages.

    Restricting Branches

    If you plan on having different branches and contributors you should disable the deployment to the master branch only. You can do this with the following config:

    -
    language: python
    +
    language: python
     python: 3.6
     cache:
       directories:
    diff --git a/docs/guides/blog/index.html b/docs/guides/blog/index.html
    index 87435f3b..2cd1b301 100644
    --- a/docs/guides/blog/index.html
    +++ b/docs/guides/blog/index.html
    @@ -188,7 +188,7 @@ page and what the order is.  We also set it to hidden and pro
     will make it unavailable in the admin (hidden) for new pages and make it
     impossible to delete (protected).  This means we need to manually create the
     one page later which will use this.

    -
    [model]
    +
    [model]
     name = Blog
     label = Blog
     hidden = yes
    @@ -207,7 +207,7 @@ date and title are also used for sorting if you look into the blog.inihidden as the model is automatically selected in the
     admin whenever a page is created in the blog.

    -
    [model]
    +
    [model]
     name = Blog Post
     label = {{ this.title }}
     hidden = yes
    @@ -238,7 +238,7 @@ overview page with the author and date and a controller for the pagination.
     Because pagination is enabled we can iterate over this.pagination.items
     instead of this.children which will return only the items for the intended
     page.

    -
    {% extends "layout.html" %}
    +
    {% extends "layout.html" %}
     {% from "macros/pagination.html" import render_pagination %}
     {% block title %}My Blog{% endblock %}
     {% block body %}
    @@ -262,7 +262,7 @@ page.

    For the pagination macro have a look at the pagination guide which covers that part.

    blog-post.html

    Now we just need a template for our blog post. This (blog-post.html) will do:

    -
    {% extends "layout.html" %}
    +
    {% extends "layout.html" %}
     {% block title %}{{ this.title }} | My Blog{% endblock %}
     {% block body %}
       <h1>{{ this.title }}
    @@ -284,7 +284,7 @@ with the name of your blog.  For instance just content/blog and put
     into the URL?  That's thankfully very easy.  All you need to do is to set up
     a new URL format for the children.  Just edit blog.ini and add this to
     the [children] section:

    -
    slug_format = {{ (this.pub_date|dateformat('YYYY/M/') if this.pub_date) ~ this._id }}
    +
    slug_format = {{ (this.pub_date|dateformat('YYYY/M/') if this.pub_date) ~ this._id }}
     

    What this does is that it will prepend the year (YYYY) and month (M) to the ID of the page if the publication date is configured. Otherwise it will diff --git a/docs/guides/categories/index.html b/docs/guides/categories/index.html index 496ed9c2..17da2a00 100644 --- a/docs/guides/categories/index.html +++ b/docs/guides/categories/index.html @@ -200,7 +200,7 @@ different categories and it should be possible to see which projects belong to which category.

    The Models

    So we will end up with four models: projects.ini, project.ini, project-categories.ini and project-category.ini. Here is how they look:

    -

    projects.ini

    [model]
    +

    projects.ini

    [model]
     name = Projects
     label = Projects
     hidden = yes
    @@ -210,7 +210,7 @@ to which category.

    model = project order_by = -date, name
    -

    project.ini

    [model]
    +

    project.ini

    [model]
     name = Project
     label = {{ this.name }}
     hidden = yes
    @@ -237,7 +237,7 @@ is the source parameter for the categories.  Essentially we instruc
     admin panel to fill the selection for the checkboxes from the child pages
     below the project-categories folder.  This is where we will maintain the
     categories.

    -

    project-categories.ini

    [model]
    +

    project-categories.ini

    [model]
     name = Project Categories
     label = Project Categories
     hidden = yes
    @@ -247,7 +247,7 @@ categories.

    model = project-category order_by = name
    -

    project-category.ini

    [model]
    +

    project-category.ini

    [model]
     name = Project Category
     label = {{ this.name }}
     hidden = yes
    @@ -281,7 +281,7 @@ that is created will become available for new projects in the category
     selection.

    The Templates

    To render out all the pages we probably want to use some macros to reuse markup that appears on multiple pages.

    -

    projects.html

    {% extends "layout.html" %}
    +

    projects.html

    {% extends "layout.html" %}
     {% from "macros/projects.html" import
       render_project_list, render_category_nav %}
     {% block title %}Projects{% endblock %}
    @@ -291,14 +291,14 @@ markup that appears on multiple pages.

    {{ render_project_list(this.children) }} {% endblock %}
    -

    project.html

    {% extends "layout.html" %}
    +

    project.html

    {% extends "layout.html" %}
     {% block title %}{{ this.name }}{% endblock %}
     {% block body %}
       <h1>{{ this.name }}</h1>
       <div class="description">{{ this.description }}</div>
     {% endblock %}
     
    -

    project-categories.html

    {% extends "layout.html" %}
    +

    project-categories.html

    {% extends "layout.html" %}
     {% from "macros/projects.html" import render_category_nav %}
     {% block title %}Project Categories{% endblock %}
     {% block body %}
    @@ -306,7 +306,7 @@ markup that appears on multiple pages.

    {{ render_category_nav(active=none) }} {% endblock %}
    -

    project-category.html

    {% extends "layout.html" %}
    +

    project-category.html

    {% extends "layout.html" %}
     {% from "macros/projects.html" import render_category_nav,
        render_project_list %}
     {% block title %}Project Category {{ this.name }}{% endblock %}
    @@ -316,7 +316,7 @@ markup that appears on multiple pages.

    {{ render_project_list(this.children) }} {% endblock %}
    -

    macros/projects.html

    {% macro render_category_nav(active=none) %}
    +

    macros/projects.html

    {% macro render_category_nav(active=none) %}
       <ul>
       {% for category in site.query('/project-categories') %}
         <li{% if category._id == active %} class="active"{% endif
    diff --git a/docs/guides/disqus/index.html b/docs/guides/disqus/index.html
    index c775c4a7..d32a4ca3 100644
    --- a/docs/guides/disqus/index.html
    +++ b/docs/guides/disqus/index.html
    @@ -178,12 +178,12 @@ for you:

    website. Just create a file named disqus-comments.ini into your configs/ folder and configure the shortname key with the name of your disqus community:

    -
    shortname = YOUR_SHORTNAME
    +
    shortname = YOUR_SHORTNAME
     

    In Templates

    Now you can add a discussion box to any of your templates by just using the render_disqus_comments function. Just calling it is enough to get the comment box:

    -
    <div class="comments">{{ render_disqus_comments() }}</div>
    +
    <div class="comments">{{ render_disqus_comments() }}</div>
     

    Optionally the function accepts two arguments: identifier and url to override the defaults. For more information have a look at diff --git a/docs/guides/error-pages/index.html b/docs/guides/error-pages/index.html index 6c8fb706..31fd6ce5 100644 --- a/docs/guides/error-pages/index.html +++ b/docs/guides/error-pages/index.html @@ -184,7 +184,7 @@ development server. To test those you will need to explicitly navigate to that relative URLs will not work. If you want to use custom error pages you will have to set the url_style to absolute as otherwise URLs on an error page will not work. Just add this to your project file:

    -
    [project]
    +
    [project]
     url_style = absolute
     

    For more information about this you can read the Project File Documentation.

    @@ -203,16 +203,16 @@ work slightly differently.

    Apache

    Making custom error pages work is easiest with Apache. If .htaccess files are enabled you can just put a file with that name into your assets folder and add the following line to it:

    -
    ErrorDocument 404 /404.html
    +
    ErrorDocument 404 /404.html
     

    Alternatively you can add the above line into a VirtualHost or Directory section in your main config file.

    nginx

    For nginx you need to enable the error document in your main config file. Just add it to your server section:

    -
    error_page 404 /404.html;
    +
    error_page 404 /404.html;
     

    lighttpd

    If you are using lighttpd you can configure an error page for 404 this way:

    -
    server.error-handler-404 = "/404.html"
    +
    server.error-handler-404 = "/404.html"
     
    diff --git a/docs/guides/page-order/index.html b/docs/guides/page-order/index.html index fdc5fddf..ca1c8638 100644 --- a/docs/guides/page-order/index.html +++ b/docs/guides/page-order/index.html @@ -169,14 +169,14 @@ children. This way an order can be defined that is used by default for any query involving the children of a page. So what can you order by? You can order by any field you want. For instance to order by the name of a page you can do this:

    -
    [children]
    +
    [children]
     model = project
     order_by = name
     

    This will automatically order the .children query by the name of a project. You can define more than one ordering. For instance you could order blog posts by dates in decreasing order and secondarily by the blog title:

    -
    [children]
    +
    [children]
     model = blog-post
     order_by = -pub_date, title
     
    @@ -184,7 +184,7 @@ posts by dates in decreasing order and secondarily by the blog title:

    Specific Order

    But what to do if you want to order something specifically? In that case you can use the sort_key type and configure that:

    -
    [children]
    +
    [children]
     model = doc-page
     order_by = sort_key
     
    diff --git a/docs/guides/pagination/index.html b/docs/guides/pagination/index.html index d1f0e9ed..b5b99f9c 100644 --- a/docs/guides/pagination/index.html +++ b/docs/guides/pagination/index.html @@ -171,7 +171,7 @@ subset of the child records per page.

    Configuring Pagination

    First you need to enable the pagination in the model. Primarily you need to enable the pagination and set how many items show up on a page. Just add this to the parent model:

    -
    [pagination]
    +
    [pagination]
     enabled = yes
     per_page = 10
     
    @@ -179,7 +179,7 @@ add this to the parent model:

    the children of an active page in your template rather than the children of the entire record. This can be done by changing this.children to this.pagination.items:

    -
    {% for child in this.pagination.items %}
    +
    {% for child in this.pagination.items %}
       ...
     {% endfor %}
     
    @@ -188,7 +188,7 @@ handy pagination objectmacros/pagination.html that looks something like this so that you can render the same pagination everywhere:

    -
    {% macro render_pagination(pagination) %}
    +
    {% macro render_pagination(pagination) %}
       <div class="pagination">
         {% if pagination.has_prev %}
           <a href="{{ pagination.prev|url }}">&laquo; Previous</a>
    @@ -205,7 +205,7 @@ you can render the same pagination everywhere:

    {% endmacro %}

    Using the Macro

    Now that you have that set up, you can use the macro like this:

    -
    {% from "macros/pagination.html" import render_pagination %}
    +
    {% from "macros/pagination.html" import render_pagination %}
     {% if this.pagination.pages > 1 %}
       {{ render_pagination(this.pagination) }}
     {% endif %}
    diff --git a/docs/guides/portfolio/index.html b/docs/guides/portfolio/index.html
    index 7e8dfccb..bbae3d83 100644
    --- a/docs/guides/portfolio/index.html
    +++ b/docs/guides/portfolio/index.html
    @@ -182,7 +182,7 @@ for new pages and make it impossible to delete (protected).  This m
     need to manually create the one page later which will use this.

    Because we only have a single page for the projects overview we give it a static label manually (label = Projects).

    -
    [model]
    +
    [model]
     name = Projects
     label = Projects
     hidden = yes
    @@ -196,7 +196,7 @@ static label manually (label = Projects).

    with some things here that might appear on such a portfolio page. In addition we will do something with the attachments of this page, but more about that later. For now we just order them by their filename (_id):

    -
    [model]
    +
    [model]
     name = Project
     label = {{ this.name }}
     hidden = yes
    @@ -237,7 +237,7 @@ one of the images on the overview page if it's available.

    projects.html

    So here we just render out all projects in the order defined in our models and if there is an image attached, we pick the first one and make a thumbnail.

    -
    {% extends "layout.html" %}
    +
    {% extends "layout.html" %}
     {% block title %}Projects{% endblock %}
     {% block body %}
       <h1>Projects</h1>
    @@ -257,7 +257,7 @@ a thumbnail.

    {% endblock %}

    project.html

    For the detail page we show all information we know about:

    -
    {% extends "layout.html" %}
    +
    {% extends "layout.html" %}
     {% block title %}{{ this.name }} ({{ this.date.year }}){% endblock %}
     {% block body %}
       <h1>{{ this.name }}</h1>
    diff --git a/docs/guides/redirects/index.html b/docs/guides/redirects/index.html
    index aac52d09..e658e3fa 100644
    --- a/docs/guides/redirects/index.html
    +++ b/docs/guides/redirects/index.html
    @@ -169,7 +169,7 @@
     
           

    Setting up a flexible redirect system to make HTML redirects in Lektor is easy. A better setup would likely be on the server level, for instance in nginx, or configured on your CDN. The redirect will be more performant on the server level. Though this is not the best kind of redirect, it is pretty robust and will work in most situations. This example is flexible and can handle multiple redirects for your site.

    Models and Templates

    Set up the models to have a simple field that can hold the value of the target path. This is the path the page will be redirected to.

    -

    models/redirect.ini

    [model]
    +

    models/redirect.ini

    [model]
     name = Redirect
     
     [fields.target]
    @@ -178,7 +178,7 @@
     description = Target is of type 'string' to allow relative paths. Converted to url in the template.
     

    The template contains the minimal amount of html needed to initiate a redirect, along with a query for the target path.

    -

    templates/redirect.html

    <meta http-equiv="refresh" content="0; URL='{{ this.target|url }}'" />
    +

    templates/redirect.html

    <meta http-equiv="refresh" content="0; URL='{{ this.target|url }}'" />
     

    Contents

    The contents.lr files for each redirect can be created in the admin, but you will probably want to edit them by hand to make them non-discoverable. Setting them to be non-discoverable will mean that they don't show up in other template queries, which means you won't end up with other pages making references to the page that is nothing but a redirect.

    content/page-to-redirect/contents.lr

    _model: redirect
    diff --git a/docs/guides/single-page/index.html b/docs/guides/single-page/index.html
    index cb845c09..fee8e931 100644
    --- a/docs/guides/single-page/index.html
    +++ b/docs/guides/single-page/index.html
    @@ -193,7 +193,7 @@ parts of our big page.
     

    We will just sort all the documentation pages by the page ID so it's possible to just order the pages by prefixing the page with a number (0001-installation, 0002-quickstart etc.)

    -

    index.ini

    [model]
    +

    index.ini

    [model]
     name = Documentation
     label = {{ this.title }}
     hidden = yes
    @@ -202,7 +202,7 @@ to just order the pages by prefixing the page with a number
     [fields.title]
     type = string
     
    -

    doc-pages.ini

    [model]
    +

    doc-pages.ini

    [model]
     name = Documentation Pages
     label = Documentation Pages
     hidden = yes
    @@ -212,7 +212,7 @@ to just order the pages by prefixing the page with a number
     model = doc-page
     order_by = _id
     
    -

    doc-page.ini

    [model]
    +

    doc-page.ini

    [model]
     name = Documentation Page
     label = {{ this.title }}
     hidden = yes
    @@ -242,7 +242,7 @@ ways to render them.

    Templates

    For now we only need a single template: index.html, the one that will be used by the only page that actually renders. Within that template we now need to query for all the other pages we have below doc/:

    -
    {% extends "layout.html" %}
    +
    {% extends "layout.html" %}
     {% block title %}{{ this.title }}{% endblock %}
     {% block body %}
       {% set pages = site.query('/doc').include_undiscoverable(true).all() %}
    diff --git a/docs/guides/sitemap/index.html b/docs/guides/sitemap/index.html
    index 10f2b445..988e8012 100644
    --- a/docs/guides/sitemap/index.html
    +++ b/docs/guides/sitemap/index.html
    @@ -180,7 +180,7 @@ into the file to hide it from .children.  This is useful for such s
     pages which should be excluded from navigation or automatic link generation.

    Template File

    The template loaded will be templates/sitemap.xml. In this file we just iterate over all pages of the site recursively. This also automatically skips hidden pages so those will not be generated out.

    -
    <?xml version="1.0" encoding="UTF-8"?>
    +
    <?xml version="1.0" encoding="UTF-8"?>
     <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
       {%- for page in [site.root] if page != this recursive %}
       <url><loc>{{ page|url(external=true) }}</loc></url>
    @@ -199,7 +199,7 @@ template starts working.  For more information see 
    {% extends "layout.html" %}
    +
    {% extends "layout.html" %}
     {% block title %}Sitemap{% endblock %}
     {% block body %}
     <ul class="sitemap">
    diff --git a/docs/guides/webpack/index.html b/docs/guides/webpack/index.html
    index a57a7bd2..6acfa898 100644
    --- a/docs/guides/webpack/index.html
    +++ b/docs/guides/webpack/index.html
    @@ -200,7 +200,7 @@ values) and then generate a package.json file for you.

    It should look similar to the following example. Please do not just copy-paste this! Instead run the tool, so that your package.json meets the latest format specification.

    -
    {
    +
    {
       "name": "lektor-example",
       "version": "0.1.0",
       "description": "",
    @@ -232,7 +232,7 @@ installed for as long as someone else ran it before.

  • all built files will go to assets/static/gen
  • there will be a gen/app.js and a gen/styles.css file to include
  • -
    var webpack = require('webpack');
    +
    var webpack = require('webpack');
     var path = require('path');
     var ExtractTextPlugin = require('extract-text-webpack-plugin');
     
    @@ -293,7 +293,7 @@ the webpack flag there:

    $ lektor build -f webpack
     

    Including The Files

    Now you need to include the files in your template. This will do it:

    -
    <link rel="stylesheet" href="{{
    +
    <link rel="stylesheet" href="{{
       '/static/gen/styles.css'|asseturl }}">
     <script type=text/javascript src="{{
       '/static/gen/app.js'|asseturl }}" charset="utf-8"></script>
    diff --git a/docs/models/children/index.html b/docs/models/children/index.html
    index c4d75d62..60638f0e 100644
    --- a/docs/models/children/index.html
    +++ b/docs/models/children/index.html
    @@ -192,7 +192,7 @@ important about this is that the slug expression must not fail even if fields
     are empty!  This is necessary because new pages will start out with the
     fields not being filled in.

    This for instance includes a date in the URL if set:

    -
    slug_format = {{ (this.date|dateformat('YYYY/M/') if this.date) ~ this._id }}
    +
    slug_format = {{ (this.date|dateformat('YYYY/M/') if this.date) ~ this._id }}
     

    Pagination

    In general a source document renders into a single page. The exception to that rule are pages with children which show the children on the rendered diff --git a/docs/models/flow/index.html b/docs/models/flow/index.html index 4a974d52..eb6ae6d3 100644 --- a/docs/models/flow/index.html +++ b/docs/models/flow/index.html @@ -147,7 +147,7 @@ Documentation to Flow first.

    are stored in the flowblocks/ folder and are ini files just like models.

    Instead of using [model] as section, the section is called [block].

    Here a very basic flow block model flowblocks/text.ini:

    -
    [block]
    +
    [block]
     name = Text Block
     button_label = Text
     
    @@ -174,7 +174,7 @@ that keeps the flow block definition (templates/blocks/NAME.html):
     In our case the expected template is templates/blocks/text.html,
     as our flow block is defined in a file called text.ini.

    Here is a suitable template for this:

    -
    <div class="text-block text-block-{{ this.class }}">
    +
    <div class="text-block text-block-{{ this.class }}">
       {{ this.text }}
     </div>
     
    diff --git a/docs/models/index.html b/docs/models/index.html index 595eb204..86696211 100644 --- a/docs/models/index.html +++ b/docs/models/index.html @@ -150,7 +150,7 @@ model has been explicitly selected, a default model will be selected. For most situations this will be the model with the name page. Detailed information can be found under Default Model Selection.

    Here is an example of a very basic model (models/page.ini):

    -
    [model]
    +
    [model]
     name = Page
     label = {{ this.title }}
     
    diff --git a/docs/plugins/dev/index.html b/docs/plugins/dev/index.html
    index 56041c6d..07d4d444 100644
    --- a/docs/plugins/dev/index.html
    +++ b/docs/plugins/dev/index.html
    @@ -169,7 +169,7 @@ package in the packages folder.

    Once that is done, we need to create a setup.py file which tells Lektor what your plugin needs to run. This will already be created for you if you used the wizard.

    -
    from setuptools import setup
    +
    from setuptools import setup
     
     setup(
         name='lektor-hello-world',
    @@ -213,7 +213,7 @@ example.
     

    Creating The Plugin

    Now it's time to create our first plugin that does absolutely nothing. We create a new file with the name lektor_hello_world.py next to our setup.py and put the following things in:

    -
    from lektor.pluginsystem import Plugin
    +
    from lektor.pluginsystem import Plugin
     
     class HelloWorldPlugin(Plugin):
         name = 'Hello World'
    @@ -232,7 +232,7 @@ hello-world: Hello World
     events that can be hooked but we will only cover a very basic one here,
     the setup-env event.  To respond to it, we need to implement
     a function named on_setup_env:

    -
    import random
    +
    import random
     
     MESSAGES = [
         'Reticulating splines',
    @@ -255,7 +255,7 @@ a function named on_setup_env:

    This will inject a function with the name get_random_message into our template globals when the environment is initialized. This means that we can access this function from templates then:

    -
    <p>Message of the page: {{ get_random_message() }}
    +
    <p>Message of the page: {{ get_random_message() }}
     

    There are many events that can be hooked and they can be found in the Event Documentation. All events need diff --git a/docs/plugins/howto/index.html b/docs/plugins/howto/index.html index 0afd3f67..77b0c62d 100644 --- a/docs/plugins/howto/index.html +++ b/docs/plugins/howto/index.html @@ -159,7 +159,7 @@ plugins and Lektor itself modify so do not provide a function called get_script but for instance call it get_my_plugin_script.

    A simple example of a plugin that implements Gravatar support:

    -
    from hashlib import md5
    +
    from hashlib import md5
     from werkzeug.urls import url_encode
     from lektor.pluginsystem import Plugin
     
    @@ -179,11 +179,11 @@ take advantage of this.  Each plugin has exactly one INI file called
     <plugin-id>.ini inside the configs folder.

    To get access to the plugin the get_config function can be used which returns a dict like object to access the ini file.

    -
    config = self.get_config()
    +
    config = self.get_config()
     value = config.get('section.key', 'default_value')
     

    This would correspond to this config in configs/my-plugin.ini:

    -

    Let's say you want to add an "asciidoc" field type so you can write with AsciiDoc markup.

    First install AsciiDoc so its command-line program is available. Then update blog-post.ini from the blog guide like so:

    -
    [fields.body]
    +
    [fields.body]
     label = Body
     type = asciidoc  # Custom type.
     
    @@ -244,7 +244,7 @@ code here ----

    You can add your "asciidoc" type to Lektor with a plugin:

    -
    from subprocess import PIPE, Popen
    +
    from subprocess import PIPE, Popen
     
     from lektor.pluginsystem import Plugin
     from lektor.types import Type
    diff --git a/docs/plugins/index.html b/docs/plugins/index.html
    index 58b06853..aefd12a2 100644
    --- a/docs/plugins/index.html
    +++ b/docs/plugins/index.html
    @@ -142,7 +142,7 @@ to use plugins and how to build your own.

    For completely automated plugin management just open your project file in a text editor and edit or extend the [packages] section. Just add a line for each plugin in the form name = version:

    -
    [packages]
    +
    [packages]
     lektor-cool-plugin = 1.0
     lektor-other-plugin = 1.2
     
    diff --git a/docs/plugins/publishing/index.html b/docs/plugins/publishing/index.html index fbec6b8d..21047bdb 100644 --- a/docs/plugins/publishing/index.html +++ b/docs/plugins/publishing/index.html @@ -152,7 +152,7 @@ some information added about it to your setup.py. At least the key name, version, author, author_email, url and description need to be set. Here is an example of doing this, largely taken from what is given by the CLI command lektor dev new-plugin:

    -
    import ast
    +
    import ast
     import io
     import re
     
    diff --git a/docs/project/file/index.html b/docs/project/file/index.html
    index 751a5a2b..bda5accb 100644
    --- a/docs/project/file/index.html
    +++ b/docs/project/file/index.html
    @@ -146,7 +146,7 @@
     identify the project for the user interface.  The project file is an INI file
     (UTF-8 encoded like everything else in Lektor) and the minimal content is the
     name of the project:

    -
    [project]
    +
    [project]
     name = My Fancy Project
     

    The name of the file can be arbitrary but must have the .lektorproject @@ -247,7 +247,7 @@ or match your custom excluded_assets pattern. The wildcard syntax f fnmatch.

    Example:

    -
    [project]
    +
    [project]
     name = My Website
     url = https://www.mywebsite.invalid/
     locale = de_DE
    @@ -258,7 +258,7 @@ or match your custom excluded_assets pattern. The wildcard syntax f
     this project.  It's a simple key/value list where the key is the plugin
     name and the value is the version number.

    Example:

    -
    [packages]
    +
    [packages]
     lektor-webpack-support = 0.1
     

    [servers.*]

    This section can be repeated and each instance sets up a server. The * @@ -281,7 +281,7 @@ to the deployment guides.

    is configured it's an implicit default.

    Example:

    -
    [servers.production]
    +
    [servers.production]
     name = Production
     enabled = yes
     default = yes
    @@ -309,7 +309,7 @@ more information about this refer to the guide.

    This setting can override the global site locale for a specific alternative.

    Example:

    -
    [alternatives.en]
    +
    [alternatives.en]
     name = English
     primary = yes
     locale = en_US
    @@ -321,7 +321,7 @@ more information about this refer to the guide.

    [attachment_types]

    Lektor does some basic attachment type detection based on file extension. This is what powers the this.attachemnts.images and this.attachments.videos attributes for instance. If the built-in map does not cover your file extension you can extend it or add new attachement types on a project by project basis.

    Example:

    -
    [attachment_types]
    +
    [attachment_types]
     ; <.file-ext> = <type>
     .gpx = gpx
     .ogv = video
    diff --git a/docs/templates/imageops/index.html b/docs/templates/imageops/index.html
    index 3cbaebb4..c6268371 100644
    --- a/docs/templates/imageops/index.html
    +++ b/docs/templates/imageops/index.html
    @@ -152,19 +152,19 @@ from the template code through the image APIs that Lektor provides.

    are returned from the attachments of a page. If you want to make sure you only operate with actual images the .images attribute can be used to filter the query. For instance this iterates over all attached images of a page:

    -
    {% for image in this.attachments.images %}
    +
    {% for image in this.attachments.images %}
       <div class="image"><img src="{{ image|url }}"></div>
     {% endfor %}
     


    To access images from a different content folder, you would use:

    -
    {% for image in site.get('/myfolder').attachments.images %}
    +
    {% for image in site.get('/myfolder').attachments.images %}
       <div class="image"><img src="{{ image|url }}"></div>
     {% endfor %}
     


    To retrieve only a specific image or attachment with a certain name you would use

    -
    {% set my_image = site.get('/myfolder').attachments.get('imagenameexample.jpg') %}
    +
    {% set my_image = site.get('/myfolder').attachments.get('imagenameexample.jpg') %}
       <div class="image"><img src="{{ my_image|url }}"></div>
     

    Accessing Image Data

    One of the more common operations is to access the direct image data. This @@ -172,7 +172,7 @@ is resolution and file format. The width, height and are provided for this. In some cases this is very useful to generate CSS code that needs to know about the original resolution. For instance this achieves a retina rendered background:

    -
    <div style="
    +
    <div style="
       background: url({{ image|url }});
       background-size: {{ image.width / 2 }}px {{ image.height / 2 }}px
     "></div>
    @@ -181,7 +181,7 @@ retina rendered background:

    in the images. Not all EXIF information is available but the most common values are. For the full list of attributes see EXIF data.

    Here an example that shows the camera information:

    -
    <div class="image">
    +
    <div class="image">
       <img src="{{ image|url }}" alt="">
       <p><strong>Camera:</strong> {{ image.exif.camera }}
     </div>
    @@ -193,7 +193,7 @@ image provides the thumbnai
     

    It accepts the width and height of the target image. If either of these is not provided, it will be computed automatically. The return value can be converted into a URL with the |url filter:

    -
    <img src="{{ image.thumbnail(320)|url }}">
    +
    <img src="{{ image.thumbnail(320)|url }}">
     
    diff --git a/docs/templates/index.html b/docs/templates/index.html index c7e10955..849c57e6 100644 --- a/docs/templates/index.html +++ b/docs/templates/index.html @@ -190,7 +190,7 @@ evaluated in but the following are always available:

    to work with called page, otherwise just add one with the format shown in the
    Data Modelling Documentation.

    With that we can create a page template named templates/page.html:

    -
    {% extends "layout.html" %}
    +
    {% extends "layout.html" %}
     {% block title %}{{ this.title }}{% endblock %}
     {% block body %}
       <h2>{{ this.title }}</h2>
    @@ -214,7 +214,7 @@ us.
     supports template inheritance where one template can inherit code from
     another.  In this case we configured our page template to inherit from
     layout.html.  Let's create it:

    -
    <!doctype html>
    +
    <!doctype html>
     <meta charset="utf-8">
     <title>{% block title %}Welcome{% endblock %} — My Website</title>
     <body>
    diff --git a/docs/templates/navigation/index.html b/docs/templates/navigation/index.html
    index d088f23d..e99e67ca 100644
    --- a/docs/templates/navigation/index.html
    +++ b/docs/templates/navigation/index.html
    @@ -150,7 +150,7 @@ links with the help of the URL Filter.

    Basic Semi-Automatic Navigation

    The most basic form of navigation is a semi automatic one. It's one of the most flexible ones while still being easy to maintain. It requires knowledge of which pages to show and what the link title should be:

    -
    <nav>
    +
    <nav>
       <ul class="nav navbar-nav">
         <li{% if this._path == '/' %} class="active"{% endif
           %}><a href="{{ '/'|url }}">Welcome</a></li>
    @@ -174,7 +174,7 @@ be active if any of its children are active.  So we just check if the
     path of the current page is actually the path of the index page.

    Fully Automatic Navigation

    Sometimes all we want is to show navigation links for all sub-pages of a page. This is easy to accomplish as well:

    -
    <nav>
    +
    <nav>
       <ul class="nav">
         {% for project in site.get('/projects').children %}
           <li{% if this == project %} class="active"{% endif
    @@ -186,7 +186,7 @@ a page.  This is easy to accomplish as well:

    Recursive Tree Navigation

    In some situations you want to show a tree like navigation. This is for instance something that comes up when building site maps. In that situation the recursive Jinja loop system really comes in handy.

    -
    <ul class="tree-nav">
    +
    <ul class="tree-nav">
       {% set root = site.get('/') %}
       {% for child in root.children recursive %}
         <li{% if this._path == child._path %} class="active"{% endif
    diff --git a/docs/templates/urls/index.html b/docs/templates/urls/index.html
    index 7b326c71..333744c0 100644
    --- a/docs/templates/urls/index.html
    +++ b/docs/templates/urls/index.html
    @@ -160,23 +160,23 @@ argument which is the alt if it should differ from the current one
     a string or a Record object.

    Basic Navigation

    This is an example of how to just link to some specific pages that exist. Because the path starts with a slash it will be treated as absolute path:

    -
    <ul class="nav">
    +
    <ul class="nav">
       <li><a href="{{ '/'|url }}">Index</a></li>
       <li><a href="{{ '/about'|url }}">About</a></li>
     </ul>
     

    Relative Linking

    If you want to link relative to the current page, just leave out the slash:

    -
    <a href="{{ 'project-a'|url }}">Go To Project A</a>
    +
    <a href="{{ 'project-a'|url }}">Go To Project A</a>
     

    If you want to link to a page in a different alternative you can use the optional alt parameter. For instance you can link to the current page in another alternative (. indicates the current page):

    -
    <a href="{{ '.'|url(alt='ru') }}">Русский</a>
    +
    <a href="{{ '.'|url(alt='ru') }}">Русский</a>
     

    Because the URL filter can also accept entire record objects you can easily link to all children of a page:

    -
    <ul class="nav">
    +
    <ul class="nav">
     {% for page in this.children %}
       <li><a href="{{ page|url }}">{{ page.title }}</a></li>
     {% endfor %}
    @@ -187,10 +187,10 @@ link to all children of a page:

    |url it will append a dummy query string with a hash of the source asset. This ensures that when the asset changes it will be newly cached.

    Example:

    -
    <link rel="stylesheet" href="{{ '/static/styles.css'|asseturl }}">
    +
    <link rel="stylesheet" href="{{ '/static/styles.css'|asseturl }}">
     

    The end result will look something like this:

    -
    <link rel="stylesheet" href="static/styles.css?h=deadbeef">
    +
    <link rel="stylesheet" href="static/styles.css?h=deadbeef">
     
    diff --git a/docs/templates/videoops/index.html b/docs/templates/videoops/index.html index dccb6377..136b9aa0 100644 --- a/docs/templates/videoops/index.html +++ b/docs/templates/videoops/index.html @@ -145,7 +145,7 @@

    Just like images, videos are separate files that are embedded into HTML files. Since they are media files, it's often desirable to read metadata or manipulate them in some way.

    -

    Video metadata access is powered by FFmpeg. In order to use it FFmpeg must be installed on your system and detected by Lektor. If Lektor is unable to find FFmpeg you will see the error message Unable to locate ffmpeg or ffprobe executable. Is it installed? in your console output if you try to use functionality that requires it.

    Accessing videos

    {% for video in this.attachments.videos %}
    +

    Video metadata access is powered by FFmpeg. In order to use it FFmpeg must be installed on your system and detected by Lektor. If Lektor is unable to find FFmpeg you will see the error message Unable to locate ffmpeg or ffprobe executable. Is it installed? in your console output if you try to use functionality that requires it.

    Accessing videos

    {% for video in this.attachments.videos %}
       <div class="video"><video src="{{ video|url }}"></div>
     {% endfor %}
     
    @@ -173,7 +173,7 @@

    Example:

    -
    {% set video = this.attachments.videos.first() %}
    +
    {% set video = this.attachments.videos.first() %}
     <video src="{{ video|url }}">
     <dl>
       <dt>Width:</dt>
    @@ -208,12 +208,12 @@
     
     

    Calling this method will return a VideoFrame instance, which is not usable by itself. It does however just like an image have a thumbnail method.

    Example:

    -
    {% set video = this.attachments.videos.first() %}
    +
    {% set video = this.attachments.videos.first() %}
     <img src="{{ video.frame().thumbnail(300, 200, mode="crop")|url }}">
     <img src="{{ video.frame(0.1).thumbnail(300, 200, mode="crop")|url }}">
     

    Note that unlike images it is not possible to get an URL to a video frame directly:

    -
    {% set video = this.attachments.videos.first() %}
    +
    {% set video = this.attachments.videos.first() %}
     <img src="{{ video.frame()|url }}"> <!-- This is not valid -->
     
    diff --git a/docs/themes/creating/index.html b/docs/themes/creating/index.html index 9421703d..18a9db8f 100644 --- a/docs/themes/creating/index.html +++ b/docs/themes/creating/index.html @@ -145,7 +145,7 @@

    Not implemented yet.

    You could create a basic empty theme with the following command:

    -
    $ lektor dev new-theme
    +
    $ lektor dev new-theme
     

    Theme Components:

    A theme could provide templates, assets, and models (also flowblocks):

    demo-theme
    @@ -156,16 +156,16 @@
     

    The theme_settings Variable

    A theme_settings section in .lektorproject file could be used to parametrize themes:

    -
    [theme_settings]
    +
    [theme_settings]
     name = "Lektor"
     github_url = "https://github.com/lektor"
     

    And those settings will be accessed in templates through the config env variable:

    -
    {{ config.theme_settings.<variable_name> }}
    +
    {{ config.theme_settings.<variable_name> }}
     

    Example:

    -
    <a href="{{ config.theme_settings.github_url }}">Github</a>
    +
    <a href="{{ config.theme_settings.github_url }}">Github</a>
     

    will output:

    <a href="https://github.com/lektor/lektor">Github</a>
    @@ -173,7 +173,7 @@ variable:

    The theme.ini File

    Themes could provide a theme.ini file, that is optional, but it's required if you want to add your theme to the lektor community themes.

    Example:

    -
    [theme]
    +
    [theme]
     name = Demo theme
     license = MIT
     licenselink = https://github.com/lektor/lektor-demo-theme/blob/master/LICENSE.md
    diff --git a/docs/themes/installing/index.html b/docs/themes/installing/index.html
    index 5b443a0a..4db8de9c 100644
    --- a/docs/themes/installing/index.html
    +++ b/docs/themes/installing/index.html
    @@ -149,11 +149,11 @@
     

    Themes are normally distributed by public Git repositories, so you could install a theme by cloning the repo:

    -
    cd themes
    +
    cd themes
     git clone URL_TO_THEME_REPO
     

    For example, for installing lektor-theme-nix:

    -
    cd themes
    +
    cd themes
     git clone https://github.com/rlaverde/lektor-theme-nix.git
     

    If you download several themes, setting themes variable will allow you to only load @@ -163,7 +163,7 @@ search in the community themes and automatically install it.

    -
    [project]
    +
    [project]
     themes = lektor-theme-nix
     

    Installing Multiple Themes

    Lektor also supports installing several themes. Copy them to the themes/ @@ -177,7 +177,7 @@ folder, and set the themes variable to indicate the precedence (opt ├── lektor-theme-other-theme/ └── lektor-theme-nix/

    -
    [project]
    +
    [project]
     themes = lektor-theme-nix, lektor-theme-other-theme
     

    This will make lektor-theme-nix, because it's listed first, have a higher precedence. diff --git a/docs/themes/packages/index.html b/docs/themes/packages/index.html index 0e75916b..6cb8b022 100644 --- a/docs/themes/packages/index.html +++ b/docs/themes/packages/index.html @@ -134,7 +134,7 @@ the theme.

    1. You could use the [packages] section of the theme.ini to install released packages:

      -
      [packages]
      +
      [packages]
       lektor-disqus-comments = 0.2
       
    2. diff --git a/index.html b/index.html index 72a6261d..0a580d46 100644 --- a/index.html +++ b/index.html @@ -151,7 +151,7 @@ speak multiple languages and allow you to easily create localized websites.
      -