Giter Club home page Giter Club logo

coltrane's People

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

Watchers

 avatar  avatar  avatar

coltrane's Issues

Support tags, keywords

Look through https://gohugo.io/content-management/front-matter/ and see what makes sense (and is easy) to support.

Some of these might not need explicit support, but could just be added to documentation.

After skimming the list:

  • date (parsed to datetime, could be used by url?)
  • draft (parsed to bool, respected by output command?)
  • tags (parsed into list of strings) (there is also categories, but it seems duplicative to me?)
  • keywords (parsed into list of strings)
  • publishDate (parsed in datetime, respected by output command)
  • slug (overrides file name slug)
  • description

Change output directory

GitLab Pages require output directory to be called public. It would be amazing if coltrane could support this. What do you think? Should I draft a PR?

Screenshot 2022-01-25 at 23 15 12

`--threads` option for record/build

It'd be nice to give an option so that the number of threads used could be tweaked if needed. If it's 1, should it just use the single-threaded code path?

where to put the templatetags directory

Hi @adamghill, hope you are doing great.

I'm trying to register custom template tags and I have no idea where to put the templatetags directory, I tried to put in the directory configure as my BASE_DIR but I'm getting this:

django.template.exceptions.TemplateSyntaxError: Invalid filter: 'test'

I tried with the test filter from the docs.

InvalidTemplateLibrary when running coltrane build in example_standalone

I'm not sure where this is coming from, but it seems to be related to loading template tags from the templatetags directory.

โฏ coltrane build
Module  templatetags.__init__ does not have a variable named 'register'
Traceback (most recent call last):
  File "/Users/tobi/Library/Caches/pypoetry/virtualenvs/coltrane-nNxGrMSQ-py3.10/lib/python3.10/site-packages/django/template/library.py", line 324, in import_library
    return module.register
AttributeError: module 'templatetags.__init__' has no attribute 'register'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/tobi/Builds/coltrane/coltrane/__init__.py", line 101, in _get_default_template_settings
    module_name = _get_template_tag_module_name(
  File "/Users/tobi/Builds/coltrane/coltrane/__init__.py", line 83, in _get_template_tag_module_name
    import_library(module_name)
  File "/Users/tobi/Library/Caches/pypoetry/virtualenvs/coltrane-nNxGrMSQ-py3.10/lib/python3.10/site-packages/django/template/library.py", line 326, in import_library
    raise InvalidTemplateLibrary(
django.template.library.InvalidTemplateLibrary: Module  templatetags.__init__ does not have a variable named 'register'

Start generating the static site...

โœ” Use output directory of /Users/tobi/Builds/coltrane/example_standalone/output
โœ” Load manifest
โœ” Copy 0 static files, 2 unmodified
โœ” Create 1 HTML files, 1 unmodified, 0 updated
โœ” Update sitemap.xml
โœ” Update rss.xml
โœ” Update output.json manifest

Static site output completed in 0.6806s

the culprit

def _get_template_tag_module_name(base_dir: Path, file: Path) -> str:
    """
    Get a dot notation module name if a particular file path is a template tag.
    """

    # TODO: Cleaner way to convert a string path to a module dot notation?
    module_name = str(file)

    if str(base_dir) != ".":
        module_name = module_name.replace(str(base_dir), "")

    module_name = module_name.replace("/", ".")

    if module_name.startswith("."):
        module_name = module_name[1:]

    if module_name.endswith(".py"):
        module_name = module_name[:-3]
    else:
        raise InvalidTemplateLibrary()

    import_library(module_name)

    return module_name

Building the static site works well except for this small error, already fixed in my fork but perhaps it was intentional?

โœ” Use output directory of /Users/tobi/Builds/coltrane/example_standalone/output
โœ” Load manifest
โœ” Copy 2 static files
โœ” Create 2 HTML files, 0 unmodified, 0 updated
โœ” Update sitemap.xml
โœ” Update rss.xml
โœ” Update output.json manifest
โœ– Rendering /Users/tobi/Builds/coltrane/example_standalone/content/index.md failed. 'debug' does not exist in template context. Available top level variables: False, None, STATIC_URL, True, csrf_token, data, h1, now, number, numbers, request, slug, template, test_string, toc

just a debug variable missing in the context, I add it in the frontmatter to fix the error

Escape django template tags in markdown code blocks

Hi there, I'm getting a TemplateSyntaxError when I'm trying to use Django template tags in a code block in a markdown file, e.g.

```html
<!-- templates/home.html -->
{% extends 'base.html' %}
~```

Any ideas how I could escape the Django template tag, but still display the correct syntax in the resulting html file?

"Theme" support

I'm thinking this could just be a defined directory structure for templates + static assets?

Server error 500

Hi, hope you are doing great, I really like the idea behind this package, always wanted a static site generator with django. I try to integrate coltrane to a simple django project (the project was generated with adamchainz simple-core template). The project is really simple, there is no custom code, I created the content directory at the root and add two simple markdown files (index.md and simple-text.md), when I try to visit the corresponding urls I get a 500 error (nothing in the console to help), coltrane seems to be working though, when I visit a non existent route I get a 404. The project code is here, I would love if you could help me solve this issue. Thanks

Base path setting

Hello, thanks for making this, I find Coltrane very useful in my current project.

I have an issue with the assumptions Coltrane makes about paths. I saved the *.md files in the myrepo/coltrane subfolder and have no problem serving it on the urls I want. But I also have a myrepo/data subfolder that contains non-related .json files. It appears that retriever.py on line 44 is reading in all json files in myrepo/data and all its subfolders. I randomly had a few empty json files there and coltrane crashed on loading with a "JSONDecodeError".

It would be nice to be have the ability in settings.py to overwrite the defaults that currently use settings.BASE_DIR / 'data' and settings.BASE_DIR / 'content'.

Maybe you could also catch the error when reading an empty json file.

COLTRANE_CONTENT_DIRECTORY setting doesn't work

Hi there! ๐Ÿ‘‹๏ธ

I set COLTRANE_CONTENT_DIRECTORY to a different value (in my case, help_content) and doing this doesn't change anything. Changing the environment variable to a non-existent directory does nothing, it still reads from content, and renaming the content directory, no matter what the environment variable is set to, makes things crash.

Wanted to make sure and file this bug. If I find time later, I might take a crack at fixing it myself. ๐Ÿ”ง๏ธ

Update install instructions to replace deprecated Poetry installer (Static Site and Standalone)

The install instructions for static and standalone sites both ask the user to execute curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -, but this installer is deprecated and will be removed 'on or after January 2023.' The new suggested installation is curl -sSL https://install.python-poetry.org | python3 -.

On WSL (Windows Subsystem for Linux) using Ubuntu, running that I received the output:

To get started you need Poetry's bin directory (/home/acmshar/.local/bin) in your PATH
environment variable.

Add export PATH="/home/acmshar/.local/bin:$PATH" to your shell configuration file.

Alternatively, you can call Poetry explicitly with /home/acmshar/.local/bin/poetry.

It might be worth adding a note in the new instructions to follow the directions from that output so that new users know to look for it.

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.