diff --git a/.travis.yml b/.travis.yml
index 5d96938f..78dc5306 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,5 @@
language: python
-python: 2.7
+python: 3.5
install:
- "pip install -U pip"
- "pip install git+https://github.com/lektor/lektor#egg=Lektor"
diff --git a/Website.lektorproject b/Website.lektorproject
index 19c4b797..966aeff1 100644
--- a/Website.lektorproject
+++ b/Website.lektorproject
@@ -10,7 +10,7 @@ target = rsync://deploy@flow.srv.pocoo.org/srv/websites/getlektor.com/static
default = yes
[packages]
-lektor-webpack-support = 0.1
+lektor-webpack-support = 0.3
lektor-disqus-comments = 0.1
lektor-markdown-header-anchors = 0.1
lektor-markdown-highlighter = 0.1
diff --git a/assets/install.ps1 b/assets/install.ps1
index af2e115e..6691ab7a 100644
--- a/assets/install.ps1
+++ b/assets/install.ps1
@@ -2,13 +2,19 @@ $InstallScript = @"
import os
import sys
import json
-import urllib
import tempfile
import tarfile
import shutil
from subprocess import Popen
-from _winreg import OpenKey, CloseKey, QueryValueEx, SetValueEx, \
+try: # py3
+ from urllib.request import urlopen
+ from winreg import OpenKey, CloseKey, QueryValueEx, SetValueEx, \
HKEY_CURRENT_USER, KEY_ALL_ACCESS, REG_EXPAND_SZ
+except ImportError: # py2
+ from urllib import urlopen
+ from _winreg import OpenKey, CloseKey, QueryValueEx, SetValueEx, \
+ HKEY_CURRENT_USER, KEY_ALL_ACCESS, REG_EXPAND_SZ
+
import ctypes
from ctypes.wintypes import HWND, UINT, WPARAM, LPARAM, LPVOID
@@ -23,15 +29,19 @@ LRESULT = LPARAM
HWND_BROADCAST = 0xFFFF
WM_SETTINGCHANGE = 0x1A
+PY2 = sys.version_info[0] == 2
+if PY2:
+ input = raw_input
+
def get_confirmation():
while 1:
- input = raw_input('Continue? [Yn] ').lower().strip()
- if input in ('', 'y'):
+ user_input = input('Continue? [Yn] ').lower().strip()
+ if user_input in ('', 'y'):
break
- elif input == 'n':
- print
- print 'Aborted!'
+ elif user_input == 'n':
+ print()
+ print('Aborted!')
sys.exit()
def find_location():
@@ -39,9 +49,9 @@ def find_location():
return install_dir, os.path.join(install_dir, LIB)
def deletion_error(func, path, excinfo):
- print 'Problem deleting {}'.format(path)
- print 'Please try and delete {} manually'.format(path)
- print 'Aborted!'
+ print('Problem deleting {}'.format(path))
+ print('Please try and delete {} manually'.format(path))
+ print('Aborted!')
sys.exit()
def wipe_installation(install_dir):
@@ -49,16 +59,16 @@ def wipe_installation(install_dir):
def check_installation(install_dir):
if os.path.exists(install_dir):
- print ' Lektor seems to be installed already.'
- print ' Continuing will delete:'
- print ' %s' % install_dir
- print
+ print(' Lektor seems to be installed already.')
+ print(' Continuing will delete:')
+ print(' %s' % install_dir)
+ print()
get_confirmation()
- print
+ print()
wipe_installation(install_dir)
def fail(message):
- print 'Error: %s' % message
+ print('Error: %s' % message)
sys.exit(1)
def add_to_path(location):
@@ -83,7 +93,7 @@ def add_to_path(location):
def install(virtualenv_url, virtualenv_filename, install_dir, lib_dir):
t = tempfile.mkdtemp()
with open(os.path.join(t, 'virtualenv.tar.gz'), 'wb') as f:
- download = urllib.urlopen(virtualenv_url)
+ download = urlopen(virtualenv_url)
f.write(download.read())
download.close()
with tarfile.open(os.path.join(t, 'virtualenv.tar.gz'), 'r:gz') as tar:
@@ -108,22 +118,22 @@ def install(virtualenv_url, virtualenv_filename, install_dir, lib_dir):
def main():
- print
- print 'Welcome to Lektor'
- print
- print 'This script will install Lektor on your computer.'
- print
+ print()
+ print('Welcome to Lektor')
+ print()
+ print('This script will install Lektor on your computer.')
+ print()
install_dir, lib_dir = find_location()
check_installation(install_dir)
- print ' Installing at:'
- print ' %s' % install_dir
- print
+ print(' Installing at:')
+ print(' %s' % install_dir)
+ print()
get_confirmation()
- for url in json.load(urllib.urlopen(VENV_URL))['urls']:
+ for url in json.load(urlopen(VENV_URL))['urls']:
if url['python_version'] == 'source':
virtualenv_url = url['url']
#stripping '.tar.gz'
@@ -134,8 +144,8 @@ def main():
install(virtualenv_url, virtualenv_filename, install_dir, lib_dir)
- print
- print 'All done!'
+ print()
+ print('All done!')
main()
"@
diff --git a/assets/install.sh b/assets/install.sh
index 2c478487..97bac59f 100644
--- a/assets/install.sh
+++ b/assets/install.sh
@@ -11,25 +11,28 @@
I() {
set -u
- if hash python2 2> /dev/null; then
- PY=python2
- elif hash python 2> /dev/null; then
- PY=python
- else
+ if ! hash python 2> /dev/null; then
echo "Error: To use this script you need to have Python installed"
exit 1
fi
- $PY - <<'EOF'
+ python - <<'EOF'
if 1:
import os
import sys
import json
- import urllib
import tempfile
import shutil
from subprocess import Popen
+ try:
+ from urllib.request import urlopen
+ except ImportError:
+ from urllib import urlopen
+
+ PY2 = sys.version_info[0] == 2
+ if PY2:
+ input = raw_input
sys.stdin = open('/dev/tty', 'r')
@@ -71,18 +74,18 @@ if 1:
def get_confirmation():
while 1:
- input = raw_input('Continue? [Yn] ').lower().strip()
- if input in ('', 'y'):
+ user_input = input('Continue? [Yn] ').lower().strip()
+ if user_input in ('', 'y'):
break
- elif input == 'n':
- print
- print 'Aborted!'
+ elif user_input == 'n':
+ print()
+ print('Aborted!')
sys.exit()
def deletion_error(func, path, excinfo):
- print 'Problem deleting {}'.format(path)
- print 'Please try and delete {} manually'.format(path)
- print 'Aborted!'
+ print('Problem deleting {}'.format(path))
+ print('Please try and delete {} manually'.format(path))
+ print('Aborted!')
sys.exit()
def wipe_installation(lib_dir, symlink_path):
@@ -94,18 +97,18 @@ if 1:
def check_installation(lib_dir, bin_dir):
symlink_path = os.path.join(bin_dir, 'lektor')
if os.path.exists(lib_dir) or os.path.lexists(symlink_path):
- print ' Lektor seems to be installed already.'
- print ' Continuing will delete:'
- print ' %s' % lib_dir
- print ' and remove this symlink:'
- print ' %s' % symlink_path
- print
+ print(' Lektor seems to be installed already.')
+ print(' Continuing will delete:')
+ print(' %s' % lib_dir)
+ print(' and remove this symlink:')
+ print(' %s' % symlink_path)
+ print()
if prompt: get_confirmation()
- print
+ print()
wipe_installation(lib_dir, symlink_path)
def fail(message):
- print 'Error: %s' % message
+ print('Error: %s' % message)
sys.exit(1)
def install(virtualenv_url, lib_dir, bin_dir):
@@ -124,11 +127,11 @@ if 1:
os.path.join(bin_dir, 'lektor'))
def main():
- print
- print 'Welcome to Lektor'
- print
- print 'This script will install Lektor on your computer.'
- print
+ print()
+ print('Welcome to Lektor')
+ print()
+ print('This script will install Lektor on your computer.')
+ print()
paths = find_user_paths()
if not paths:
@@ -141,14 +144,14 @@ if 1:
check_installation(lib_dir, bin_dir)
- print 'Installing at:'
- print ' bin: %s' % bin_dir
- print ' app: %s' % lib_dir
- print
+ print('Installing at:')
+ print(' bin: %s' % bin_dir)
+ print(' app: %s' % lib_dir)
+ print()
if prompt: get_confirmation()
- for url in json.load(urllib.urlopen(VENV_URL))['urls']:
+ for url in json.loads(urlopen(VENV_URL).read().decode('utf-8'))['urls']:
if url['python_version'] == 'source':
virtualenv = url['url']
break
@@ -157,8 +160,8 @@ if 1:
install(virtualenv, lib_dir, bin_dir)
- print
- print 'All done!'
+ print()
+ print('All done!')
main()
EOF
diff --git a/content/docs/api/build/context/contents.lr b/content/docs/api/build/context/contents.lr
index 1022a424..ca24c36b 100644
--- a/content/docs/api/build/context/contents.lr
+++ b/content/docs/api/build/context/contents.lr
@@ -25,5 +25,5 @@ the return value will be `None`.
from lektor.context import get_ctx
ctx = get_ctx()
-print 'The current source is %s' % ctx.source
+print('The current source is %s' % ctx.source)
```
diff --git a/content/docs/api/build/context/gather-dependencies/contents.lr b/content/docs/api/build/context/gather-dependencies/contents.lr
index b1b1b5c9..93f2629f 100644
--- a/content/docs/api/build/context/gather-dependencies/contents.lr
+++ b/content/docs/api/build/context/gather-dependencies/contents.lr
@@ -21,5 +21,5 @@ encounters a dependency it will invoke the passed function.
deps = set()
with get_ctx().gather_dependencies(deps.add):
items = pad.query('/path/to/some/pages').all()
-print 'The dependencies are: %s' % deps
+print('The dependencies are: %s' % deps)
```
diff --git a/content/docs/api/db/record/children/contents.lr b/content/docs/api/db/record/children/contents.lr
index 04e6b5c9..37d36abf 100644
--- a/content/docs/api/db/record/children/contents.lr
+++ b/content/docs/api/db/record/children/contents.lr
@@ -6,7 +6,7 @@ type: property
---
body:
-Because of Lektor's tree based nature it almost all records can have children
+Because of Lektor's tree based nature almost all records can have children
below them. The `children` attribute provides a convenient way to access
those. It returns a [Query :ref](../../query/) object that can be used to
further filter down children.
diff --git a/content/docs/api/db/record/contents.lr b/content/docs/api/db/record/contents.lr
index eb934c57..d92ba541 100644
--- a/content/docs/api/db/record/contents.lr
+++ b/content/docs/api/db/record/contents.lr
@@ -9,7 +9,7 @@ type: class
body:
Records are [Source Objects :ref](../obj/) that come from the `content/`
-folder and correspond to [Data Models :ref](../../../models/). The provide
+folder and correspond to [Data Models :ref](../../../models/). They provide
a wider range of functionality compared to a standard source object but
they also provide all the functionality a regular source object does.
diff --git a/content/docs/api/db/record/exif/contents.lr b/content/docs/api/db/record/exif/contents.lr
index c7f3aa8c..67d8b580 100644
--- a/content/docs/api/db/record/exif/contents.lr
+++ b/content/docs/api/db/record/exif/contents.lr
@@ -38,6 +38,8 @@ into a dictionary that can be dumped to JSON for instance.
| `latitude` | The longitude as floating point value.
| `longitude` | The longitude as floating point value.
| `altitude` | The altitude in meters as floating point value.
+| `documentname` | The image document name as a string.
+| `description` | The image description as a string.
## Example
diff --git a/content/docs/api/db/record/getitem/contents.lr b/content/docs/api/db/record/getitem/contents.lr
index 99baf1d2..5d4d3b13 100644
--- a/content/docs/api/db/record/getitem/contents.lr
+++ b/content/docs/api/db/record/getitem/contents.lr
@@ -18,5 +18,5 @@ as system fields which are prefixed by an underscore).
```python
for child in this.children:
- print 'ID: %s' % child['_id']
+ print('ID: %s' % child['_id'])
```
diff --git a/content/docs/api/plugins/events/before-build/contents.lr b/content/docs/api/plugins/events/before-build/contents.lr
index 7a3a3462..c0198664 100644
--- a/content/docs/api/plugins/events/before-build/contents.lr
+++ b/content/docs/api/plugins/events/before-build/contents.lr
@@ -31,5 +31,5 @@ in future versions.
```python
def on_before_build(self, source, prog, **extra):
- print 'building %s' % source.source_filename
+ print('building %s' % source.source_filename)
```
diff --git a/content/docs/api/plugins/events/setup-env/contents.lr b/content/docs/api/plugins/events/setup-env/contents.lr
index 6b6c0840..02d1a432 100644
--- a/content/docs/api/plugins/events/setup-env/contents.lr
+++ b/content/docs/api/plugins/events/setup-env/contents.lr
@@ -15,5 +15,5 @@ filters and global variables.
```python
def on_setup_env(self, **extra):
- env.jinja_env.globals['my_variable'] = 'my value'
+ self.env.jinja_env.globals['my_variable'] = 'my value'
```
diff --git a/content/docs/api/plugins/plugin/emit/contents.lr b/content/docs/api/plugins/plugin/emit/contents.lr
index 9df3366a..2c21c732 100644
--- a/content/docs/api/plugins/plugin/emit/contents.lr
+++ b/content/docs/api/plugins/plugin/emit/contents.lr
@@ -32,7 +32,7 @@ from lektor.pluginsystem import Plugin
class MyPlugin(Plugin):
def on_my_plugin_setup(self, foo, **extra):
- print 'got %s' % foo
+ print('got %s' % foo)
```
(This assumes the plugin id is set to `my-plugin` in `setup.py`)
diff --git a/content/docs/cli/plugins/add/contents.lr b/content/docs/cli/plugins/add/contents.lr
index c3eba5c5..8ebabb7b 100644
--- a/content/docs/cli/plugins/add/contents.lr
+++ b/content/docs/cli/plugins/add/contents.lr
@@ -10,7 +10,7 @@ body:
`lektor plugins add NAME`
-This command can add a new plugion to the project. If just given
+This command can add a new plugin to the project. If just given
the name of the plugin the latest version of that plugin is added to
the project.
diff --git a/content/docs/content/alts/contents.lr b/content/docs/content/alts/contents.lr
index b5f17b4e..167ced12 100644
--- a/content/docs/content/alts/contents.lr
+++ b/content/docs/content/alts/contents.lr
@@ -75,7 +75,7 @@ targeted, different files will be used. This table visualizes this:
## Alternatives and Paths
-Alternatives have a special behavior with regards to paths. They alternative
+Alternatives have a special behavior with regards to paths. The alternative
code does not exist in the path! This can be confusing at first, but has the
advantage that they automatically work in most places as the paths are the
same for different alternatives. For more information see
diff --git a/content/docs/deployment/ftp/contents.lr b/content/docs/deployment/ftp/contents.lr
index 18c7ea8b..55c8bc2c 100644
--- a/content/docs/deployment/ftp/contents.lr
+++ b/content/docs/deployment/ftp/contents.lr
@@ -32,7 +32,7 @@ target = ftps://myuser:mypassword@ftp.example.com/var/www/example
## Credentials
FTP is considered a largely insecure protocol for Lektor. As such if you
-want to use it you should keep your project file save as credentials will
+want to use it you should keep your project file safe as credentials will
be most likely embedded there. Alternatively you can set the credentials
via the command line with the `--username` and `--password` option (or via the
environment variables `LEKTOR_DEPLOY_USERNAME` and `LEKTOR_DEPLOY_PASSWORD`)
diff --git a/content/docs/deployment/ghpages/contents.lr b/content/docs/deployment/ghpages/contents.lr
index ef82ceb4..6c56e769 100644
--- a/content/docs/deployment/ghpages/contents.lr
+++ b/content/docs/deployment/ghpages/contents.lr
@@ -44,15 +44,18 @@ with behavior for GitHub Pages.
## CNAME Support
-If you want to use a [CNAME :ext](https://en.wikipedia.org/wiki/CNAME) with
-GitHub pages and Lektor you can provide the intended CNAME with the `?cname`
-parameter:
+If you want to use a custom domain with GitHub pages (also known as a
+[CNAME :ext](https://en.wikipedia.org/wiki/CNAME)), provide the intended
+CNAME in the target URL using the `?cname` parameter:
```ini
[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
+GitHub with every deployment.
+
For more information about how CNAMEs work with GitHub you can read about
the feature in the GitHub help center:
[Adding a CNAME file to your repository
diff --git a/content/docs/deployment/glpages/contents.lr b/content/docs/deployment/glpages/contents.lr
index 3c2ac32b..a3c5d459 100644
--- a/content/docs/deployment/glpages/contents.lr
+++ b/content/docs/deployment/glpages/contents.lr
@@ -32,7 +32,7 @@ To enable support for Lektor you need to create a `.gitlab-ci.yml` config
next to your `.lektorproject` file with the following contents:
```yaml
-image: python:2.7
+image: python:latest
pages:
script:
diff --git a/content/docs/deployment/travisci/contents.lr b/content/docs/deployment/travisci/contents.lr
index 45a6bf6a..b4c383d3 100644
--- a/content/docs/deployment/travisci/contents.lr
+++ b/content/docs/deployment/travisci/contents.lr
@@ -24,7 +24,7 @@ file into your repository. You can copy paste this over:
```yaml
language: python
-python: 2.7
+python: 3.5
install: "pip install Lektor"
script: "lektor build"
deploy:
@@ -45,7 +45,7 @@ in the project file would be to use `ghpages+https` like this:
```ini
[servers.ghpages]
-target = ghpages+https://username/repository
+target = ghpages+https://username/repository.git
```
You need to add this to your `.lektorproject` file.
@@ -115,7 +115,7 @@ caching. Adjust your `.travis.yml` file to look like this:
```yaml
language: python
-python: 2.7
+python: 3.5
cache:
directories:
- $HOME/.cache/pip
@@ -135,7 +135,7 @@ config:
```yaml
language: python
-python: 2.7
+python: 3.5
cache:
directories:
- $HOME/.cache/pip
diff --git a/content/docs/guides/disqus/contents.lr b/content/docs/guides/disqus/contents.lr
index 370b9d1d..86cd9d15 100644
--- a/content/docs/guides/disqus/contents.lr
+++ b/content/docs/guides/disqus/contents.lr
@@ -43,6 +43,6 @@ get the comment box:
{{ render_disqus_comments() }}
```
-Optionally the function accepts two arguemnts: `identifier` and
+Optionally the function accepts two arguments: `identifier` and
`url` to override the defaults. For more information have a look at
the disqus widget documentation.
diff --git a/content/docs/guides/error-pages/contents.lr b/content/docs/guides/error-pages/contents.lr
index 69d00612..7d3a4c78 100644
--- a/content/docs/guides/error-pages/contents.lr
+++ b/content/docs/guides/error-pages/contents.lr
@@ -36,7 +36,7 @@ For more information about this you can read the [Project File Documentation
## Creating an Error Page
-You can create easy create a 404 page by creating a `404.html/contents.lr`
+You can easily add a 404 page by creating a `404.html/contents.lr`
file. If you do not care much about the contents and structure of the file
you can just point it to an empty model (`none`) and manually select a
`404.html` template like this:
diff --git a/content/docs/guides/single-page/contents.lr b/content/docs/guides/single-page/contents.lr
index 912ce61d..cdc56442 100644
--- a/content/docs/guides/single-page/contents.lr
+++ b/content/docs/guides/single-page/contents.lr
@@ -93,7 +93,7 @@ _model: doc-pages
_hidden: yes
```
-This will set up our index model and our doc-pages model for the `docs/`
+This will set up our index model and our doc-pages model for the `doc/`
folder. The latter is also set to `_hidden` which will make Lektor prevent
the generation of those files: they are invisible. So we need to find other
ways to render them.
@@ -108,7 +108,7 @@ need to query for all the other pages we have below `doc/`:
{% extends "layout.html" %}
{% block title %}{{ this.title }}{% endblock %}
{% block body %}
- {% set pages = site.query('/doc').all() %}
+ {% set pages = site.query('/doc').include_undiscoverable(true).all() %}