diff --git a/docs/api/build/artifact/index.html b/docs/api/build/artifact/index.html index abb8dff6..070e3407 100644 --- a/docs/api/build/artifact/index.html +++ b/docs/api/build/artifact/index.html @@ -198,7 +198,7 @@ open the artifact for reading or writing. If the build goes well, Lektor will commit those changes and persist them.

Example

ctx = get_ctx()
 @ctx.sub_artifact('artifact.txt')
-def build_stylesheet(artifact):
+def build_stylesheet(artifact):
     with artifact.open('w') as f:
         f.write('Hello World!\n')
 
diff --git a/docs/api/build/artifact/open/index.html b/docs/api/build/artifact/open/index.html index f346e31d..dc59d766 100644 --- a/docs/api/build/artifact/open/index.html +++ b/docs/api/build/artifact/open/index.html @@ -199,7 +199,7 @@ committed when the entire build process goes through smoothly and the changes are committed by the builder.

Example

ctx = get_ctx()
 @ctx.sub_artifact('artifact.txt')
-def build_stylesheet(artifact):
+def build_stylesheet(artifact):
     with artifact.open('w') as f:
         f.write('Hello World!\n')
 
diff --git a/docs/api/build/artifact/render-template-into/index.html b/docs/api/build/artifact/render-template-into/index.html index 0907aa90..c69b4e0a 100644 --- a/docs/api/build/artifact/render-template-into/index.html +++ b/docs/api/build/artifact/render-template-into/index.html @@ -195,10 +195,10 @@ 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):
+    def build_artifact(self, artifact):
         artifact.render_template_into(
             self.source['_template'], this=self.source)
 
diff --git a/docs/api/build/artifact/replace-with-file/index.html b/docs/api/build/artifact/replace-with-file/index.html index abd68bc2..85a33f8e 100644 --- a/docs/api/build/artifact/replace-with-file/index.html +++ b/docs/api/build/artifact/replace-with-file/index.html @@ -196,7 +196,7 @@ 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()
 @ctx.sub_artifact('artifact.txt')
-def build_stylesheet(artifact):
+def build_stylesheet(artifact):
     temporary_file = invoke_external_program()
     artifact.replace_with_file(temporary_file)
 
diff --git a/docs/api/build/context/index.html b/docs/api/build/context/index.html index 7f783107..315c48d9 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/pad/index.html b/docs/api/build/context/pad/index.html
index 2f9b275c..2eb6d18e 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 4f6a2395..dcaa6319 100644
--- a/docs/api/build/context/record-dependency/index.html
+++ b/docs/api/build/context/record-dependency/index.html
@@ -209,13 +209,13 @@ to record this as a dependency.

is possible to depend on 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
-from lektor.pluginsystem import Plugin
+

Example

import os
+from lektor.pluginsystem import Plugin
 
-class IncludeFilePlugin(Plugin):
+class IncludeFilePlugin(Plugin):
 
-    def setup_env(self, **extra):
-        def include_file(filename):
+    def setup_env(self, **extra):
+        def include_file(filename):
             fn = os.path.join(self.env.root_path, 'inc', filename)
             get_ctx().record_dependency(fn)
             with open(fn) as f:
diff --git a/docs/api/build/context/record/index.html b/docs/api/build/context/record/index.html
index c5bfbe18..41982728 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 10afa746..aa75ad7e 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 5f69378c..1f95c4f3 100644
--- a/docs/api/build/context/sub-artifact/index.html
+++ b/docs/api/build/context/sub-artifact/index.html
@@ -214,16 +214,16 @@ 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
-from lektor.pluginsystem import Plugin
+

Example

import os
+from lektor.pluginsystem import Plugin
 
-class IncludeFilePlugin(Plugin):
+class IncludeFilePlugin(Plugin):
 
-    def setup_env(self, **extra):
-        def get_css(artifact_name='/demo.css'):
+    def setup_env(self, **extra):
+        def get_css(artifact_name='/demo.css'):
             ctx = get_ctx()
             @ctx.sub_artifact(artifact_name)
-            def build_stylesheet(artifact):
+            def build_stylesheet(artifact):
                 with artifact.open('w') as f:
                     f.write('body { background: red; }\n')
             return artifact_name
diff --git a/docs/api/build/get-ctx/index.html b/docs/api/build/get-ctx/index.html
index bbb23010..54d49975 100644
--- a/docs/api/build/get-ctx/index.html
+++ b/docs/api/build/get-ctx/index.html
@@ -175,7 +175,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 06171194..89cc8e53 100644 --- a/docs/api/build/program/iter-child-sources/index.html +++ b/docs/api/build/program/iter-child-sources/index.html @@ -190,7 +190,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/lookup/index.html b/docs/api/databags/lookup/index.html index d98badaa..fd67d6b9 100644 --- a/docs/api/databags/lookup/index.html +++ b/docs/api/databags/lookup/index.html @@ -168,7 +168,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 e2132613..340618e6 100644 --- a/docs/api/db/expression/and/index.html +++ b/docs/api/db/expression/and/index.html @@ -246,7 +246,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/or/index.html b/docs/api/db/expression/or/index.html index 4f63910a..f8824ff7 100644 --- a/docs/api/db/expression/or/index.html +++ b/docs/api/db/expression/or/index.html @@ -246,7 +246,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/obj/index.html b/docs/api/db/obj/index.html index 0adea3ca..700c8f84 100644 --- a/docs/api/db/obj/index.html +++ b/docs/api/db/obj/index.html @@ -248,22 +248,22 @@ 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.utils import build_url
+
from lektor.sourceobj import VirtualSourceObject
+from lektor.utils import build_url
 
-class Source(VirtualSourceObject):
+class Source(VirtualSourceObject):
 
     @property
-    def path(self):
+    def path(self):
         return self.record.path + '@source'
 
     @property
-    def source_content(self):
+    def source_content(self):
         with open(self.record.source_filename) as f:
             return f.read().decode('utf-8')
 
     @property
-    def url_path(self):
+    def url_path(self):
         return build_url([self.record.url_path, 'source.txt'])
 

For more information see add-build-program as well as diff --git a/docs/api/db/pad/index.html b/docs/api/db/pad/index.html index 1eb0cb85..1c242f26 100644 --- a/docs/api/db/pad/index.html +++ b/docs/api/db/pad/index.html @@ -232,7 +232,7 @@ how to do this through the get method:

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/type/index.html b/docs/api/db/type/index.html
index ee69c7f3..4fbbaae2 100644
--- a/docs/api/db/type/index.html
+++ b/docs/api/db/type/index.html
@@ -202,15 +202,15 @@ 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.primitives import SingleInputType
+
from lektor.types.primitives import SingleInputType
 
-class MyThingType(SingleInputType):
+class MyThingType(SingleInputType):
     widget = 'singleline-text'
 
-    def value_from_raw(self, raw):
+    def value_from_raw(self, raw):
         return raw.value
 
-def setup_env(self, **extra):
+def setup_env(self, **extra):
     self.env.add_type(MyThingType)
 

In the above example, the new type declares a base class of SingleInputType. diff --git a/docs/api/db/type/value-from-raw/index.html b/docs/api/db/type/value-from-raw/index.html index 7adc14ba..940eea24 100644 --- a/docs/api/db/type/value-from-raw/index.html +++ b/docs/api/db/type/value-from-raw/index.html @@ -212,12 +212,12 @@ 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):
+class LocationType(Type):
     widget = 'singleline-text'
 
-    def value_from_raw(self, raw):
+    def value_from_raw(self, raw):
         if raw.value is None:
             return raw.missing_value('Location was not supplied')
         try:
@@ -227,7 +227,7 @@ example provided.

return raw.bad_value('Location was malformed') return (lng, lat) -def setup_env(self, **extra): +def setup_env(self, **extra): self.env.add_type(LocationType)

Raw Value

The value passed is a raw value type. It has a few properties and methods:

diff --git a/docs/api/db/type/widget/index.html b/docs/api/db/type/widget/index.html index b61743ed..15d28b12 100644 --- a/docs/api/db/type/widget/index.html +++ b/docs/api/db/type/widget/index.html @@ -210,12 +210,12 @@ 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):
+class MyThingType(Type):
     widget = 'singleline-text'
 
-    def value_from_raw(self, raw):
+    def value_from_raw(self, raw):
         return raw.value
 

Available Widgets

These widgets are currently available:

diff --git a/docs/api/environment/add-build-program/index.html b/docs/api/environment/add-build-program/index.html index 534bdeba..b8306924 100644 --- a/docs/api/environment/add-build-program/index.html +++ b/docs/api/environment/add-build-program/index.html @@ -196,40 +196,40 @@ 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
-from lektor.build_programs import BuildProgram
-from lektor.utils import build_url
+

Example

from lektor.sourceobj import VirtualSourceObject
+from lektor.build_programs import BuildProgram
+from lektor.utils import build_url
 
-class Source(VirtualSourceObject):
+class Source(VirtualSourceObject):
 
     @property
-    def path(self):
+    def path(self):
         return self.record.path + '@source'
 
     @property
-    def source_content(self):
+    def source_content(self):
         with open(self.record.source_filename) as f:
             return f.read().decode('utf-8')
 
     @property
-    def url_path(self):
+    def url_path(self):
         return build_url([self.record.url_path, 'source.txt'])
 
-class SourceBuildProgram(BuildProgram):
+class SourceBuildProgram(BuildProgram):
 
-    def produce_artifacts(self):
+    def produce_artifacts(self):
         self.declare_artifact(
             self.source.url_path,
             sources=list(self.source.iter_source_filenames()))
 
-    def build_artifact(self, artifact):
+    def build_artifact(self, artifact):
         artifact.render_template_into('view_source.html',
                                       this=self.source)
 
 env.add_build_program(Source, SourceBuildProgram)
 
 @env.virtualpathresolver('source')
-def resolve_virtual_path(record, pieces):
+def resolve_virtual_path(record, pieces):
     if not pieces:
         return Source(record)
 
diff --git a/docs/api/environment/add-publisher/index.html b/docs/api/environment/add-publisher/index.html index 8029b897..02ee5f6f 100644 --- a/docs/api/environment/add-publisher/index.html +++ b/docs/api/environment/add-publisher/index.html @@ -196,9 +196,9 @@

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):
+class MyPublisher(Publisher):
     pass
 
 env.add_publisher('my', MyPublisher)
diff --git a/docs/api/environment/add-type/index.html b/docs/api/environment/add-type/index.html
index bb9385f6..8319c5ee 100644
--- a/docs/api/environment/add-type/index.html
+++ b/docs/api/environment/add-type/index.html
@@ -194,15 +194,15 @@
       
 
       

This registers a new Field Type with the environment

-

Example

from lektor.types import Type
+

Example

from lektor.types import Type
 
-class MyThingType(Type):
+class MyThingType(Type):
     widget = 'singleline-text'
 
-    def value_from_raw(self, raw):
+    def value_from_raw(self, raw):
         return raw.value
 
-def setup_env(self, **extra):
+def setup_env(self, **extra):
     self.env.add_type(MyThingType)
 
diff --git a/docs/api/environment/generator/index.html b/docs/api/environment/generator/index.html index c7575c1c..03db8a49 100644 --- a/docs/api/environment/generator/index.html +++ b/docs/api/environment/generator/index.html @@ -198,22 +198,22 @@ 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
-from lektor.db import Record
-from lektor.utils import build_url
+

Example

from lektor.sourceobj import VirtualSourceObject
+from lektor.db import Record
+from lektor.utils import build_url
 
-class Source(VirtualSourceObject):
+class Source(VirtualSourceObject):
 
     @property
-    def path(self):
+    def path(self):
         return self.record.path + '@source'
 
     @property
-    def url_path(self):
+    def url_path(self):
         return build_url([self.record.url_path, 'source.txt'])
 
 @env.generator
-def generate_source_file(node):
+def generate_source_file(node):
     if isinstance(node, Record) and not node.is_attachment:
         yield Source(node)
 
diff --git a/docs/api/environment/index.html b/docs/api/environment/index.html index cfdc412d..a942dc2e 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 66c7173a..22008e56 100644
--- a/docs/api/environment/jinja-env/index.html
+++ b/docs/api/environment/jinja-env/index.html
@@ -194,13 +194,13 @@
 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):
+class MyPlugin(Plugin):
     ...
 
-    def on_setup_env(self, **extra):
-        def shout_filter(value):
+    def on_setup_env(self, **extra):
+        def shout_filter(value):
             return unicode(value).upper() + '!!!!1111'
         self.env.jinja_env.filters['shout'] = shout_filter
 
diff --git a/docs/api/environment/load-config/index.html b/docs/api/environment/load-config/index.html index 6b02a53d..2955d1ba 100644 --- a/docs/api/environment/load-config/index.html +++ b/docs/api/environment/load-config/index.html @@ -198,7 +198,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 54352696..e94fc3cf 100644
--- a/docs/api/environment/load-plugins/index.html
+++ b/docs/api/environment/load-plugins/index.html
@@ -194,7 +194,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 22df1494..f825a5a1 100644
--- a/docs/api/environment/new-pad/index.html
+++ b/docs/api/environment/new-pad/index.html
@@ -195,7 +195,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 000a2fc4..414cb93f 100644
--- a/docs/api/environment/render-template/index.html
+++ b/docs/api/environment/render-template/index.html
@@ -207,7 +207,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 18a40571..33e65116 100644
--- a/docs/api/environment/urlresolver/index.html
+++ b/docs/api/environment/urlresolver/index.html
@@ -198,21 +198,21 @@ 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
-from lektor.utils import build_url
+

Example

from lektor.sourceobj import VirtualSourceObject
+from lektor.utils import build_url
 
-class Source(VirtualSourceObject):
+class Source(VirtualSourceObject):
 
     @property
-    def path(self):
+    def path(self):
         return self.record.path + '@source'
 
     @property
-    def url_path(self):
+    def url_path(self):
         return build_url([self.record.url_path, 'source.txt'])
 
 @env.urlresolver
-def match_source_file(node, url_path):
+def match_source_file(node, url_path):
     if url_path == ['source.txt'] \
        and isinstance(node, Record) \
        and not node.is_attachment:
diff --git a/docs/api/environment/virtualpathresolver/index.html b/docs/api/environment/virtualpathresolver/index.html
index 4e5d3ca5..9351f102 100644
--- a/docs/api/environment/virtualpathresolver/index.html
+++ b/docs/api/environment/virtualpathresolver/index.html
@@ -208,30 +208,30 @@ 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.utils import build_url
+
from lektor.sourceobj import VirtualSourceObject
+from lektor.utils import build_url
 
-class Feed(VirtualSourceObject):
+class Feed(VirtualSourceObject):
 
-    def __init__(self, record, version='default'):
+    def __init__(self, record, version='default'):
         VirtualSourceObject.__init__(self, record)
         self.version = version
 
     @property
-    def path(self):
+    def path(self):
         return '%s@feed%s' % (
             self.record.path,
             '/' + self.version if self.version != 'default' else '',
         )
 
     @property
-    def url_path(self):
+    def url_path(self):
         return build_url([self.record.url_path, 'feed.xml'])
 
 
-def on_setup_env(self, **extra):
+def on_setup_env(self, **extra):
     @self.env.virtualpathresolver('feed')
-    def resolve_virtual_path(record, pieces):
+    def resolve_virtual_path(record, pieces):
         if not pieces:
             return Feed(record)
         elif pieces == ['recent']:
diff --git a/docs/api/plugins/events/before-build-all/index.html b/docs/api/plugins/events/before-build-all/index.html
index 039ec074..3c505178 100644
--- a/docs/api/plugins/events/before-build-all/index.html
+++ b/docs/api/plugins/events/before-build-all/index.html
@@ -214,9 +214,9 @@ 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):
+def on_before_build_all(self, builder, **extra):
     root = ospath.join(self.env.root_path, 'webpack')
     subprocess.Popen(['webpack'], cwd=root).wait()
 
diff --git a/docs/api/plugins/events/before-build/index.html b/docs/api/plugins/events/before-build/index.html index fdb95790..ac9d8f88 100644 --- a/docs/api/plugins/events/before-build/index.html +++ b/docs/api/plugins/events/before-build/index.html @@ -225,7 +225,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 chooses 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/markdown-config/index.html b/docs/api/plugins/events/markdown-config/index.html index 03878150..cf4217dd 100644 --- a/docs/api/plugins/events/markdown-config/index.html +++ b/docs/api/plugins/events/markdown-config/index.html @@ -211,9 +211,9 @@

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):
-    class HeaderAnchorMixin(object):
-        def header(renderer, text, level, raw):
+
def on_markdown_config(self, config, **extra):
+    class HeaderAnchorMixin(object):
+        def header(renderer, text, level, raw):
             if self.get_config().get('anchor-type') == "random":
                 anchor = uuid.uuid4().hex[:6]
             else:
diff --git a/docs/api/plugins/events/markdown-meta-init/index.html b/docs/api/plugins/events/markdown-meta-init/index.html
index ae9ae99e..e159bd2b 100644
--- a/docs/api/plugins/events/markdown-meta-init/index.html
+++ b/docs/api/plugins/events/markdown-meta-init/index.html
@@ -211,7 +211,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 c0dbc989..e7591874 100644 --- a/docs/api/plugins/events/markdown-meta-postprocess/index.html +++ b/docs/api/plugins/events/markdown-meta-postprocess/index.html @@ -211,7 +211,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 da0fc56f..865dc314 100644
--- a/docs/api/plugins/events/process-template-context/index.html
+++ b/docs/api/plugins/events/process-template-context/index.html
@@ -223,7 +223,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 24c5ddc2..4d7bbc99 100644 --- a/docs/api/plugins/events/server-spawn/index.html +++ b/docs/api/plugins/events/server-spawn/index.html @@ -214,19 +214,19 @@ 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
-from subprocess import Popen
+

Example

import os
+from subprocess import Popen
 
-class MyPlugin(Plugin):
+class MyPlugin(Plugin):
     ...
 
     webpack = None
 
-    def on_server_spawn(self, **extra):
+    def on_server_spawn(self, **extra):
         path = os.path.join(self.env.root_path, 'webpack')
         self.webpack = Popen(['webpack', '--watch'], cwd=path)
 
-    def on_server_stop(self, **extra):
+    def on_server_stop(self, **extra):
         if self.webpack is not None:
             self.webpack.kill()
 
diff --git a/docs/api/plugins/events/setup-env/index.html b/docs/api/plugins/events/setup-env/index.html index a1ea6a29..7147dbba 100644 --- a/docs/api/plugins/events/setup-env/index.html +++ b/docs/api/plugins/events/setup-env/index.html @@ -213,7 +213,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 22bf671a..802a65b4 100644 --- a/docs/api/plugins/get-plugin/index.html +++ b/docs/api/plugins/get-plugin/index.html @@ -169,7 +169,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 a6b66873..5eb6b893 100644
--- a/docs/api/plugins/plugin/config-filename/index.html
+++ b/docs/api/plugins/plugin/config-filename/index.html
@@ -191,19 +191,19 @@ 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
-from lektor.context import get_ctx
+

Example

from lektor.pluginsystem import Plugin
+from lektor.context import get_ctx
 
 
-class MyPlugin(Plugin):
+class MyPlugin(Plugin):
 
-    def on_setup_env(self, **extra):
+    def on_setup_env(self, **extra):
         color = self.get_config().get('color')
-        def get_css(artifact_name='/static/demo.css'):
+        def get_css(artifact_name='/static/demo.css'):
             ctx = get_ctx()
             @ctx.sub_artifact(artifact_name, sources=[
                 self.config_filename])
-            def build_stylesheet(artifact):
+            def build_stylesheet(artifact):
                 with artifact.open('w') as f:
                     f.write('body { background: %s }\n' % color)
             return artifact_name
diff --git a/docs/api/plugins/plugin/description/index.html b/docs/api/plugins/plugin/description/index.html
index 1ec9dfbc..16f3fa6d 100644
--- a/docs/api/plugins/plugin/description/index.html
+++ b/docs/api/plugins/plugin/description/index.html
@@ -188,10 +188,10 @@
 
       

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):
+class MyPlugin(Plugin):
     name = 'My Plugin'
     description = 'This is a small plugin I wrote for testing purposes'
 
diff --git a/docs/api/plugins/plugin/emit/index.html b/docs/api/plugins/plugin/emit/index.html index 96b91bdf..b208890a 100644 --- a/docs/api/plugins/plugin/emit/index.html +++ b/docs/api/plugins/plugin/emit/index.html @@ -189,21 +189,21 @@

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):
+class MyPlugin(Plugin):
 
-    def on_setup_env(self, **extra):
+    def on_setup_env(self, **extra):
         self.emit('setup', foo=42)
 

Another plugin can then hook this:

-
from lektor.pluginsystem import Plugin
+
from lektor.pluginsystem import Plugin
 
 
-class MyPlugin(Plugin):
+class MyPlugin(Plugin):
 
-    def on_my_plugin_setup(self, foo, **extra):
+    def on_my_plugin_setup(self, foo, **extra):
         print('got %s' % foo)
 

(This assumes the plugin id is set to my-plugin in setup.py)

diff --git a/docs/api/plugins/plugin/get-config/index.html b/docs/api/plugins/plugin/get-config/index.html index 5cd0416f..50d9a45b 100644 --- a/docs/api/plugins/plugin/get-config/index.html +++ b/docs/api/plugins/plugin/get-config/index.html @@ -190,12 +190,12 @@

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):
+class MyPlugin(Plugin):
 
-    def on_setup_env(self, **extra):
+    def on_setup_env(self, **extra):
         color = self.get_config().get('color')
         self.env.jinja_env.globals['my_color'] = color
 
diff --git a/docs/api/plugins/plugin/name/index.html b/docs/api/plugins/plugin/name/index.html index a7e2ddbf..6feb7bf1 100644 --- a/docs/api/plugins/plugin/name/index.html +++ b/docs/api/plugins/plugin/name/index.html @@ -188,10 +188,10 @@

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):
+class MyPlugin(Plugin):
     name = 'My Plugin'
 
diff --git a/docs/api/project/discover/index.html b/docs/api/project/discover/index.html index 3a8e712f..fef22428 100644 --- a/docs/api/project/discover/index.html +++ b/docs/api/project/discover/index.html @@ -171,7 +171,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 f1d65d0c..c361cbbd 100644 --- a/docs/api/project/from-file/index.html +++ b/docs/api/project/from-file/index.html @@ -170,7 +170,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 655f4ba8..68626054 100644 --- a/docs/api/project/make-env/index.html +++ b/docs/api/project/make-env/index.html @@ -172,7 +172,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 38bdc8c6..1f6e849a 100644
--- a/docs/api/publisher/fail/index.html
+++ b/docs/api/publisher/fail/index.html
@@ -174,16 +174,16 @@
 
       

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):
-    def publish(self, target_url, credentials=None, **extra):
+class MyPublisher(Publisher):
+    def publish(self, target_url, credentials=None, **extra):
         self.fail('This publisher cannot publish :(')
 
 
-class MyPlugin(Plugin):
-    def on_setup_env(self, **extra):
+class MyPlugin(Plugin):
+    def on_setup_env(self, **extra):
         self.env.add_publisher('my', MyPublisher)
 
diff --git a/docs/api/publisher/publish/index.html b/docs/api/publisher/publish/index.html index f8359310..59514290 100644 --- a/docs/api/publisher/publish/index.html +++ b/docs/api/publisher/publish/index.html @@ -192,14 +192,14 @@ 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 shutil
-from lektor.publisher import Publisher
+
import os
+import shutil
+from lektor.publisher import Publisher
 
 
-class CopyPublisher(Publisher):
+class CopyPublisher(Publisher):
 
-    def publish(self, target_url, credentials=None, **extra):
+    def publish(self, target_url, credentials=None, **extra):
         src_path = self.output_path
         dst_path = target_url.path
         strip = len(src_path) + 1
@@ -226,8 +226,8 @@ into a new location.

yield 'Done' -class MyPlugin(Plugin): - def on_setup_env(self, **extra): +class MyPlugin(Plugin): + def on_setup_env(self, **extra): self.env.add_publisher('copy', CopyPublisher)

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

diff --git a/docs/api/utils/build-url/index.html b/docs/api/utils/build-url/index.html index 4cdb0207..05fd472f 100644 --- a/docs/api/utils/build-url/index.html +++ b/docs/api/utils/build-url/index.html @@ -182,7 +182,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 3ebd1a3c..fe20177a 100644
--- a/docs/api/utils/get-structure-hash/index.html
+++ b/docs/api/utils/get-structure-hash/index.html
@@ -177,7 +177,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 969622d5..2de567d5 100644
--- a/docs/api/utils/join-path/index.html
+++ b/docs/api/utils/join-path/index.html
@@ -179,7 +179,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')
diff --git a/docs/api/utils/parse-path/index.html b/docs/api/utils/parse-path/index.html
index 5f3211e1..68379322 100644
--- a/docs/api/utils/parse-path/index.html
+++ b/docs/api/utils/parse-path/index.html
@@ -179,7 +179,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 0aaaee2b..8f2e5072 100644
--- a/docs/api/utils/process-image/index.html
+++ b/docs/api/utils/process-image/index.html
@@ -182,15 +182,15 @@ 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
-from lektor.context import get_ctx
-from lektor.db import Image
-from lektor.imagetools import process_image, ThumbnailMode
-from lektor.pluginsystem import Plugin
+

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
+from lektor.pluginsystem import Plugin
 
 
-class ImageCropBuildProgram(AttachmentBuildProgram):
-    def build_artifact(self, artifact):
+class ImageCropBuildProgram(AttachmentBuildProgram):
+    def build_artifact(self, artifact):
         ctx = get_ctx()
         width, height = 600, 400
         source_img = artifact.source_obj.attachment_filename
@@ -202,8 +202,8 @@ from the source image's dimensions so that the image is scaled proportionally.width, height, mode=ThumbnailMode.CROP)
 
 
-class ImageCropPlugin(Plugin):
-    def on_setup_env(self, **extra):
+class ImageCropPlugin(Plugin):
+    def on_setup_env(self, **extra):
         self.env.add_build_program(Image, ImageCropBuildProgram)
 
diff --git a/docs/plugins/dev/index.html b/docs/plugins/dev/index.html index db3e3e57..c6417d84 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,9 +213,9 @@ 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):
+class HelloWorldPlugin(Plugin):
     name = 'Hello World'
     description = 'This is a demo plugin for testing purposes.'
 
@@ -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',
@@ -240,14 +240,14 @@ a function named on_setup_env:

'Possessing pawns', ] -def get_random_message(): +def get_random_message(): return random.choice(MESSAGES) -class HelloWorldPlugin(Plugin): +class HelloWorldPlugin(Plugin): name = 'Hello World' description = 'This is a demo plugin for testing purposes.' - def on_setup_env(self, **extra): + def on_setup_env(self, **extra): self.env.jinja_env.globals.update( get_random_message=get_random_message ) diff --git a/docs/plugins/howto/index.html b/docs/plugins/howto/index.html index 907e332f..fefae7f7 100644 --- a/docs/plugins/howto/index.html +++ b/docs/plugins/howto/index.html @@ -161,19 +161,19 @@ 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 werkzeug.urls import url_encode
-from lektor.pluginsystem import Plugin
+
from hashlib import md5
+from werkzeug.urls import url_encode
+from lektor.pluginsystem import Plugin
 
 BASE_URL = 'https://secure.gravatar.com/avatar/'
 
-def get_gravatar(email, **options):
+def get_gravatar(email, **options):
     fn = md5(email.lower().strip().encode('utf-8')).hexdigest()
     return '%s/%s?%s' % (BASE_URL, fn, url_encode(options))
 
-class GravatarPlugin(Plugin):
+class GravatarPlugin(Plugin):
     name = 'Gravatar'
-    def on_setup_env(self, **extra):
+    def on_setup_env(self, **extra):
         self.env.jinja_env.filters['gravatar'] = get_gravatar
 

Configure Plugins

Plugins can come with their own config files and it's encouraged that plugins @@ -206,22 +206,22 @@ through the sub_arti method which declares a new artifact.

Here is an example of both ways in one plugin:

-
import os
-from flask import json
-from lektor.pluginsystem import Plugin
+
import os
+from flask import json
+from lektor.pluginsystem import Plugin
 
-def dump_exif(image):
+def dump_exif(image):
     ctx = get_ctx()
     path = posixpath.join(image.path, '-exif.json')
     @ctx.sub_artifact(path, sources=[image.source_filename])
-    def include_file(artifact):
+    def include_file(artifact):
         ctx.record_dependency(__file__)
         with artifact.open('wb') as f:
             json.dump(image.exif.to_dict(), f)
     return path
 
-class ExifDumpPlugin(Plugin):
-    def setup_env(self, **extra):
+class ExifDumpPlugin(Plugin):
+    def setup_env(self, **extra):
         self.env.jinja_env.globals['dump_exif'] = dump_exif
 

This dumps out the EXIF data into a JSON file and returns the artifact name. @@ -246,13 +246,13 @@ 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
+from lektor.pluginsystem import Plugin
+from lektor.types import Type
 
 
-def asciidoc_to_html(text):
+def asciidoc_to_html(text):
     # The "-" at the end tells asciidoc to read from stdin.
     p = Popen(
         ['asciidoc', '--no-header-footer', 
@@ -268,26 +268,26 @@ code here
 
 # Wrapper with an __html__ method prevents
 # Lektor from escaping HTML tags.
-class HTML(object):
-    def __init__(self, html):
+class HTML(object):
+    def __init__(self, html):
         self.html = html
 
-    def __html__(self):
+    def __html__(self):
         return self.html
 
 
-class AsciiDocType(Type):
+class AsciiDocType(Type):
     widget = 'multiline-text'
 
-    def value_from_raw(self, raw):
+    def value_from_raw(self, raw):
         return HTML(asciidoc_to_html(raw.value or u''))
 
 
-class AsciiDocPlugin(Plugin):
+class AsciiDocPlugin(Plugin):
     name = u'AsciiDoc'
     description = u'Adds AsciiDoc field type to Lektor.'
 
-    def on_setup_env(self, **extra):
+    def on_setup_env(self, **extra):
         # Derives type name "asciidoc" from class name.
         self.env.add_type(AsciiDocType)
 
diff --git a/docs/plugins/publishing/index.html b/docs/plugins/publishing/index.html index 79b19975..2a5f2cda 100644 --- a/docs/plugins/publishing/index.html +++ b/docs/plugins/publishing/index.html @@ -152,11 +152,11 @@ 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 io
-import re
+
import ast
+import io
+import re
 
-from setuptools import setup, find_packages
+from setuptools import setup, find_packages
 
 with io.open('README.md', 'rt', encoding="utf8") as f:
     readme = f.read()
diff --git a/docs/themes/creating/index.html b/docs/themes/creating/index.html
index 1b6f8ac3..65010aad 100644
--- a/docs/themes/creating/index.html
+++ b/docs/themes/creating/index.html
@@ -158,7 +158,7 @@
 parametrize themes:

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

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

diff --git a/index.html b/index.html index 201d878b..9a927f5a 100644 --- a/index.html +++ b/index.html @@ -151,7 +151,7 @@ speak multiple languages and allow you to easily create localized websites.
-

In this case, the body field will be interpreted as raw HTML if the content of that field starts with a “<”, otherwise it will be diff --git a/plugins/lektor-tags/index.html b/plugins/lektor-tags/index.html index 92ac931c..fe8073a1 100644 --- a/plugins/lektor-tags/index.html +++ b/plugins/lektor-tags/index.html @@ -202,7 +202,7 @@ tea

items = this.parent.children.filter(F.tags.contains(tag))
 

You can sort and filter with any expression:

-
items = this.parent.children.filter(F.tags.contains(tag) and F.status == 'published').order_by('-pub_date')
+
items = this.parent.children.filter(F.tags.contains(tag) and F.status == 'published').order_by('-pub_date')
 

If the parent page has a pagination query you may want to use it for tagged pages:

items = this.parent.pagination.items.filter(F.tags.contains(tag))
diff --git a/static/pygments.css b/static/pygments.css
index 22ba49cd..50462f2b 100644
--- a/static/pygments.css
+++ b/static/pygments.css
@@ -4,80 +4,80 @@ span.linenos { color: inherit; background-color: transparent; padding-left: 5px;
 td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
 span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
 .hll .hll { background-color: #ffffcc }
-.hll .c { color: #8f5902; font-style: italic } /* Comment */
-.hll .err { color: #a40000; border: 1px solid #ef2929 } /* Error */
-.hll .g { color: #000000 } /* Generic */
-.hll .k { color: #204a87; font-weight: bold } /* Keyword */
-.hll .l { color: #000000 } /* Literal */
-.hll .n { color: #000000 } /* Name */
-.hll .o { color: #ce5c00; font-weight: bold } /* Operator */
-.hll .x { color: #000000 } /* Other */
-.hll .p { color: #000000; font-weight: bold } /* Punctuation */
-.hll .ch { color: #8f5902; font-style: italic } /* Comment.Hashbang */
-.hll .cm { color: #8f5902; font-style: italic } /* Comment.Multiline */
-.hll .cp { color: #8f5902; font-style: italic } /* Comment.Preproc */
-.hll .cpf { color: #8f5902; font-style: italic } /* Comment.PreprocFile */
-.hll .c1 { color: #8f5902; font-style: italic } /* Comment.Single */
-.hll .cs { color: #8f5902; font-style: italic } /* Comment.Special */
-.hll .gd { color: #a40000 } /* Generic.Deleted */
-.hll .ge { color: #000000; font-style: italic } /* Generic.Emph */
-.hll .ges { color: #000000; font-weight: bold; font-style: italic } /* Generic.EmphStrong */
-.hll .gr { color: #ef2929 } /* Generic.Error */
+.hll .c { color: #8F5902; font-style: italic } /* Comment */
+.hll .err { color: #A40000; border: 1px solid #EF2929 } /* Error */
+.hll .g { color: #000 } /* Generic */
+.hll .k { color: #204A87; font-weight: bold } /* Keyword */
+.hll .l { color: #000 } /* Literal */
+.hll .n { color: #000 } /* Name */
+.hll .o { color: #CE5C00; font-weight: bold } /* Operator */
+.hll .x { color: #000 } /* Other */
+.hll .p { color: #000; font-weight: bold } /* Punctuation */
+.hll .ch { color: #8F5902; font-style: italic } /* Comment.Hashbang */
+.hll .cm { color: #8F5902; font-style: italic } /* Comment.Multiline */
+.hll .cp { color: #8F5902; font-style: italic } /* Comment.Preproc */
+.hll .cpf { color: #8F5902; font-style: italic } /* Comment.PreprocFile */
+.hll .c1 { color: #8F5902; font-style: italic } /* Comment.Single */
+.hll .cs { color: #8F5902; font-style: italic } /* Comment.Special */
+.hll .gd { color: #A40000 } /* Generic.Deleted */
+.hll .ge { color: #000; font-style: italic } /* Generic.Emph */
+.hll .ges { color: #000; font-weight: bold; font-style: italic } /* Generic.EmphStrong */
+.hll .gr { color: #EF2929 } /* Generic.Error */
 .hll .gh { color: #000080; font-weight: bold } /* Generic.Heading */
 .hll .gi { color: #00A000 } /* Generic.Inserted */
-.hll .go { color: #000000; font-style: italic } /* Generic.Output */
-.hll .gp { color: #8f5902 } /* Generic.Prompt */
-.hll .gs { color: #000000; font-weight: bold } /* Generic.Strong */
+.hll .go { color: #000; font-style: italic } /* Generic.Output */
+.hll .gp { color: #8F5902 } /* Generic.Prompt */
+.hll .gs { color: #000; font-weight: bold } /* Generic.Strong */
 .hll .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
-.hll .gt { color: #a40000; font-weight: bold } /* Generic.Traceback */
-.hll .kc { color: #204a87; font-weight: bold } /* Keyword.Constant */
-.hll .kd { color: #204a87; font-weight: bold } /* Keyword.Declaration */
-.hll .kn { color: #204a87; font-weight: bold } /* Keyword.Namespace */
-.hll .kp { color: #204a87; font-weight: bold } /* Keyword.Pseudo */
-.hll .kr { color: #204a87; font-weight: bold } /* Keyword.Reserved */
-.hll .kt { color: #204a87; font-weight: bold } /* Keyword.Type */
-.hll .ld { color: #000000 } /* Literal.Date */
-.hll .m { color: #0000cf; font-weight: bold } /* Literal.Number */
-.hll .s { color: #4e9a06 } /* Literal.String */
-.hll .na { color: #c4a000 } /* Name.Attribute */
-.hll .nb { color: #204a87 } /* Name.Builtin */
-.hll .nc { color: #000000 } /* Name.Class */
-.hll .no { color: #000000 } /* Name.Constant */
-.hll .nd { color: #5c35cc; font-weight: bold } /* Name.Decorator */
-.hll .ni { color: #ce5c00 } /* Name.Entity */
-.hll .ne { color: #cc0000; font-weight: bold } /* Name.Exception */
-.hll .nf { color: #000000 } /* Name.Function */
-.hll .nl { color: #f57900 } /* Name.Label */
-.hll .nn { color: #000000 } /* Name.Namespace */
-.hll .nx { color: #000000 } /* Name.Other */
-.hll .py { color: #000000 } /* Name.Property */
-.hll .nt { color: #204a87; font-weight: bold } /* Name.Tag */
-.hll .nv { color: #000000 } /* Name.Variable */
-.hll .ow { color: #204a87; font-weight: bold } /* Operator.Word */
-.hll .pm { color: #000000; font-weight: bold } /* Punctuation.Marker */
-.hll .w { color: #f8f8f8 } /* Text.Whitespace */
-.hll .mb { color: #0000cf; font-weight: bold } /* Literal.Number.Bin */
-.hll .mf { color: #0000cf; font-weight: bold } /* Literal.Number.Float */
-.hll .mh { color: #0000cf; font-weight: bold } /* Literal.Number.Hex */
-.hll .mi { color: #0000cf; font-weight: bold } /* Literal.Number.Integer */
-.hll .mo { color: #0000cf; font-weight: bold } /* Literal.Number.Oct */
-.hll .sa { color: #4e9a06 } /* Literal.String.Affix */
-.hll .sb { color: #4e9a06 } /* Literal.String.Backtick */
-.hll .sc { color: #4e9a06 } /* Literal.String.Char */
-.hll .dl { color: #4e9a06 } /* Literal.String.Delimiter */
-.hll .sd { color: #8f5902; font-style: italic } /* Literal.String.Doc */
-.hll .s2 { color: #4e9a06 } /* Literal.String.Double */
-.hll .se { color: #4e9a06 } /* Literal.String.Escape */
-.hll .sh { color: #4e9a06 } /* Literal.String.Heredoc */
-.hll .si { color: #4e9a06 } /* Literal.String.Interpol */
-.hll .sx { color: #4e9a06 } /* Literal.String.Other */
-.hll .sr { color: #4e9a06 } /* Literal.String.Regex */
-.hll .s1 { color: #4e9a06 } /* Literal.String.Single */
-.hll .ss { color: #4e9a06 } /* Literal.String.Symbol */
-.hll .bp { color: #3465a4 } /* Name.Builtin.Pseudo */
-.hll .fm { color: #000000 } /* Name.Function.Magic */
-.hll .vc { color: #000000 } /* Name.Variable.Class */
-.hll .vg { color: #000000 } /* Name.Variable.Global */
-.hll .vi { color: #000000 } /* Name.Variable.Instance */
-.hll .vm { color: #000000 } /* Name.Variable.Magic */
-.hll .il { color: #0000cf; font-weight: bold } /* Literal.Number.Integer.Long */
\ No newline at end of file
+.hll .gt { color: #A40000; font-weight: bold } /* Generic.Traceback */
+.hll .kc { color: #204A87; font-weight: bold } /* Keyword.Constant */
+.hll .kd { color: #204A87; font-weight: bold } /* Keyword.Declaration */
+.hll .kn { color: #204A87; font-weight: bold } /* Keyword.Namespace */
+.hll .kp { color: #204A87; font-weight: bold } /* Keyword.Pseudo */
+.hll .kr { color: #204A87; font-weight: bold } /* Keyword.Reserved */
+.hll .kt { color: #204A87; font-weight: bold } /* Keyword.Type */
+.hll .ld { color: #000 } /* Literal.Date */
+.hll .m { color: #0000CF; font-weight: bold } /* Literal.Number */
+.hll .s { color: #4E9A06 } /* Literal.String */
+.hll .na { color: #C4A000 } /* Name.Attribute */
+.hll .nb { color: #204A87 } /* Name.Builtin */
+.hll .nc { color: #000 } /* Name.Class */
+.hll .no { color: #000 } /* Name.Constant */
+.hll .nd { color: #5C35CC; font-weight: bold } /* Name.Decorator */
+.hll .ni { color: #CE5C00 } /* Name.Entity */
+.hll .ne { color: #C00; font-weight: bold } /* Name.Exception */
+.hll .nf { color: #000 } /* Name.Function */
+.hll .nl { color: #F57900 } /* Name.Label */
+.hll .nn { color: #000 } /* Name.Namespace */
+.hll .nx { color: #000 } /* Name.Other */
+.hll .py { color: #000 } /* Name.Property */
+.hll .nt { color: #204A87; font-weight: bold } /* Name.Tag */
+.hll .nv { color: #000 } /* Name.Variable */
+.hll .ow { color: #204A87; font-weight: bold } /* Operator.Word */
+.hll .pm { color: #000; font-weight: bold } /* Punctuation.Marker */
+.hll .w { color: #F8F8F8 } /* Text.Whitespace */
+.hll .mb { color: #0000CF; font-weight: bold } /* Literal.Number.Bin */
+.hll .mf { color: #0000CF; font-weight: bold } /* Literal.Number.Float */
+.hll .mh { color: #0000CF; font-weight: bold } /* Literal.Number.Hex */
+.hll .mi { color: #0000CF; font-weight: bold } /* Literal.Number.Integer */
+.hll .mo { color: #0000CF; font-weight: bold } /* Literal.Number.Oct */
+.hll .sa { color: #4E9A06 } /* Literal.String.Affix */
+.hll .sb { color: #4E9A06 } /* Literal.String.Backtick */
+.hll .sc { color: #4E9A06 } /* Literal.String.Char */
+.hll .dl { color: #4E9A06 } /* Literal.String.Delimiter */
+.hll .sd { color: #8F5902; font-style: italic } /* Literal.String.Doc */
+.hll .s2 { color: #4E9A06 } /* Literal.String.Double */
+.hll .se { color: #4E9A06 } /* Literal.String.Escape */
+.hll .sh { color: #4E9A06 } /* Literal.String.Heredoc */
+.hll .si { color: #4E9A06 } /* Literal.String.Interpol */
+.hll .sx { color: #4E9A06 } /* Literal.String.Other */
+.hll .sr { color: #4E9A06 } /* Literal.String.Regex */
+.hll .s1 { color: #4E9A06 } /* Literal.String.Single */
+.hll .ss { color: #4E9A06 } /* Literal.String.Symbol */
+.hll .bp { color: #3465A4 } /* Name.Builtin.Pseudo */
+.hll .fm { color: #000 } /* Name.Function.Magic */
+.hll .vc { color: #000 } /* Name.Variable.Class */
+.hll .vg { color: #000 } /* Name.Variable.Global */
+.hll .vi { color: #000 } /* Name.Variable.Instance */
+.hll .vm { color: #000 } /* Name.Variable.Magic */
+.hll .il { color: #0000CF; font-weight: bold } /* Literal.Number.Integer.Long */
\ No newline at end of file