GithubHelp home page GithubHelp logo

lektor / lektor Goto Github PK

View Code? Open in Web Editor NEW
3.8K 77.0 308.0 8.94 MB

The lektor static file content management system

Home Page: https://www.getlektor.com/

License: BSD 3-Clause "New" or "Revised" License

Makefile 0.07% CSS 0.23% HTML 2.60% Python 77.95% JavaScript 0.05% TypeScript 18.19% SCSS 0.91%
static-site-generator cms

lektor's Introduction

Lektor

Tests master Code Coverage PyPI version PyPI - Python Version Code Style: Black Join the chat at https://gitter.im/lektor/lektor

Lektor is a static website generator. It builds out an entire project from static files into many individual HTML pages and has a built-in admin UI and minimal desktop app.

To see how it works look at the top-level example/ folder, which contains a showcase of the wide variety of Lektor's features.

For a more complete example look at the lektor/lektor-website repository, which contains the sourcecode for the official lektor website.

How do I use this?

For installation instructions head to the official documentation:

Want to develop on Lektor?

This gets you started (assuming you have Python, pip, npm, and pre-commit installed):

$ git clone https://github.com/lektor/lektor
$ cd lektor
$ python -m venv _venv
$ . _venv/bin/activate

# pip>=21.3 is required for PEP 610 support
$ pip install -U "pip>=21.3"

$ pip install --editable .

# If you plan on committing:
$ pre-commit install

# Run the Lektor server
$ export LEKTOR_DEV=1
$ cp -r example example-project
$ lektor --project example-project server

If you want to run the test suite (you'll need tox installed):

$ tox

lektor's People

Contributors

ajdavis avatar arabidopsis avatar bameda avatar bancek avatar dairiki avatar davidferguson avatar eigengrau avatar eljoest avatar f-seven avatar frostming avatar georgeyk avatar goanpeca avatar item4 avatar jtraub91 avatar kentaro0919 avatar lyenliang avatar milibopp avatar mitsuhiko avatar nixjdm avatar philippbosch avatar rlaverde avatar rubenbe avatar runfalk avatar singingwolfboy avatar skorokithakis avatar tariquesani avatar tgpfeiffer avatar vanadium23 avatar xlotlu avatar yagebu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lektor's Issues

Friendly Markdown

Markdown is nice, but it's not so easy for nontechnical editors that Lektor caters to.

Embedding ProseMirror could help with this problem:

Say you have a site that allows users to enter comments, and you've decided to use Markdown for the comment input. Your target group mostly knows how to use Markdown, and finds it convenient to type. But you also have some non-technical users, for whom learning arcane syntactic rules does not come naturally.

Without changing anything in your backend, you can drop in ProseMirror as an alternative input editor. People can even switch between both views as they are editing!

http://prosemirror.net/demo_markdown.html

I hope someone will like this idea so much that I won't need to do it myself :)

request: direct link to some paginated page

for example

<a href="{{ this.pagination.url_to(1) }}">First Page</a><!-- /blog/page/1/ -->
<a href="{{ this.pagination.url_to(-1) }}">Last Page</a> <!-- /blog/page/20/ -->
<a href="{{ this.pagination.url_to(999999999999) }}">Non-existed Page - raise error</a>
<a href="{{ this.pagination.url_to('a') }}">wrong type - raise error</a>

more complexly

<a href="{{ site.query('/another_paginated_page').pagination.url_to(10) }}">/another_paginated_page/page/2/</a>
<!-- not good example. -->

Source Code Syntax Highlighting

I see that you highlight syntax in the documentation for lektor. I have copied a chunk of a template from the documentation to a blog page on a test site that I created for evaluating lektor and the same text does not get highlighted.

How can syntax highlighting be enabled on lektor?

Story for SVG Files

Currently svg files are not images largely because we did not want thumbnailing for them. If we add them to the images list we need to find a story for width/height etc.

request: exclude some files from pagination

If I have these(see below) structure and add sitemap with this guide, my list must include sitemap.xml.

  • content/contents.lr
_model: blog

  • models/blog.ini
[model]
name = Blog
label = Blog
hidden = yes

[children]
model = blog-post
order_by = -pub_date, title
slug_format = {{ this.pub_date|dateformat('YYYY-MM-dd') }}/{{ this.title }}/

[pagination]
enabled = yes
per_page = 1

How can I pop sitemap.xml or some files (like keybase proof) from pagination? (Currently I make simple sitemap build package to avoid this problem)

Relative link on markdown field does not resolved correclty

When I put ![An image](./an-image.png) on /blog/post-1, the image shows correctly on /blog/post-1. The content of post-1 is also listed on /blog, but the image is also linked to /blog/an-image.png not /blog/post-1/an-image.png.

The temporary solution at them moment is to use absolute links.

generate incorrect file name

  • /content/test.xml/contents.lr
_template: test.html

---
_model: none
  • /models/none.ini
    โ†’ empty
  • template/test.html
hello world
  • log
U index.html
U page/2/index.html
U page/3/index.html
U page/4/index.html
U 2015-12-21/Hello_Website/index.html
U 2015-12-21/Hello_Website1/index.html
U 2015-12-21/Hello_Website3/index.html
U temp-test.xml

I want to get test.xml but got temp-test.xml. How to remove it?

Give user a cue for date format in blog post create/edit

As an enhancement, giving the user a visual cue of the date format to be entered would be helpful. It took me a while to find default format in api docs. I also tried clicking on the mini-calendar thinking it would pop up a date picker.
screen shot 2015-12-27 at 1 01 14 pm

Overall, a very cool project โ˜€๏ธ

Plugin development for Lektor

[This is probably a question, not a bug. But creating the new tag lektor on stack overflow requires 1500 reputation, which I do not have as I do not use it. So I am putting this here]

I am trying to develop a reStructuredText plugin and doing some basic mistake.

My plugin object looks like this:

    class RSTPlugin(Plugin):
        name = 'RST'
        description = 'RST plugin'

        def on_setup_env(self, **extra):
            self.env.jinja_env.filters['markdown'] = \
                jinja2.contextfilter(lambda ctx, *a, **kw: RST(*a, **kw))

Now: the on_setup_env function is called. Notice that I am replacing the markdown dict entry (for now). But when I run lektor the original Markdown class is called and not my RST one.

I suspect I am doing something ridiculous here, but cannot find the problem... This might be a bug in lektor, but I suspect is more a bug in my head...

Windows platform installation issue

I'm using PowerShell to install lektor, the following is console output during installation:

PS C:\> iex ((new-object net.webclient).DownloadString('https://getlektor.com/install.ps1'))
Welcome to Lektor

This script will install Lektor on your computer.

   Installing at: C:\Users\lyenliang\AppData\Local\lektor-cli
Continue? [Yn] Y
New python executable in C:\Users\lyenliang\AppData\Local\lektor-cli\lib\Scripts\python.exe
Installing setuptools, pip, wheel...done.
Collecting Lektor
c:\users\lyenliang\appdata\local\lektor-cli\lib\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:90: I
nsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriat
ely and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/s
ecurity.html#insecureplatformwarning.
  InsecurePlatformWarning
  Using cached Lektor-1.0-py2-none-any.whl
Collecting Babel (from Lektor)
  Using cached Babel-2.1.1-py2.py3-none-any.whl
Collecting setuptools (from Lektor)
  Using cached setuptools-19.1.1-py2.py3-none-any.whl
Collecting Flask (from Lektor)
Collecting inifile (from Lektor)
  Using cached inifile-0.2-py2-none-any.whl
Collecting mistune (from Lektor)
  Using cached mistune-0.7.1-py2.py3-none-any.whl
Collecting click>=6.0 (from Lektor)
  Using cached click-6.2-py2.py3-none-any.whl
Collecting EXIFRead (from Lektor)
  Using cached ExifRead-2.1.2-py2-none-any.whl
Collecting watchdog (from Lektor)
Requirement already up-to-date: pip in c:\users\lyenliang\appdata\local\lektor-cli\lib\lib\site-packages (from Lektor)
Collecting Jinja2>=2.4 (from Lektor)
  Using cached Jinja2-2.8-py2.py3-none-any.whl
Collecting pytz>=0a (from Babel->Lektor)
  Using cached pytz-2015.7-py2.py3-none-any.whl
Collecting itsdangerous>=0.21 (from Flask->Lektor)
Collecting Werkzeug>=0.7 (from Flask->Lektor)
  Using cached Werkzeug-0.11.3-py2.py3-none-any.whl
Collecting argh>=0.24.1 (from watchdog->Lektor)
Collecting PyYAML>=3.10 (from watchdog->Lektor)
  Using cached PyYAML-3.11.tar.gz
Collecting pathtools>=0.1.1 (from watchdog->Lektor)
Collecting MarkupSafe (from Jinja2>=2.4->Lektor)
Building wheels for collected packages: PyYAML
  Running setup.py bdist_wheel for PyYAML
  Complete output from command c:\users\lyenliang\appdata\local\lektor-cli\lib\scripts\python.exe -c "import setuptools;__
file__='c:\\users\\lyenliang\\appdata\\local\\temp\\pip-build-qxh26z\\PyYAML\\setup.py';exec(compile(open(__file__).read()
.replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d c:\users\lyenliang\appdata\local\temp\tmpfdak1tpip-wheel-:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win32-2.7
  creating build\lib.win32-2.7\yaml
  copying lib\yaml\composer.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\constructor.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\cyaml.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\dumper.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\emitter.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\error.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\events.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\loader.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\nodes.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\parser.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\reader.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\representer.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\resolver.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\scanner.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\serializer.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\tokens.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\__init__.py -> build\lib.win32-2.7\yaml
  running build_ext
  creating build\temp.win32-2.7
  creating build\temp.win32-2.7\Release
  checking if libyaml is compilable
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "c:\users\lyenliang\appdata\local\temp\pip-build-qxh26z\PyYAML\setup.py", line 342, in <module>
      'test': test,
    File "C:\Python27\Lib\distutils\core.py", line 151, in setup
      dist.run_commands()
    File "C:\Python27\Lib\distutils\dist.py", line 953, in run_commands
      self.run_command(cmd)
    File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
      cmd_obj.run()
    File "c:\users\lyenliang\appdata\local\lektor-cli\lib\lib\site-packages\wheel\bdist_wheel.py", line 175, in run
      self.run_command('build')
    File "C:\Python27\Lib\distutils\cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
      cmd_obj.run()
    File "C:\Python27\Lib\distutils\command\build.py", line 127, in run
      self.run_command(cmd_name)
    File "C:\Python27\Lib\distutils\cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
      cmd_obj.run()
    File "c:\users\lyenliang\appdata\local\temp\pip-build-qxh26z\PyYAML\setup.py", line 173, in run
      log.warn(str(exc))
  UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)

  ----------------------------------------
  Failed building wheel for PyYAML
Failed to build PyYAML
Installing collected packages: pytz, Babel, setuptools, itsdangerous, Werkzeug, MarkupSafe, Jinja2, Flask, inifile, mist
une, click, EXIFRead, argh, PyYAML, pathtools, watchdog, Lektor
  Found existing installation: setuptools 18.2
    Uninstalling setuptools-18.2:
      Successfully uninstalled setuptools-18.2
  Running setup.py install for PyYAML
    Complete output from command c:\users\lyenliang\appdata\local\lektor-cli\lib\scripts\python.exe -c "import setuptools,
 tokenize;__file__='c:\\users\\lyenliang\\appdata\\local\\temp\\pip-build-qxh26z\\PyYAML\\setup.py';exec(compile(getattr(t
okenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\lyenliang\app
data\local\temp\pip-qeykkj-record\install-record.txt --single-version-externally-managed --compile --install-headers c:\
users\lyenliang\appdata\local\lektor-cli\lib\include\site\python2.7\PyYAML:
    running install
    running build
    running build_py
    running build_ext
    checking if libyaml is compilable
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\users\lyenliang\appdata\local\temp\pip-build-qxh26z\PyYAML\setup.py", line 342, in <module>
        'test': test,
      File "C:\Python27\Lib\distutils\core.py", line 151, in setup
        dist.run_commands()
      File "C:\Python27\Lib\distutils\dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
        cmd_obj.run()
      File "c:\users\lyenliang\appdata\local\lektor-cli\lib\lib\site-packages\setuptools\command\install.py", line 61, in
run
        return orig.install.run(self)
      File "C:\Python27\Lib\distutils\command\install.py", line 563, in run
        self.run_command('build')
      File "C:\Python27\Lib\distutils\cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
        cmd_obj.run()
      File "C:\Python27\Lib\distutils\command\build.py", line 127, in run
        self.run_command(cmd_name)
      File "C:\Python27\Lib\distutils\cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
        cmd_obj.run()
      File "c:\users\lyenliang\appdata\local\temp\pip-build-qxh26z\PyYAML\setup.py", line 173, in run
        log.warn(str(exc))
    UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)

    ----------------------------------------
Command "c:\users\lyenliang\appdata\local\lektor-cli\lib\scripts\python.exe -c "import setuptools, tokenize;__file__='c:\\
users\\lyenliang\\appdata\\local\\temp\\pip-build-qxh26z\\PyYAML\\setup.py';exec(compile(getattr(tokenize, 'open', open)(_
_file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\lyenliang\appdata\local\temp\pip-qeyk
kj-record\install-record.txt --single-version-externally-managed --compile --install-headers c:\users\lyenliang\appdata\lo
cal\lektor-cli\lib\include\site\python2.7\PyYAML" failed with error code 1 in c:\users\lyenliang\appdata\local\temp\pip-bu
ild-qxh26z\PyYAML
c:\users\lyenliang\appdata\local\lektor-cli\lib\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:90: I
nsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriat
ely and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/s
ecurity.html#insecureplatformwarning.
  InsecurePlatformWarning

The error UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6 seems to be a problem of PyYAML.

I wish I could view the content of c:\users\lyenliang\appdata\local\temp\pip-build-qxh26z\PyYAML\setup.py, but the file doesn't exist after the installation script.

Does anyone have an idea about how to solve this problem?

Templates: relative links to alternatives doesn't work if _slug is set

Using {{ '.'|url(alt='ru') }} as per https://www.getlektor.com/docs/templates/urls/ doesn't work correctly if a _slug was set in the contents+ALT.lr file.

For example:

  1. page /about with alternatives en (primary) and de.
  2. contents+de.lr has _slug=/bio.
  3. The link generated for {{ '.'|url(alt='de') }}is incorrectly /de/about/bio instead of /de/bio.

Workaround for now is to use {{ this._path|url(alt='de') }} instead of the relative link.

UnboundLocalError: local variable 'pieces' referenced before assignment

Hi there,

I just get this Traceback while testing Lektor.

Traceback (most recent call last):
  File "[HOME]/.local/lib/lektor/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "[HOME]/.local/lib/lektor/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "[HOME]/.local/lib/lektor/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "[HOME]/.local/lib/lektor/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "[HOME]/.local/lib/lektor/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "[HOME]/.local/lib/lektor/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "[HOME]/.local/lib/lektor/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "[HOME]/.local/lib/lektor/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "[HOME]/.local/lib/lektor/lib/python2.7/site-packages/lektor/admin/modules/serve.py", line 129, in serve_artifact
    artifact_name, filename = li.resolve_artifact('/' + path, pad)
  File "[HOME]/.local/lib/lektor/lib/python2.7/site-packages/lektor/admin/webui.py", line 47, in resolve_artifact
    source = pad.resolve_url_path(path)
  File "[HOME]/.local/lib/lektor/lib/python2.7/site-packages/lektor/db.py", line 1208, in resolve_url_path
    return self.asset_root.resolve_url_path(pieces)
UnboundLocalError: local variable 'pieces' referenced before assignment

OS: Ubuntu 15.10

I can investigate with pleasure it if you don't want to catch it right now.

Thank you @mitsuhiko ๐Ÿ˜„

Getting "not configured for a valid publishing method" with sftp deployment target

Hey there,

Was trying to have a go at doing a test deployment via sftp.
When I try through the admin gui, it fails silently with no feedback.
In fact, it says Status: publishing done.

I checked the server to see if the files were actually transferred, but no go.
So next I tried the cli:

lektor deploy production

And got this message:

Usage: lektor deploy [OPTIONS] [SERVER]

Error: Server "production" is not configured for a valid publishing method.

After some fiddling, I noticed that if I switched the url scheme to ftp:// instead of sftp://, it was recognized as a valid target for lektor deploy, but the actual deploy failed because the server is setup to only accept sftp connections.

Any ideas where I can go snooping around the code to look for a root cause?

Thanks.

A file deleted and re-created won't be built

I created a quickstart project, deleted the layout.html and re-created it, but it wasn't taken into account by the build system any more. In the browser, I simply had "TemplateNotFound: layout.html".

I had to delete the cached build.

I was expecting the file to be rebuilt so I think that's a bug :]

(note: I noticed something similar when I comment and uncomment comments in some html, which can lead to remaining problems if this breaks jinja tags).

Document _undiscoverable

The new system field _undiscoverable needs documentation. This also added these new APIs:

  • Query.include_undiscoverable
  • SourceObject.is_discoverable
  • SourceObject.is_undiscoverable

In addition it changed is_hidden a bit so the text should probably be reviewed for .children and other APIs.

lektor quickstart fails with OSError

$ lektor quickstart
Lektor Quickstart
=================

This wizard will generate a new basic project with some sensible defaults for
getting started quickly.  We jsut need to go through a few questions so that
the project is set up correctly for you.

Step 1:
| A project needs a name.  The name is primarily used for the admin UI and
| some other places to refer to your project to not get confused if multiple
| projects exist.  You can change this at any later point.
> Project Name: kk

Step 2:
| This is the path where the project will be located.  You can move a
| project around later if you do not like the path.  If you provide a
| relative path it will be relative to the working directory.
> Project Path [/home/ozn/Software/p/kk]: 

Step 3:
| Do you want to generate a basic blog module?  If you enable this the
| models for a very basic blog will be generated.
> Add Basic Blog [Y/n]: 

Step 4:
| Your name.  This is used in a few places in the default template to refer
| to in the default copyright messages.
> Author Name [ozn]: 

That's all. Create project? [Y/n] 
Traceback (most recent call last):
  File "/home/ozn/.virtualenvs/lektor/bin/lektor", line 9, in <module>
    load_entry_point('Lektor==0.96', 'console_scripts', 'lektor')()
  File "/home/ozn/.virtualenvs/lektor/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/ozn/.virtualenvs/lektor/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/ozn/.virtualenvs/lektor/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ozn/.virtualenvs/lektor/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ozn/.virtualenvs/lektor/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/ozn/.virtualenvs/lektor/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/home/ozn/.virtualenvs/lektor/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/ozn/.virtualenvs/lektor/lib/python2.7/site-packages/lektor/cli.py", line 548, in quickstart_cmd
    project_quickstart(options)
  File "/home/ozn/.virtualenvs/lektor/lib/python2.7/site-packages/lektor/quickstart.py", line 198, in project_quickstart
    }, path)
  File "/home/ozn/.virtualenvs/lektor/lib/python2.7/site-packages/lektor/quickstart.py", line 117, in run
    f.write(rv.encode('utf-8') + '\n')
  File "/usr/lib64/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/home/ozn/.virtualenvs/lektor/lib/python2.7/site-packages/lektor/quickstart.py", line 94, in make_target_directory
    os.path.join(path, filename))
OSError: [Errno 18] Invalid cross-device link

The fix is really easy.

Quick install steps fail on "No package 'libffi' found" in ubuntu 14.04 LTS

Tries and fails to find a crypto package:

  Running setup.py install for cryptography
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory
     #include <ffi.h>

More complete gist here:
https://gist.github.com/tchalvak/a230f8b759875748240d

url generation does not work from virtual sources

I'm editing lektor.com's sources, adding alternatives. In layout.html:

<a href="{{'.'|url(alt='es')}}

but that leads to a cryptic error message on build:

E blog/archives/index.html (AttributeError: 'NoneType' object has no attribute 'endswith')

When we go to blog/archives/index.html we get the stacktrace:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/lektor/builder.py", line 700, in update
    yield ctx
  File "/usr/local/lib/python2.7/dist-packages/lektor/builder.py", line 922, in build_artifact
    build_func(artifact)
  File "/home/vince/bacasable/lektorwebsite-copy/packages/blog-archive/lektor_blog_archive.py", line 139, in build_artifact
    this=self.source)
  File "/usr/local/lib/python2.7/dist-packages/lektor/builder.py", line 590, in render_template_into
    this=this, **extra)
  File "/usr/local/lib/python2.7/dist-packages/lektor/environment.py", line 466, in render_template
    return self.jinja_env.get_or_select_template(name).render(ctx)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/vince/bacasable/lektorwebsite-copy/templates/blog-archive/index.html", line 1, in top-level template code
    {% extends "blog-layout.html" %}
  File "/home/vince/bacasable/lektorwebsite-copy/templates/blog-layout.html", line 10, in top-level template code
    {% set feed_url = create_atom_feed(
  File "/home/vince/bacasable/lektorwebsite-copy/templates/layout.html", line 48, in top-level template code
    {% block footer %}
  File "/home/vince/bacasable/lektorwebsite-copy/templates/layout.html", line 63, in block "footer"
    <a href="{{'.'|url(alt='fr')}}">Franรงais</a> โ€ข
  File "/usr/local/lib/python2.7/dist-packages/lektor/environment.py", line 385, in <lambda>
    lambda ctx, *a, **kw: url_to(*a, **kw)),
  File "/usr/local/lib/python2.7/dist-packages/lektor/context.py", line 17, in url_to
    return ctx.url_to(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/lektor/context.py", line 149, in url_to
    rv = self.source.url_to(path, alt=alt, absolute=True)
  File "/usr/local/lib/python2.7/dist-packages/lektor/sourceobj.py", line 99, in url_to
    source = self.pad.get(posixpath.join(self.path, path), alt=alt)
  File "/usr/lib/python2.7/posixpath.py", line 77, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

There's a pb with the blog plugin, and a cryptic message.

Thumbnails not copied correctly

I think my attachment thumbnails are not copied at all.

models/project.ini:

[model]
name = Project
label = {{ this.name }}

[fields.cover]
label = Cover
type = select
source = record.attachments.images

templates/project.html:

{% for project in site.query('/projects') %}
  <img src="{{ project.attachments.images.get(project.cover).thumbnail(263)|url }}">
{% endfor %

Rendered html:

<img src="./projects/my-project/[email protected]">

Error at lektor build -v (more debug don't give more information):

U projects/my-project/image_1@640.jpg
  E projects/my-project/image_1@640.jpg (TypeError: argument of type 'NoneType' is not iterable)

Lektor version: 1.0

Empty slug not handled correctly.

Having an empty slug, breaks ftp deploy (maybe also other deployment methods):

$cat document.pdf.lr 
_slug:

To reproduce on the admin interface:

  1. edit a slug
  2. remove the content of the textfield again
  3. save
  4. deployment broken (see backtrace)

I saw this issue on a document attachment, but maybe it is more general. I'll dig in a bit deeper if I have some time. I suspect somewhere there is a check "if var is not None" that should be "if var".

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python2.7/site-packages/Lektor-1.1-py2.7.egg/lektor/admin/modules/api.py", line 283, in trigger_build
    builder.build_all()
  File "/usr/local/lib/python2.7/site-packages/Lektor-1.1-py2.7.egg/lektor/builder.py", line 990, in build_all
    prog, build_state = self.build(source, path_cache=path_cache)
  File "/usr/local/lib/python2.7/site-packages/Lektor-1.1-py2.7.egg/lektor/builder.py", line 964, in build
    prog.build()
  File "/usr/local/lib/python2.7/site-packages/Lektor-1.1-py2.7.egg/lektor/build_programs.py", line 95, in build
    _build(artifact, self.build_artifact)
  File "/usr/local/lib/python2.7/site-packages/Lektor-1.1-py2.7.egg/lektor/build_programs.py", line 85, in _build
    ctx = gen.build_artifact(artifact, build_func)
  File "/usr/local/lib/python2.7/site-packages/Lektor-1.1-py2.7.egg/lektor/builder.py", line 924, in build_artifact
    build_func(artifact)
  File "/usr/local/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/usr/local/lib/python2.7/site-packages/Lektor-1.1-py2.7.egg/lektor/builder.py", line 707, in update
    self.finish_update(ctx)
  File "/usr/local/lib/python2.7/site-packages/Lektor-1.1-py2.7.egg/lektor/builder.py", line 766, in finish_update
    self._commit()
  File "/usr/local/lib/python2.7/site-packages/Lektor-1.1-py2.7.egg/lektor/builder.py", line 729, in _commit
    rename(self._new_artifact_file, self.dst_filename)
OSError: [Errno 21] Is a directory

Files with edits after first 4k are not elected for FTP upload.

When creating a one-page site, updates "mysteriously" stopped working. After a bit of digging, I saw in lektor/publisher.py:407 that only the first 4k is hashed to check if an update is needed. As my changes are past this boundary, the file is never uploaded.

The most obvious fix would be to hash the entire file, but I guess the original idea was to avoid hashing very large files.

Non-ascii characters in project name raises UnicodeDecodeError

After using lektor quickstart, if you use a Project Name with non ascii characters (such as รกรก), the installation fails with:

Traceback (most recent call last):
  File "/home/jose/.virtualenvs/lektor/bin/lektor", line 11, in <module>
    sys.exit(main())
  File "/home/jose/.virtualenvs/lektor/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/jose/.virtualenvs/lektor/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/jose/.virtualenvs/lektor/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/jose/.virtualenvs/lektor/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/jose/.virtualenvs/lektor/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/jose/.virtualenvs/lektor/local/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/home/jose/.virtualenvs/lektor/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/jose/.virtualenvs/lektor/local/lib/python2.7/site-packages/lektor/cli.py", line 548, in quickstart_cmd
    project_quickstart(options)
  File "/home/jose/.virtualenvs/lektor/local/lib/python2.7/site-packages/lektor/quickstart.py", line 200, in project_quickstart
    }, path)
  File "/home/jose/.virtualenvs/lektor/local/lib/python2.7/site-packages/lektor/quickstart.py", line 119, in run
    f.write(rv.encode('utf-8') + '\n')
  File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/home/jose/.virtualenvs/lektor/local/lib/python2.7/site-packages/lektor/quickstart.py", line 96, in make_target_directory
    os.path.join(path, filename))
  File "/home/jose/.virtualenvs/lektor/lib/python2.7/posixpath.py", line 80, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)

Using non-ascii characters in any of the other fields (including Project Path) does not raise any exception.

Admin preview of root page does not always work in Firefox

This was tested on the lektor/lektor-website repository.

Ways I've discovered to reproduce this:

  1. Navigate directly to localhost/admin/root/preview, or
  2. Edit the root page, and then press save changes

How to get the root preview to work:
While previewing a subpage, click the index link in the top-left of the admin. The root preview now works. However, performing either action above breaks it again.

Related question: How do you set up development for working on the react admin interface? I tried LEKTOR_DEV=1 lektor server -f webpack but I seem to need to re-run that command every time I change a file :/

Re-Design Flow Format

The current serialization of the flow format is pretty terrible. Originally the idea was to avoid indentation based syntax for it but I'm not sure if that's a good idea. Now would be the time to fix it, so maybe people have some suggestions.

Potential idea:

my_flow_field:
  flow_block_model:
    field1: value1
    ---
    field 2:

    value 2
  flow_block_model_2:
    field1: value1
    ---
    field 2:

    aha

Story on PIP Cache

Our preferred installation is a hidden pip install via curl|sh. This sets up a virtualenv in a path and a lot of stuff is managed automatically within it. This should later also support lektor upgrade and lektor uninstall or something along those lines.

For now however we have a problem where we use the system pip cache instead of a cache within this virtualenv. This is problematic for a few reasons:

  • people that do not know about pip will be confused that we throw crap into ~/.pip
  • we get permissions wrong if people sudo install something
  • both lektor and plugin installation change depending on if stuff is cached or not but it's hard to tell for users.

What we should do is to set up a pip cache in venv/cache and then add commands to lektor to manage this cache somehow. Also upon uninstallation we should wipe all caches that are set up.

Add Expiry Support

For many situations it would be very nice if a plugin or the page itself can set up an expiry that will mark the sources dirty after a certain amount of time passed. This is for instance very useful if data is pulled in via an HTTP request.

.dmg build fails certificate validation against PyPI when using "plugins add"

"lektor plugins add" fails in the .dmg build (see also #23).

Traceback (most recent call last):
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lektor/uilink.py", line 47, in <module>
    main()
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lektor/uilink.py", line 43, in main
    main(prog_name='lektor')
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lektor/cli.py", line 441, in plugins_add_cmd
    info = add_package_to_project(project, name)
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lektor/packages.py", line 48, in add_package_to_project
    rv = urllib.urlopen('https://pypi.python.org/pypi/%s/json' % choice)
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 87, in urlopen
    return opener.open(url)
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 213, in open
    return getattr(self, name)(url)
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 443, in open_https
    h.endheaders(data)
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1049, in endheaders
    self._send_output(message_body)
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 893, in _send_output
    self.send(msg)
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 855, in send
    self.connect()
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1274, in connect
    server_hostname=server_hostname)
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 352, in wrap_socket
    _context=self)
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 579, in __init__
    self.do_handshake()
  File "/Applications/Lektor.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 808, in do_handshake
    self._sslobj.do_handshake()
IOError: [Errno socket error] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)

Make Lektor's GUI generator agnostic?

More a feature request/discussion: how hard is it to use the GUI on top of another static website generator?

I'm guessing that a lot of people already have their own generators in place but would be very happy with the admin to ease the file generation :).

Tracebacks not shown on high verbosity

Debugging errors like #30 is quite hard right now because the traceback is hidden from the user even at high verbosity. It's only show for HTML pages currently and only if shown in the browser.

Ctrl + z server make Exception happened

lektor quick start finish

That's all. Create project? [Y/n] 

start fresh server

root$ website  ls
0707  my_blog  my-website  themes
root$ website  cd 0707 
root$ 0707  ls
0707.lektorproject  assets  content  models  templates
root$ 0707  lektor server --host 0.0.0.0
 * Project path: /root/website/0707/0707.lektorproject
 * Output path: /root/.cache/lektor/builds/189bea412adc30a29326c49cc9d4d67e
Started source info update
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
Finished source info update in 0.08 sec
Started build
Finished build in 0.01 sec
Started prune
Finished prune in 0.00 sec
^Z
[1]  + 15360 suspended  lektor server --host 0.0.0.0

after ctrl + z no response here

root$ 0707  curl http://0.0.0.0:5000/
^C

bring back the job, exception report

root$ 0707  fg
[1]  + 15360 continued  lektor server --host 0.0.0.0
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 35493)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 593, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
    self.finish()
  File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
    self.wfile.close()
  File "/usr/lib/python2.7/socket.py", line 279, in close
    self.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
----------------------------------------

AsciiDoc

I see that Lektor supports Markdown and I'm wondering if it supports AsciiDoc too. It would be great if it does. AsciiDoc >> Markdown ๐Ÿ˜„

Issue to install on ubuntu 14.04

Welcome to Lektor

This script will install Lektor on your computer.

  bin: /usr/local/bin
  app: /usr/local/lib/lektor

Continue? [Yn] y
New python executable in /usr/local/lib/lektor/bin/python
Installing setuptools, pip, wheel...done.
Collecting Lektor
/usr/local/lib/lektor/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading Lektor-1.0-py2-none-any.whl (1.9MB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 1.9MB 99kB/s 
Collecting Babel (from Lektor)
  Downloading Babel-2.1.1-py2.py3-none-any.whl (3.6MB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 3.6MB 95kB/s 
Collecting setuptools (from Lektor)
  Downloading setuptools-19.1.1-py2.py3-none-any.whl (463kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 466kB 160kB/s 
Collecting Flask (from Lektor)
  Downloading Flask-0.10.1.tar.gz (544kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 544kB 108kB/s 
Collecting inifile (from Lektor)
  Downloading inifile-0.2-py2-none-any.whl
Collecting mistune (from Lektor)
  Downloading mistune-0.7.1-py2.py3-none-any.whl
Collecting click>=6.0 (from Lektor)
  Downloading click-6.2-py2.py3-none-any.whl (70kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 73kB 338kB/s 
Collecting EXIFRead (from Lektor)
  Downloading ExifRead-2.1.2-py2-none-any.whl (47kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 49kB 134kB/s 
Collecting watchdog (from Lektor)
  Downloading watchdog-0.8.3.tar.gz (83kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 86kB 122kB/s 
Requirement already up-to-date: pip in /usr/local/lib/lektor/lib/python2.7/site-packages (from Lektor)
Collecting Jinja2>=2.4 (from Lektor)
  Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 266kB 121kB/s 
Collecting pytz>=0a (from Babel->Lektor)
  Downloading pytz-2015.7-py2.py3-none-any.whl (476kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 479kB 117kB/s 
Collecting Werkzeug>=0.7 (from Flask->Lektor)
  Downloading Werkzeug-0.11.3-py2.py3-none-any.whl (305kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 307kB 915kB/s 
Collecting itsdangerous>=0.21 (from Flask->Lektor)
  Downloading itsdangerous-0.24.tar.gz (46kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 49kB 138kB/s 
Collecting PyYAML>=3.10 (from watchdog->Lektor)
  Downloading PyYAML-3.11.tar.gz (248kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 249kB 1.8MB/s 
Collecting argh>=0.24.1 (from watchdog->Lektor)
  Downloading argh-0.26.1.tar.gz
Collecting pathtools>=0.1.1 (from watchdog->Lektor)
  Downloading pathtools-0.1.2.tar.gz
Collecting MarkupSafe (from Jinja2>=2.4->Lektor)
  Downloading MarkupSafe-0.23.tar.gz
Building wheels for collected packages: Flask, watchdog, itsdangerous, PyYAML, argh, pathtools, MarkupSafe
  Running setup.py bdist_wheel for Flask
  Stored in directory: /root/.cache/pip/wheels/d2/db/61/cb9b80526b8f3ba89248ec0a29d6da1bb6013681c930fca987
  Running setup.py bdist_wheel for watchdog
  Stored in directory: /root/.cache/pip/wheels/93/93/cf/e7a7eee3227b2720bc95e96fe35562c08224814a3adfe8e447
  Running setup.py bdist_wheel for itsdangerous
  Stored in directory: /root/.cache/pip/wheels/97/c0/b8/b37c320ff57e15f993ba0ac98013eee778920b4a7b3ebae3cf
  Running setup.py bdist_wheel for PyYAML
  Complete output from command /usr/local/lib/lektor/bin/python -c "import setuptools;__file__='/tmp/pip-build-EEFbyE/PyYAML/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpS09bJzpip-wheel-:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/tokens.py -> build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/loader.py -> build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/scanner.py -> build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/reader.py -> build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/parser.py -> build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/error.py -> build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/events.py -> build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/dumper.py -> build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/serializer.py -> build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/resolver.py -> build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/cyaml.py -> build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/composer.py -> build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/nodes.py -> build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/representer.py -> build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/__init__.py -> build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/emitter.py -> build/lib.linux-x86_64-2.7/yaml
  copying lib/yaml/constructor.py -> build/lib.linux-x86_64-2.7/yaml
  running build_ext
  creating build/temp.linux-x86_64-2.7
  checking if libyaml is compilable
  x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/check_libyaml.c -o build/temp.linux-x86_64-2.7/check_libyaml.o
  checking if libyaml is linkable
  x86_64-linux-gnu-gcc -pthread build/temp.linux-x86_64-2.7/check_libyaml.o -lyaml -o build/temp.linux-x86_64-2.7/check_libyaml
  building '_yaml' extension
  creating build/temp.linux-x86_64-2.7/ext
  x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c ext/_yaml.c -o build/temp.linux-x86_64-2.7/ext/_yaml.o
  ext/_yaml.c:8:22: fatal error: pyconfig.h: No such file or directory
   #include "pyconfig.h"
                        ^
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for PyYAML
  Running setup.py bdist_wheel for argh
  Stored in directory: /root/.cache/pip/wheels/e4/96/31/ed4151f32f78e2ebec318bc7081d65077c6c1512b561d1b263
  Running setup.py bdist_wheel for pathtools
  Stored in directory: /root/.cache/pip/wheels/97/d9/56/198cec194e02660d647417d4ad60f100fffc390fb46d243be5
  Running setup.py bdist_wheel for MarkupSafe
  Stored in directory: /root/.cache/pip/wheels/94/a7/79/f79a998b64c1281cb99fa9bbd33cfc9b8b5775f438218d17a7
Successfully built Flask watchdog itsdangerous argh pathtools MarkupSafe
Failed to build PyYAML
Installing collected packages: pytz, Babel, setuptools, Werkzeug, MarkupSafe, Jinja2, itsdangerous, Flask, inifile, mistune, click, EXIFRead, PyYAML, argh, pathtools, watchdog, Lektor
  Found existing installation: setuptools 18.2
    Uninstalling setuptools-18.2:
      Successfully uninstalled setuptools-18.2
  Running setup.py install for PyYAML
    Complete output from command /usr/local/lib/lektor/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-EEFbyE/PyYAML/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-6fL1dX-record/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/lib/lektor/include/site/python2.7/PyYAML:
    running install
    running build
    running build_py
    running build_ext
    building '_yaml' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c ext/_yaml.c -o build/temp.linux-x86_64-2.7/ext/_yaml.o
    ext/_yaml.c:8:22: fatal error: pyconfig.h: No such file or directory
     #include "pyconfig.h"
                          ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/local/lib/lektor/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-EEFbyE/PyYAML/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-6fL1dX-record/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/lib/lektor/include/site/python2.7/PyYAML" failed with error code 1 in /tmp/pip-build-EEFbyE/PyYAML
/usr/local/lib/lektor/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

All done!

request: `external` option for `url` filter

for example.

Permanent URL: <a href="{{ this | url }}">{{ this | url(external=True) }}</a>

will be

Permanent URL: <a href="./test-page/">http://someone.github.io/blog/test-page/</a>

get_doc_link for the toc: once points to the good alternative page, once not.

Hey,

I copied the sources of getlektor.com and added some alternatives, in order to build a multilingual website. My problem is that the urls of the toc menu on the left always point to the default alternative, consequently with their title in the wrong language too, when the ones at the bottom of the page work correctly. The get_doc_link macro is working for the bottom of the page, is it not working for the left menu ? How can we achieve that ?

in templates/doc-page.html this macro is called once to build the toc on the left: (so the urls only go to the default alternative andt the titles are of the wrong language)

        {% set docs = site.get('/docs') %}
        {% for child in set.get('docs').children recursive %}
          <li{% if this._path == child._path %} class="active"{% endif
              %}>{{ get_doc_link(child) }}
            {% if this.is_child_of(child) %}
            <ul>{{ loop(child.children) }}</ul>
            {% endif %}
        {% endfor %}

and again when building the two-columns links at the bottom:

        {% for cols in this.children|batch(2) %}
          <div class="row">
            {% for page in cols if page %}
            <div class="col-md-6 child">
              <h4>
                {{ get_doc_icon(page) }}
                {{ get_doc_link(page) }}
              </h4>
              {% if page.summary %}
                <p class="summary">{{ page.summary }}</p>
              {% endif %}
            </div>
            {% endfor %}
          </div>
        {% endfor %}

In Website.lektorproject I defined those alternatives:

[alternatives.fr]
primary = yes
name = French
locale = fr

[alternatives.en]
name = English
locale = en_US
url_prefix = /en/

[alternatives.es]
name = Castellano
locale = es_ES
url_prefix = /es/

I tried to modify the environment before the first call, with no success.

I'm using pypi's latest (v1.0). I can point to a live example if you wish.

Thanks !

install script under virtualenv picks bad binary paths

The default script with fail when the default python is version 3.

I have started working on a version that is python agnostic (attached). But this still seems to fail when using a python distribution like anacoda, for example is installs binaries on
/home/USER/.local/
without consideration for the local environment,

install.zip

pip install works fine, BTW

document body.toc, sort_key

In getlektor.com sources, I see that the menu of the left, representing the toc of the documentation, is built with a few tricks:

      {% if this.body.toc %}

and a search of all pages, where I guess the sort_key data in a content.lr file is responsible for the ordering

title: Quickstart

---
summary: Covers how to create a very basic website project with Lektor and run it.

---
sort_key: 60

---
body:

in doc-page.html:

    {% for child in docs.children recursive %}
      <li{% if this._path == child._path %} class="active"{% endif
          %}>{{ get_doc_link(child) }}
        {% if this.is_child_of(child) %}
        <ul>{{ loop(child.children) }}</ul>
        {% endif %}
    {% endfor %}

Are sort_key, this._path, doc.children, this.body.toc all jinja features ? If not, more doc is welcome, or that's an idea for a next blog post :)

thanks !

Document Publisher API

Right now providing publishers through plugins is not supported but #25 is introducing that. So this needs documentation and a sanity check on the API.

Dev server cannot serve pagination for pages > 1

  • used command
$ lektor server -f webpack
  • content/contents.lr
_model: blog
  • blog.ini
[model]
name = Blog
label = Blog
hidden = yes

[children]
model = blog-post
order_by = -pub_date, title
slug_format = {{ this.pub_date|dateformat('YYYY-MM-dd') }}/{{ this.title }}/

[pagination]
enabled = yes
per_page = 1
  • page 1: /
  • page 2: /page/2/ (403) โ†’ /page/2/index.html (work)
  • page 3: /page/3/ (403) โ†’ /page/3/index.html (work)
  • ...

page 2, 3, ... link generated by this.pagination.next|url

I think it is bug of test server

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.