Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submenus break on (stock) Jinja themes #1327

Closed
tritium21 opened this issue Jun 12, 2014 · 2 comments
Closed

Submenus break on (stock) Jinja themes #1327

tritium21 opened this issue Jun 12, 2014 · 2 comments
Assignees
Milestone

Comments

@tritium21
Copy link
Contributor

Steps to show submenus work with mako themes:

nikola init foo
cd foo
vim conf.py and change:

NAVIGATION_LINKS = {
    DEFAULT_LANG: (
        ("/archive.html", "Archive"),
        ("/categories/index.html", "Tags"),
        ("/rss.xml", "RSS feed"),
        (
            (('http://www.example.org/', 'Example'), ),
            'Menu'
        )
    ),
}

nikola build

This should work just fine.

nikola install_theme bootstrap3-jinja
vim conf.py and change THEME='bootstrap3-jinja'
nikola build

this should give a nice little traceback:

Scanning posts....done!
... omitted copy_assets ...
.  render_indexes:output/index.html
########################################
TaskError - taskid:render_indexes:output/index.html
PythonAction Error
Traceback (most recent call last):
  File "/home/tritium/.virtualenvs/site/local/lib/python2.7/site-packages/doit/action.py", line 360, in execute
    returned_value = self.py_callable(*self.args, **kwargs)
  File "/home/tritium/.virtualenvs/site/local/lib/python2.7/site-packages/nikola/nikola.py", line 769, in render_template
    template_name, None, local_context)
  File "/home/tritium/.virtualenvs/site/local/lib/python2.7/site-packages/nikola/plugins/template/jinja.py", line 88, in render_template
    output = template.render(**context)
  File "/home/tritium/.virtualenvs/site/local/lib/python2.7/site-packages/jinja2/environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "/home/tritium/.virtualenvs/site/local/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/tritium/.virtualenvs/site/local/lib/python2.7/site-packages/nikola/data/themes/base-jinja/templates/index.tmpl", line 4, in top-level template code
    {% extends 'base.tmpl' %}
  File "themes/bootstrap3-jinja/templates/base.tmpl", line 36, in top-level template code
    {{ base.html_navigation_links() }}
  File "themes/bootstrap3-jinja/templates/base_helper.tmpl", line 129, in template
    {% if rel_link(permalink, url) == "#" %}
  File "/home/tritium/.virtualenvs/site/local/lib/python2.7/site-packages/nikola/nikola.py", line 1056, in rel_link
    dst = urljoin(src, dst)
  File "/usr/lib/python2.7/urlparse.py", line 253, in urljoin
    urlparse(url, bscheme, allow_fragments)
  File "/usr/lib/python2.7/urlparse.py", line 135, in urlparse
    tuple = urlsplit(url, scheme, allow_fragments)
  File "/usr/lib/python2.7/urlparse.py", line 174, in urlsplit
    i = url.find(':')
AttributeError: 'tuple' object has no attribute 'find'

I assume that the jinja version of the template does not even attempt to render submenus where the mako one does.

@Kwpolska
Copy link
Member

The Jinja versions are usually autogenerated from the Mako versions. This needs investigating.

@Kwpolska
Copy link
Member

Here’s the deal:

--- mako ---
[2014-06-12T14:51:14Z] WARNING: Nikola: rel_link with /index.html and http://www.example.org/

--- jinja ---
[2014-06-12T14:51:31Z] WARNING: Nikola: rel_link with /galleries/index.html and ((u'http://www.example.org/', u'Example'),)

Fix should be out in a while.

@Kwpolska Kwpolska added the bug label Jun 12, 2014
@Kwpolska Kwpolska added this to the v7.0.2 milestone Jun 12, 2014
@Kwpolska Kwpolska self-assigned this Jun 12, 2014
Kwpolska added a commit that referenced this issue Jun 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants