Coder Social home page Coder Social logo

lettersmith_py's People

Contributors

gordonbrander 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

lettersmith_py's Issues

Dependency on rsync not advertised

Installing the package locally (through pip as an editable package as proposed in the docs) fails with the following traceback:

~/Projects/lettersmith_py master (env) % lettersmith_scaffold foo --type wiki
Traceback (most recent call last):
  File "/home/benoit/Projects/lettersmith_py/env/bin/lettersmith_scaffold", line 11, in <module>
    load_entry_point('lettersmith', 'console_scripts', 'lettersmith_scaffold')()
  File "/home/benoit/Projects/lettersmith_py/lettersmith/bin/scaffold.py", line 30, in main
    copy(scaffold_path, project_path, content=True)
  File "/home/benoit/Projects/lettersmith_py/lettersmith/file.py", line 46, in copy
    recursive=recursive, content=content)
  File "/home/benoit/Projects/lettersmith_py/lettersmith/file.py", line 29, in _copy_dir
    return subprocess.check_call(cmd)
  File "/usr/lib/python3.7/subprocess.py", line 323, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python3.7/subprocess.py", line 304, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.7/subprocess.py", line 756, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1499, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'rsync': 'rsync'

Dependency on rsync should be advertised and explained.

Thank you!!

This isn't really an issue, just a note left to say thank you for putting lettersmith_py out there.

I picked it up while trying to make a static site for my Obsidian notes. I've made two now, and I'm enjoying learning new things every time I look at your code. Esp. w.r.t. functional programming -- lenses are a neat way to think about the problem of mutating data structures using functions!

Anyways, please feel free to close the issue whenever. Nothing biggie. Just wanted to say hi and say thanks. ๐Ÿ˜„.

Enjoy the Christmas/New Year season!

Problem with backlinks in compiling wiki

I get the following stacktrace when running lettersmith_site lettersmith.yaml (generated via lettersmith_scaffold . --type wiki)

I'm running Python 3.5.2 on Ubuntu 16.04

Traceback (most recent call last):
  File "/usr/local/bin/lettersmith_site", line 9, in <module>
    load_entry_point('lettersmith', 'console_scripts', 'lettersmith_site')()
  File "/var/www/html/lettersmith_py/lettersmith/bin/site.py", line 155, in main
    stats = Docs.write(docs, output_path=output_path)
  File "/var/www/html/lettersmith_py/lettersmith/docs.py", line 23, in write
    for doc in docs:
  File "/var/www/html/lettersmith_py/lettersmith/bin/site.py", line 153, in <genexpr>
    docs = (render_jinja(doc) for doc in docs)
  File "/var/www/html/lettersmith_py/lettersmith/jinjatools.py", line 134, in render_doc
    rendered = template.render({"doc": doc})
  File "/usr/local/lib/python3.5/dist-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python3.5/dist-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.5/dist-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "theme/wiki/single.html", line 1, in top-level template code
    {% extends "_layout.html" %}
  File "theme/wiki/_layout.html", line 1, in top-level template code
    {% extends "_base.html" %}
  File "theme/wiki/_base.html", line 25, in top-level template code
    {% block body %}{% endblock %}
  File "theme/wiki/_layout.html", line 6, in block "body"
    {% block main %}
  File "theme/wiki/single.html", line 11, in block "main"
    {% if index.backlink[doc.id_path] | len %}
  File "/usr/local/lib/python3.5/dist-packages/jinja2/environment.py", line 411, in getitem
    return obj[argument]
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'backlink'

Jinja error: no filter named 'where_not'

Following the docs, running lettersmith_site lettersmith.yaml does not work.

It appears that the theme installed from the scaffolding uses where_not("id_path", id_path) which does not exist.

Traceback (most recent call last):
  File "/home/benoit/Projects/lettersmith_py/env/bin/lettersmith_site", line 11, in <module>
    load_entry_point('lettersmith', 'console_scripts', 'lettersmith_site')()
  File "/home/benoit/Projects/lettersmith_py/lettersmith/bin/site.py", line 158, in main
    stats = Docs.write(docs, output_path=output_path)
  File "/home/benoit/Projects/lettersmith_py/lettersmith/docs.py", line 23, in write
    for doc in docs:
  File "/home/benoit/Projects/lettersmith_py/lettersmith/bin/site.py", line 156, in <genexpr>
    docs = (render_jinja(doc) for doc in docs)
  File "/home/benoit/Projects/lettersmith_py/lettersmith/jinjatools.py", line 123, in render_doc
    template = env.select_template(doc.templates)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/environment.py", line 854, in select_template
    return self._load_template(name, globals)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/environment.py", line 804, in _load_template
    template = self.loader.load(self, name, globals)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/loaders.py", line 125, in load
    code = environment.compile(source, name, filename)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/environment.py", line 591, in compile
    self.handle_exception(exc_info, source_hint=source_hint)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "theme/wiki/all.html", line 14, in template
    {% for li in index.values() | remove_index | where_not("id_path", id_path) | sort_by("title") %}
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/environment.py", line 543, in _generate
    optimized=self.optimized)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/compiler.py", line 82, in generate
    generator.visit(node)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/visitor.py", line 38, in visit
    return f(node, *args, **kwargs)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/compiler.py", line 799, in visit_Template
    self.blockvisit(block.body, block_frame)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/compiler.py", line 378, in blockvisit
    self.visit(node, frame)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/visitor.py", line 38, in visit
    return f(node, *args, **kwargs)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/compiler.py", line 1108, in visit_For
    self.visit(node.iter, frame)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/visitor.py", line 38, in visit
    return f(node, *args, **kwargs)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/compiler.py", line 70, in new_func
    return f(self, node, frame, **kwargs)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/compiler.py", line 1589, in visit_Filter
    self.visit(node.node, frame)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/visitor.py", line 38, in visit
    return f(node, *args, **kwargs)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/compiler.py", line 70, in new_func
    return f(self, node, frame, **kwargs)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/compiler.py", line 1578, in visit_Filter
    self.fail('no filter named %r' % node.name, node.lineno)
  File "/home/benoit/Projects/lettersmith_py/env/lib/python3.7/site-packages/jinja2/compiler.py", line 315, in fail
    raise TemplateAssertionError(msg, lineno, self.name, self.filename)
jinja2.exceptions.TemplateAssertionError: no filter named 'where_not'

GFM re-hrefs the href

Clumsy title but bear with me.

Using the 'blog' scaffold, you run the docs through wikidoc.py content_markdown(), which first (because compose() runs right-to-left) makes wikilinks, and then converts markdown to HTML (using GFM). But because you have already made your wikilinks nicely formatted in HTML, GFM ends up re-hrefing your href, for example:

from markdown import markdown as md
from mdx_gfm import GithubFlavoredMarkdownExtension
string = 'Here comes a link <a href="https://example.org" class="wikilink">link text</a>'
md(string, extensions=(GithubFlavoredMarkdownExtension(), ))
>>>'<p>Here comes a link <a href="<a href="https://example.org">https://example.org</a>" class="wikilink">link text</a></p>'

However this doesn't happen on transclude links:

string = '<aside>Here comes a link <a href="https://example.org" class="wikilink">link text</a></aside>'
md(string, extensions=(GithubFlavoredMarkdownExtension(), ))
>>>'<aside>Here comes a link <a href="https://example.org" class="wikilink">link text</a></aside>'

Fresh wiki compilation error

lettersmith_site lettersmith.yaml
Traceback (most recent call last):
  File "/Users/user/.local/share/virtualenvs/pyenv-kdlYh41C/bin/lettersmith_site", line 11, in <module>
    load_entry_point('lettersmith', 'console_scripts', 'lettersmith_site')()
  File "/Users/user/src/lettersmith_py/lettersmith/bin/site.py", line 162, in main
    stats = Docs.write(docs, output_path=output_path)
  File "/Users/user/src/lettersmith_py/lettersmith/docs.py", line 23, in write
    for doc in docs:
  File "/Users/user/src/lettersmith_py/lettersmith/bin/site.py", line 160, in <genexpr>
    docs = (render_jinja(doc) for doc in docs)
  File "/Users/user/src/lettersmith_py/lettersmith/jinjatools.py", line 129, in render_doc
    rendered = template.render({"doc": doc})
  File "/Users/user/.local/share/virtualenvs/pyenv-kdlYh41C/lib/python3.7/site-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/Users/user/.local/share/virtualenvs/pyenv-kdlYh41C/lib/python3.7/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/Users/user/.local/share/virtualenvs/pyenv-kdlYh41C/lib/python3.7/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/user/.local/share/virtualenvs/pyenv-kdlYh41C/lib/python3.7/site-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "theme/wiki/single.html", line 1, in top-level template code
    {% extends "_layout.html" %}
  File "theme/wiki/_layout.html", line 1, in top-level template code
    {% extends "_base.html" %}
  File "theme/wiki/_base.html", line 29, in top-level template code
    {% block body %}{% endblock %}
  File "theme/wiki/_layout.html", line 6, in block "body"
    {% block main %}
  File "theme/wiki/single.html", line 15, in block "main"
    {% for li in backlink_index[id_path] | islice(100) %}
  File "/Users/user/.local/share/virtualenvs/pyenv-kdlYh41C/lib/python3.7/site-packages/jinja2/environment.py", line 411, in getitem
    return obj[argument]
jinja2.exceptions.UndefinedError: 'backlink_index' is undefined

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.