Merge branch 'master' into master

This commit is contained in:
Joseph Nix 2018-01-17 17:17:33 -06:00 committed by GitHub
commit fc4403d051
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 469 additions and 126 deletions

View File

@ -1,5 +1,5 @@
language: python language: python
python: 2.7 python: 3.5
install: install:
- "pip install -U pip" - "pip install -U pip"
- "pip install git+https://github.com/lektor/lektor#egg=Lektor" - "pip install git+https://github.com/lektor/lektor#egg=Lektor"

View File

@ -10,7 +10,7 @@ target = rsync://deploy@flow.srv.pocoo.org/srv/websites/getlektor.com/static
default = yes default = yes
[packages] [packages]
lektor-webpack-support = 0.1 lektor-webpack-support = 0.3
lektor-disqus-comments = 0.1 lektor-disqus-comments = 0.1
lektor-markdown-header-anchors = 0.1 lektor-markdown-header-anchors = 0.1
lektor-markdown-highlighter = 0.1 lektor-markdown-highlighter = 0.1

View File

@ -2,13 +2,19 @@ $InstallScript = @"
import os import os
import sys import sys
import json import json
import urllib
import tempfile import tempfile
import tarfile import tarfile
import shutil import shutil
from subprocess import Popen 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 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 import ctypes
from ctypes.wintypes import HWND, UINT, WPARAM, LPARAM, LPVOID from ctypes.wintypes import HWND, UINT, WPARAM, LPARAM, LPVOID
@ -23,15 +29,19 @@ LRESULT = LPARAM
HWND_BROADCAST = 0xFFFF HWND_BROADCAST = 0xFFFF
WM_SETTINGCHANGE = 0x1A WM_SETTINGCHANGE = 0x1A
PY2 = sys.version_info[0] == 2
if PY2:
input = raw_input
def get_confirmation(): def get_confirmation():
while 1: while 1:
input = raw_input('Continue? [Yn] ').lower().strip() user_input = input('Continue? [Yn] ').lower().strip()
if input in ('', 'y'): if user_input in ('', 'y'):
break break
elif input == 'n': elif user_input == 'n':
print print()
print 'Aborted!' print('Aborted!')
sys.exit() sys.exit()
def find_location(): def find_location():
@ -39,9 +49,9 @@ def find_location():
return install_dir, os.path.join(install_dir, LIB) return install_dir, os.path.join(install_dir, LIB)
def deletion_error(func, path, excinfo): def deletion_error(func, path, excinfo):
print 'Problem deleting {}'.format(path) print('Problem deleting {}'.format(path))
print 'Please try and delete {} manually'.format(path) print('Please try and delete {} manually'.format(path))
print 'Aborted!' print('Aborted!')
sys.exit() sys.exit()
def wipe_installation(install_dir): def wipe_installation(install_dir):
@ -49,16 +59,16 @@ def wipe_installation(install_dir):
def check_installation(install_dir): def check_installation(install_dir):
if os.path.exists(install_dir): if os.path.exists(install_dir):
print ' Lektor seems to be installed already.' print(' Lektor seems to be installed already.')
print ' Continuing will delete:' print(' Continuing will delete:')
print ' %s' % install_dir print(' %s' % install_dir)
print print()
get_confirmation() get_confirmation()
print print()
wipe_installation(install_dir) wipe_installation(install_dir)
def fail(message): def fail(message):
print 'Error: %s' % message print('Error: %s' % message)
sys.exit(1) sys.exit(1)
def add_to_path(location): def add_to_path(location):
@ -83,7 +93,7 @@ def add_to_path(location):
def install(virtualenv_url, virtualenv_filename, install_dir, lib_dir): def install(virtualenv_url, virtualenv_filename, install_dir, lib_dir):
t = tempfile.mkdtemp() t = tempfile.mkdtemp()
with open(os.path.join(t, 'virtualenv.tar.gz'), 'wb') as f: 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()) f.write(download.read())
download.close() download.close()
with tarfile.open(os.path.join(t, 'virtualenv.tar.gz'), 'r:gz') as tar: 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(): def main():
print print()
print 'Welcome to Lektor' print('Welcome to Lektor')
print print()
print 'This script will install Lektor on your computer.' print('This script will install Lektor on your computer.')
print print()
install_dir, lib_dir = find_location() install_dir, lib_dir = find_location()
check_installation(install_dir) check_installation(install_dir)
print ' Installing at:' print(' Installing at:')
print ' %s' % install_dir print(' %s' % install_dir)
print print()
get_confirmation() 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': if url['python_version'] == 'source':
virtualenv_url = url['url'] virtualenv_url = url['url']
#stripping '.tar.gz' #stripping '.tar.gz'
@ -134,8 +144,8 @@ def main():
install(virtualenv_url, virtualenv_filename, install_dir, lib_dir) install(virtualenv_url, virtualenv_filename, install_dir, lib_dir)
print print()
print 'All done!' print('All done!')
main() main()
"@ "@

View File

@ -11,25 +11,28 @@
I() { I() {
set -u set -u
if hash python2 2> /dev/null; then if ! hash python 2> /dev/null; then
PY=python2
elif hash python 2> /dev/null; then
PY=python
else
echo "Error: To use this script you need to have Python installed" echo "Error: To use this script you need to have Python installed"
exit 1 exit 1
fi fi
$PY - <<'EOF' python - <<'EOF'
if 1: if 1:
import os import os
import sys import sys
import json import json
import urllib
import tempfile import tempfile
import shutil import shutil
from subprocess import Popen 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') sys.stdin = open('/dev/tty', 'r')
@ -71,18 +74,18 @@ if 1:
def get_confirmation(): def get_confirmation():
while 1: while 1:
input = raw_input('Continue? [Yn] ').lower().strip() user_input = input('Continue? [Yn] ').lower().strip()
if input in ('', 'y'): if user_input in ('', 'y'):
break break
elif input == 'n': elif user_input == 'n':
print print()
print 'Aborted!' print('Aborted!')
sys.exit() sys.exit()
def deletion_error(func, path, excinfo): def deletion_error(func, path, excinfo):
print 'Problem deleting {}'.format(path) print('Problem deleting {}'.format(path))
print 'Please try and delete {} manually'.format(path) print('Please try and delete {} manually'.format(path))
print 'Aborted!' print('Aborted!')
sys.exit() sys.exit()
def wipe_installation(lib_dir, symlink_path): def wipe_installation(lib_dir, symlink_path):
@ -94,18 +97,18 @@ if 1:
def check_installation(lib_dir, bin_dir): def check_installation(lib_dir, bin_dir):
symlink_path = os.path.join(bin_dir, 'lektor') symlink_path = os.path.join(bin_dir, 'lektor')
if os.path.exists(lib_dir) or os.path.lexists(symlink_path): if os.path.exists(lib_dir) or os.path.lexists(symlink_path):
print ' Lektor seems to be installed already.' print(' Lektor seems to be installed already.')
print ' Continuing will delete:' print(' Continuing will delete:')
print ' %s' % lib_dir print(' %s' % lib_dir)
print ' and remove this symlink:' print(' and remove this symlink:')
print ' %s' % symlink_path print(' %s' % symlink_path)
print print()
if prompt: get_confirmation() if prompt: get_confirmation()
print print()
wipe_installation(lib_dir, symlink_path) wipe_installation(lib_dir, symlink_path)
def fail(message): def fail(message):
print 'Error: %s' % message print('Error: %s' % message)
sys.exit(1) sys.exit(1)
def install(virtualenv_url, lib_dir, bin_dir): def install(virtualenv_url, lib_dir, bin_dir):
@ -124,11 +127,11 @@ if 1:
os.path.join(bin_dir, 'lektor')) os.path.join(bin_dir, 'lektor'))
def main(): def main():
print print()
print 'Welcome to Lektor' print('Welcome to Lektor')
print print()
print 'This script will install Lektor on your computer.' print('This script will install Lektor on your computer.')
print print()
paths = find_user_paths() paths = find_user_paths()
if not paths: if not paths:
@ -141,14 +144,14 @@ if 1:
check_installation(lib_dir, bin_dir) check_installation(lib_dir, bin_dir)
print 'Installing at:' print('Installing at:')
print ' bin: %s' % bin_dir print(' bin: %s' % bin_dir)
print ' app: %s' % lib_dir print(' app: %s' % lib_dir)
print print()
if prompt: get_confirmation() 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': if url['python_version'] == 'source':
virtualenv = url['url'] virtualenv = url['url']
break break
@ -157,8 +160,8 @@ if 1:
install(virtualenv, lib_dir, bin_dir) install(virtualenv, lib_dir, bin_dir)
print print()
print 'All done!' print('All done!')
main() main()
EOF EOF

View File

@ -25,5 +25,5 @@ the return value will be `None`.
from lektor.context import get_ctx from lektor.context import get_ctx
ctx = get_ctx() ctx = get_ctx()
print 'The current source is %s' % ctx.source print('The current source is %s' % ctx.source)
``` ```

View File

@ -21,5 +21,5 @@ encounters a dependency it will invoke the passed function.
deps = set() deps = set()
with get_ctx().gather_dependencies(deps.add): with get_ctx().gather_dependencies(deps.add):
items = pad.query('/path/to/some/pages').all() items = pad.query('/path/to/some/pages').all()
print 'The dependencies are: %s' % deps print('The dependencies are: %s' % deps)
``` ```

View File

@ -6,7 +6,7 @@ type: property
--- ---
body: 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 below them. The `children` attribute provides a convenient way to access
those. It returns a [Query :ref](../../query/) object that can be used to those. It returns a [Query :ref](../../query/) object that can be used to
further filter down children. further filter down children.

View File

@ -9,7 +9,7 @@ type: class
body: body:
Records are [Source Objects :ref](../obj/) that come from the `content/` 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 a wider range of functionality compared to a standard source object but
they also provide all the functionality a regular source object does. they also provide all the functionality a regular source object does.

View File

@ -38,6 +38,8 @@ into a dictionary that can be dumped to JSON for instance.
| `latitude` | The longitude as floating point value. | `latitude` | The longitude as floating point value.
| `longitude` | The longitude as floating point value. | `longitude` | The longitude as floating point value.
| `altitude` | The altitude in meters 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 ## Example

View File

@ -18,5 +18,5 @@ as system fields which are prefixed by an underscore).
```python ```python
for child in this.children: for child in this.children:
print 'ID: %s' % child['_id'] print('ID: %s' % child['_id'])
``` ```

View File

@ -31,5 +31,5 @@ in future versions.
```python ```python
def on_before_build(self, source, prog, **extra): def on_before_build(self, source, prog, **extra):
print 'building %s' % source.source_filename print('building %s' % source.source_filename)
``` ```

View File

@ -15,5 +15,5 @@ filters and global variables.
```python ```python
def on_setup_env(self, **extra): def on_setup_env(self, **extra):
env.jinja_env.globals['my_variable'] = 'my value' self.env.jinja_env.globals['my_variable'] = 'my value'
``` ```

View File

@ -32,7 +32,7 @@ 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 print('got %s' % foo)
``` ```
(This assumes the plugin id is set to `my-plugin` in `setup.py`) (This assumes the plugin id is set to `my-plugin` in `setup.py`)

View File

@ -10,7 +10,7 @@ body:
`lektor plugins add NAME` `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 name of the plugin the latest version of that plugin is added to
the project. the project.

View File

@ -75,7 +75,7 @@ targeted, different files will be used. This table visualizes this:
## Alternatives and Paths ## 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 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 advantage that they automatically work in most places as the paths are the
same for different alternatives. For more information see same for different alternatives. For more information see

View File

@ -32,7 +32,7 @@ target = ftps://myuser:mypassword@ftp.example.com/var/www/example
## Credentials ## Credentials
FTP is considered a largely insecure protocol for Lektor. As such if you 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 be most likely embedded there. Alternatively you can set the credentials
via the command line with the `--username` and `--password` option (or via the via the command line with the `--username` and `--password` option (or via the
environment variables `LEKTOR_DEPLOY_USERNAME` and `LEKTOR_DEPLOY_PASSWORD`) environment variables `LEKTOR_DEPLOY_USERNAME` and `LEKTOR_DEPLOY_PASSWORD`)

View File

@ -44,15 +44,18 @@ with behavior for GitHub Pages.
## CNAME Support ## CNAME Support
If you want to use a [CNAME :ext](https://en.wikipedia.org/wiki/CNAME) with If you want to use a custom domain with GitHub pages (also known as a
GitHub pages and Lektor you can provide the intended CNAME with the `?cname` [CNAME :ext](https://en.wikipedia.org/wiki/CNAME)), provide the intended
parameter: CNAME in the target URL using the `?cname` parameter:
```ini ```ini
[servers.production] [servers.production]
target = ghpages://your-user/your-repository?cname=www.example.com 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 For more information about how CNAMEs work with GitHub you can read about
the feature in the GitHub help center: the feature in the GitHub help center:
[Adding a CNAME file to your repository [Adding a CNAME file to your repository

View File

@ -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: next to your `.lektorproject` file with the following contents:
```yaml ```yaml
image: python:2.7 image: python:latest
pages: pages:
script: script:

View File

@ -24,7 +24,7 @@ file into your repository. You can copy paste this over:
```yaml ```yaml
language: python language: python
python: 2.7 python: 3.5
install: "pip install Lektor" install: "pip install Lektor"
script: "lektor build" script: "lektor build"
deploy: deploy:
@ -45,7 +45,7 @@ in the project file would be to use `ghpages+https` like this:
```ini ```ini
[servers.ghpages] [servers.ghpages]
target = ghpages+https://username/repository target = ghpages+https://username/repository.git
``` ```
You need to add this to your `.lektorproject` file. You need to add this to your `.lektorproject` file.
@ -115,7 +115,7 @@ caching. Adjust your `.travis.yml` file to look like this:
```yaml ```yaml
language: python language: python
python: 2.7 python: 3.5
cache: cache:
directories: directories:
- $HOME/.cache/pip - $HOME/.cache/pip
@ -135,7 +135,7 @@ config:
```yaml ```yaml
language: python language: python
python: 2.7 python: 3.5
cache: cache:
directories: directories:
- $HOME/.cache/pip - $HOME/.cache/pip

View File

@ -43,6 +43,6 @@ get the comment box:
<div class="comments">{{ render_disqus_comments() }}</div> <div class="comments">{{ render_disqus_comments() }}</div>
``` ```
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 `url` to override the defaults. For more information have a look at
the disqus widget documentation. the disqus widget documentation.

View File

@ -36,7 +36,7 @@ For more information about this you can read the [Project File Documentation
## Creating an Error Page ## 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 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 you can just point it to an empty model (`none`) and manually select a
`404.html` template like this: `404.html` template like this:

View File

@ -93,7 +93,7 @@ _model: doc-pages
_hidden: yes _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 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 the generation of those files: they are invisible. So we need to find other
ways to render them. ways to render them.
@ -108,7 +108,7 @@ need to query for all the other pages we have below `doc/`:
{% extends "layout.html" %} {% extends "layout.html" %}
{% block title %}{{ this.title }}{% endblock %} {% block title %}{{ this.title }}{% endblock %}
{% block body %} {% block body %}
{% set pages = site.query('/doc').all() %} {% set pages = site.query('/doc').include_undiscoverable(true).all() %}
<header> <header>
<h1>{{ this.title }}</h1> <h1>{{ this.title }}</h1>
<nav> <nav>

View File

@ -34,12 +34,33 @@ Now you need to configure webpack. The plugin expects a webpack project in the
### `package.json` ### `package.json`
This file instructs `npm` which packages we will need. All we need for a This file instructs `npm` which packages we will need.
start is to create an almost empty file:
[npm-init :ext](https://docs.npmjs.com/cli/init) is a command-line tool to
interactively create a ``package.json`` file.
```
$ npm init
```
This will ask you a bunch of questions (invoke with ``--yes`` to use default
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.
```json ```json
{ {
"private": true "name": "lektor-example",
"version": "0.1.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT"
} }
``` ```
@ -86,25 +107,28 @@ module.exports = {
}, },
devtool: '#cheap-module-source-map', devtool: '#cheap-module-source-map',
resolve: { resolve: {
modulesDirectories: ['node_modules'], modules: ['node_modules'],
extensions: ['', '.js'] extensions: ['.js']
}, },
module: { module: {
loaders: [ rules: [
{ test: /\.js$/, exclude: /node_modules/, { test: /\.js$/, exclude: /node_modules/,
loader: 'babel-loader' }, loader: 'babel-loader' },
{ test: /\.scss$/, { test: /\.scss$/,
loader: ExtractTextPlugin.extract( loader: ExtractTextPlugin.extract({
'style-loader', 'css-loader!sass-loader') }, fallback: 'style-loader',
use: 'css-loader!sass-loader' } ) },
{ test: /\.css$/, { test: /\.css$/,
loader: ExtractTextPlugin.extract( loader: ExtractTextPlugin.extract({
'style-loader', 'css-loader') }, fallback: 'style-loader',
use: 'css-loader' } ) },
{ test: /\.(woff2?|ttf|eot|svg|png|jpe?g|gif)$/, { test: /\.(woff2?|ttf|eot|svg|png|jpe?g|gif)$/,
loader: 'file' } loader: 'file' }
] ]
}, },
plugins: [ plugins: [
new ExtractTextPlugin('styles.css', { new ExtractTextPlugin({
filename: 'styles.css',
allChunks: true allChunks: true
}), }),
new webpack.optimize.UglifyJsPlugin() new webpack.optimize.UglifyJsPlugin()

View File

@ -30,7 +30,7 @@ the installation is a bit more involved.
You need to make sure you have the following software installed on your computer: You need to make sure you have the following software installed on your computer:
* Python 2.7 (**not** Python 3.x, also `python-dev`, `libssl-dev` and * Python 2.7 or above (also `python-dev`, `libssl-dev` and
`libffi-dev` is required on Ubuntu) `libffi-dev` is required on Ubuntu)
`sudo apt-get install python-dev libssl-dev libffi-dev` `sudo apt-get install python-dev libssl-dev libffi-dev`
* ImageMagick (`brew install imagemagick` can get you this on OS X and `sudo apt-get install imagemagick` * ImageMagick (`brew install imagemagick` can get you this on OS X and `sudo apt-get install imagemagick`

View File

@ -36,13 +36,13 @@ label = Body
type = markdown type = markdown
``` ```
In this particular case we have a model with the id `model` (as defined by the In this particular case, we have a model with the id `page` (as defined by the
filename) and a name `Page` which will appear like that in the UI. Pages that filename) and a name `Page` which will appear like that in the UI. Pages that
use this model will use the template expression `{{ this.title }}` to be use this model will use the template expression `{{ this.title }}` to be
displayed in the UI. In this case it uses the title of the page. displayed in the UI. In this case, it uses the title of the page.
There are two fields defined: a `title` and a `body`. The former is just an There are two fields defined: a `title` and a `body`. The former is just an
unformatted string which is show larger in the UI (`size = large`) and the unformatted string which is shown larger in the UI (`size = large`) and the
latter uses markdown for rendering. This will give it a text area in the admin latter uses markdown for rendering. This will give it a text area in the admin
panel. panel.
@ -62,8 +62,8 @@ The following options are used for all types:
- `description`: an optional string that provides some description for the - `description`: an optional string that provides some description for the
field that is shown in the UI to give a bit more explanation. field that is shown in the UI to give a bit more explanation.
- `addon_label`: an optional string that is supported by all types that are - `addon_label`: an optional string that is supported by all types that are
rendered as an input field. This string is shown as a UI label on the rendered as an input field. This string is shown as an UI label on the
right side of the input field to give it more context. For instance it can right side of the input field to give it more context. For instance, it can
be used to clarify units of a field (pixel, percent etc.). be used to clarify units of a field (pixel, percent etc.).
- `width`: defines the width of the input in the admin as a fraction. For - `width`: defines the width of the input in the admin as a fraction. For
instance `1/4` sets it to a quarter of the width, `1/2` to a half etc. instance `1/4` sets it to a quarter of the width, `1/2` to a half etc.
@ -89,7 +89,7 @@ Models have the following options that can customize the model itself:
This is very useful for models that are implied through configuration. This is very useful for models that are implied through configuration.
- `protected`: if a model is set to protected then all of its instances - `protected`: if a model is set to protected then all of its instances
cannot be deleted once created. cannot be deleted once created.
- `inherits`: if you want to inherit all fields from another model then this - `inherits`: if you want to inherit all fields and model option settings from another model then this
can be set to the name of another model. can be set to the name of another model.
In addition to that, there are some configuration sections in the model file In addition to that, there are some configuration sections in the model file

View File

@ -37,13 +37,21 @@ so they might not keep pace with development on Lektor.
* [github-repos :ext](https://github.com/marksteve/lektor-github-repos): * [github-repos :ext](https://github.com/marksteve/lektor-github-repos):
fetches your GitHub repos for display in Lektor templates fetches your GitHub repos for display in Lektor templates
* [google-analytics :ext](https://github.com/kmonsoor/lektor-google-analytics): Adds `Google Analytics` support to Lektor-generated site. * [google-analytics :ext](https://github.com/kmonsoor/lektor-google-analytics): Adds `Google Analytics` support to Lektor-generated site.
* [atom :ext](https://github.com/ajdavis/lektor-atom): Generate Atom feeds for your content. * [yandex-metrica :ext](https://github.com/gagoman/lektor-yandex-metrica): Adds `Yandex Metrica` support to Lektor-generated site.
* [atom :ext](https://github.com/dwt/lektor-atom): Generate Atom feeds for your content.
* [surge :ext](https://github.com/ajdavis/lektor-surge): Publish your site to [Surge](https://surge.sh/). * [surge :ext](https://github.com/ajdavis/lektor-surge): Publish your site to [Surge](https://surge.sh/).
* [netlify :ext](https://github.com/ajdavis/lektor-netlify): Publish your site to [Netlify](https://www.netlify.com/). * [netlify :ext](https://github.com/ajdavis/lektor-netlify): Publish your site to [Netlify](https://www.netlify.com/).
* [tags :ext](https://github.com/ajdavis/lektor-tags): For each tag on site, build a list of pages with that tag. * [tags :ext](https://github.com/ajdavis/lektor-tags): For each tag on site, build a list of pages with that tag.
* [i18n :ext](https://github.com/numericube/lektor-i18n-plugin): Use GetText .PO files to translate your site **content**. * [i18n :ext](https://github.com/numericube/lektor-i18n-plugin): Use GetText .PO files to translate your site **content**.
* [htmlmin :ext](https://github.com/vesuvium/lektor-htmlmin): Automatically minifies .html files in build directory * [htmlmin :ext](https://github.com/vesuvium/lektor-htmlmin): Automatically minifies .html files in build directory
* [creative-commons :ext](https://github.com/humrochagf/lektor-creative-commons): Add Creative Commons license to your pages * [creative-commons :ext](https://github.com/humrochagf/lektor-creative-commons): Add Creative Commons license to your pages
* [nofollow :ext](https://github.com/yargies/lektor-nofollow): Easily create nofollow links in markdown
* [minify :ext](https://github.com/pietroalbini/lektor-minify): Minify changed files automatically during the build
* [asciidoc :ext](https://github.com/ajdavis/lektor-asciidoc/): Add asciidoc field type
* [shortcodes :ext](https://github.com/skorokithakis/lektor-shortcodes): A plugin allowing you to use shortcodes (something like tags) in your model fields
* [thumbnail-generator :ext](https://github.com/skorokithakis/lektor-thumbnail-generator): A plugin allowing you to generate configurable thumbnails for all your attachment images, so you can link them in your posts
* [rst :ext](https://github.com/fschulze/lektor-rst): A [reStructuredText](http://docutils.sourceforge.net) plugin
* [make :ext](https://github.com/BarnabyShearer/lektor-make): Run `make lektor` for custom build systems
! Have your own plugin and you want to see it here? Just [edit this page ! Have your own plugin and you want to see it here? Just [edit this page
on GitHub :ref](https://github.com/lektor/lektor-website/edit/master/content/docs/plugins/list/contents.lr), on GitHub :ref](https://github.com/lektor/lektor-website/edit/master/content/docs/plugins/list/contents.lr),

View File

@ -23,6 +23,25 @@ the query. For instance this iterates over all attached images of a page:
<div class="image"><img src="{{ image|url }}"></div> <div class="image"><img src="{{ image|url }}"></div>
{% endfor %} {% endfor %}
``` ```
<br/>
To access images from a different content folder, you would use:
```html+jinja
{% for image in site.get('/myfolder').attachments.images %}
<div class="image"><img src="{{ image|url }}"></div>
{% endfor %}
```
<br/>
To retrieve only a specific image or attachment with a certain name you would use
```html+jinja
{% set my_image site.get('/myfolder').attachments.get('imagenameexample.jpg') %}
<div class="image"><img src="{{ my_image|url }}"></div>
```
## Accessing Image Data ## Accessing Image Data

View File

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

16
content/docs/themes/contents.lr vendored Normal file
View File

@ -0,0 +1,16 @@
title: Themes
---
sort_key: 95
---
summary: A quick introduction into Lektor Themes.
---
body:
!!!! This is under development and isn't released yet. It should be considered
unstable and could change in the future.
Lektor provides a themes system to easily implement, reuse, and distribute themes.
This allows you to use assets, templates, models, and / or flowblocks built into the theme.
Themes are created by the Lektor community.
Lektor themes work like an extension of the project, allowing you to easily adopt features of the theme such as styles, models, or templates.

117
content/docs/themes/creating/contents.lr vendored Normal file
View File

@ -0,0 +1,117 @@
title: Creating a Theme
---
sort_key: 30
---
summary: Explains themes structure and theme.ini file.
---
body:
!!!! Not implemented yet.
You could create a basic empty theme with the following command:
```bash
$ lektor new theme <theme-name>
```
Example:
```bash
$ lektor new theme demo-theme
```
## Theme Components:
A theme could provide templates, assets, and models (also flowblocks):
```
demo-theme
├── assets
├── models
├── templates
└── flowdocks
```
## The theme_settings Variable
A `theme_settings` section in `.lektorproject` file could be used to
parametrize themes:
```ini
[theme_settings]
name = "Lektor"
github_url = "https://github.com/lektor"
```
And those settings will be accessed in templates through the config env
variable:
```jinja
{{ config.theme_settings.<variable_name> }}
```
Example:
```jinja
<a href="{{ config.theme_settings.github_url }}">Github</a>
```
will output:
```
<a href="https://github.com/lektor/lektor">Github</a>
```
## 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:
```ini
name = "Demo theme"
license = "MIT"
licenselink = "https://github.com/lektor/lektor-demo-theme/blob/master/LICENSE.md"
description = "Simple, minimal theme for Lektor "
homepage = "https://github.com/lektor/lektor-demo-theme"
tags = "simple,minimal,demo"
features = "blog"
lektor_minimum_required_version = 3.1
[author]
name = "lektor"
homepage = "http://getlektor.com/"
[original]
author = ""
homepage = ""
repo = ""
[packages]
lektor-disqus-comments = 0.2
```
The `[original]` section is only required if you are porting an existing theme.
!!!! Not implemented yet
The `lektor_minimum_required_version` is used by Lektor to check the
compatibility when installing a theme.
## Releasing a Theme
!!!! Not implemented yet
You could add a theme to Lektor community theme, open a pull request against
(lektor themes)[https://github.com/lektor/lektor-themes] adding it as a git
submodule.
You should also include an `images/` folder with a screenshot and a thumbnail:
```
demo-theme
└── images
├── thumbnail.png
└── screenshot.png
```
Themes added to this lektor-themes repository, will automatically be added to the
lektor website.

View File

@ -0,0 +1,20 @@
title: Customizing a Theme
---
sort_key: 20
---
summary: Explains how models, templates, or assets could be overrided.
---
body:
You could personalize a theme by overriding files, for example if a theme
provides a blog model in:
```
/themes/<theme>/models/blog.ini
```
You could override it by creating a blog model:
```
/models/blog.ini
```

View File

@ -0,0 +1,74 @@
title: Installing a Theme
---
sort_key: 10
---
summary: Explains how to install Lektor themes.
---
body:
For installing a theme you just need to copy it to the `themes/` folder
```
project
├── assets
├── models
├── content
...
└── themes
└── lektor-theme-nix
```
Themes are normally distributed by public Git repositories, so you could install a theme by
cloning the repo:
```bash
cd themes
git clone URL_TO_THEME_REPO
```
For example, for installing `lektor-theme-nix`:
```bash
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
a particular theme.
!!!! Not implemented yet.
You could add the `themes` variable to the `.lektorproject` file and Lektor will
search in the (community themes)[/themes] and automatically install it.
```ini
[project]
themes = lextor-theme-nix
```
## Installing Multiple Themes
Lektor also supports installing several themes. Copy them to the `themes/`
folder, and set the `themes` variable to indicate the precedence (optional).
```
project
├── assets
├── models
├── content
...
└── themes
├── lektor-theme-other-theme/
└── lektor-theme-nix/
```
```ini
[project]
themes = lextor-theme-nix, lektor-theme-other-theme
```
This will make `lektor-theme-nix`, because it's listed first, have a higher precedence.
Files present in multiple themes will be loaded from right to left, so that the first (left-most)
theme is preferred over the theme(s) to its right.
!! If you don't set the `themes` variable, all themes will be loaded, but the order
isn't preserved.

View File

@ -0,0 +1,22 @@
title: Installing Plugins with a Theme.
---
sort_key: 40
---
summary: Explains how a theme could depend or include several plugins.
---
body:
!!!! Not implemented yet.
Themes could depend on [plugins](../../plugins), and they will be loaded along
the theme.
1. You could use the `[packages]` section of the `theme.ini` to install
released packages:
```ini
[packages]
lektor-disqus-comments = 0.2
```
2. Plugins can be added to the `packages/` folder in the theme. Each plugin has
to go into a separate folder.

View File

@ -32,17 +32,17 @@ traffic a static website will stay up for longer on the same server than a
dynamic one that needs to execute code. dynamic one that needs to execute code.
Sure, there are some things you cannot do on a static website, but those are not Sure, there are some things you cannot do on a static website, but those are not
things you would not use Lektor for. For small dynamic sections, JavaScript things you would use Lektor for. For small dynamic sections, JavaScript
paired up with other services is a good solution. paired up with other services is a good solution.
<img src="static.png" alt="" class="screenshot"> <img src="static.png" alt="" class="screenshot">
## Lektor is a CMS ## Lektor is a CMS
However, Lektor also takes from content management systems like WordPress Lektor takes from content management systems like WordPress and provides a
and provides a flexible browser-based admin interface from which you can flexible browser-based admin interface from which you can edit your website's
edit your website's contents. Unlike traditional CMS solutions, however, it contents. Unlike traditional CMS solutions, however, it runs entirely on your
runs entirely on your own computer. own computer.
This means you can give a Lektor website to people that have no understanding This means you can give a Lektor website to people that have no understanding
of programming and they can still modify the content and update the website. of programming and they can still modify the content and update the website.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 569 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 KiB

View File

@ -1,9 +0,0 @@
name: A. Jesse Jiryu Davis
---
url: http://emptysqua.re
---
description:
I ported my site, with hundreds of pages, from my own overpowered dynamic framework to a static site built by Lektor and hosted on GitHub pages. I don't pay hosting fees now, and the site's prettier too.
---
cover_image: 1-blog-post.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

View File

@ -0,0 +1,9 @@
name: Eswar Malla
---
cover_image: home_page.png
---
description:
I am using lektor for my personal blog. In the process I also ported a jekyll theme(pixyll) to be used with lektor, which you can find it [here](https://github.com/eswarm/piktor) and preview [here](http://eswarm.in/piktor/). One of the primary reasons for moving to lektor for me is the admin panel provided.
---
url: http://eswarm.in

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -0,0 +1,14 @@
name: Playwarwick
---
description:
Website for Warwick, a terminal-based strategy game.
Lektor is used as templating engine and content manager, while Grunt is used
for minification and assets manipulation.
[View the Sourcecode on GitHub](https://github.com/lurebound/playwarwick)
---
url: https://playwarwick.com
---
cover_image: 1-home.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 KiB

View File

@ -0,0 +1,8 @@
name: Yargies Games
---
description:
Yargies Games is where I showcase my mobile games and blog. I knew I wanted to use a static site generator to build the site and I chose Lektor because of it's flexibility. I deploy to S3 and Cloudfront using the [lektor-s3](https://github.com/spenczar/lektor-s3) plugin. Hosting is fast, cheap and worry-free with Lektor.
---
url: http://yargies.com
---
cover_image: 1-home.png

View File

@ -60,8 +60,8 @@
<a href="https://gitter.im/lektor/lektor" title="Chat on Gitter" <a href="https://gitter.im/lektor/lektor" title="Chat on Gitter"
><i class="fa fa-comment"></i></a> ><i class="fa fa-comment"></i></a>
{%- if this.path %} {%- if this.path %}
<a href="https://github.com/lektor/lektor-website/tree/master/content{{ this.path.split('@')[0] <a href="https://github.com/lektor/lektor-website/tree/master/content{% if this.path != '/'
}}/contents.lr" title="View source for this page"><i class="fa fa-code"></i></a> %}{{ this.path.split('@')[0]}}{% endif %}/contents.lr" title="View source for this page"><i class="fa fa-code"></i></a>
{%- endif %} {%- endif %}
</div> </div>
<div class="col-sm-8"> <div class="col-sm-8">

View File

@ -31,6 +31,9 @@
<p> <p>
<small>You want your own website on here? <a <small>You want your own website on here? <a
href="https://github.com/lektor/lektor-website/tree/master/content/showcase">Fork href="https://github.com/lektor/lektor-website/tree/master/content/showcase">Fork
the Lektor Website Repository on GitHub</a> to add your own project. Make sure to the Lektor Website Repository on GitHub</a> to add your own project.
add screenshots and a description about the project.</small> Make sure to add screenshots and a description about the project.
We encourage you to add a link to your source code so that others can
learn from your example.
</small>
{% endblock %} {% endblock %}