Git Product home page Git Product logo

jinja2content's People

Contributors

avaris avatar botpub avatar daturkel avatar justinmayer avatar micahjsmith avatar yomguy avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

jinja2content's Issues

Can't install via pip

When I run pip install pelican-jinja2content I'm getting this error:

Could not find a version that satisfies the requirement pelican-jinja2content (from versions: )
No matching distribution found for pelican-jinja2content

Is this plugin publicly available?

Compatibility with Pelican Liquid Tags?

Hello!

I am relatively new working with Pelican and was hoping it would be possible to setup both pelican-jinja2content and pelican-liquid-tags.

I had my site setup and rendering properly with only the liquid tags plugin. After following the install and configuration for jinja2contnet, pelican no longer recognizes liquid-plugins tags:

...
  | Encountered unknown tag 'youtube'.
...
  | Encountered unknown tag 'img'.
...

As soon as I remove "jinja2content" from pelicanconf.PLUGINS the generation works fine again.

Pass custom variables from pelicanconf.py

So as explained in the readme in those templates that integrate jinja they are not available as this code is executed before to arrive to pelican.

Maybe it is possible to share some variables from pelican anyway?
I see that some variables are shared https://github.com/pelican-plugins/jinja2content/blob/main/pelican/plugins/jinja2content/jinja2content.py#L25 so they need to pass to jinja, maybe it is possible to create VARIABLES_FOR_JINJA or something better.

The second step is to understand if it is possible to access to stuff like articles in a way that is possible to do a loop of them in the home page, but I am not sure if a template to embed in the pages will achieve the same effect.

Possibility to skip posts or code-sections in posts

I often write blog posts that contain jinja-templating, mostly in code-sections.

The plugin will then try to parse this content , which it should not do. So I need to have a way to tell the plugin not to parse the code or post.

A simple way is to add a special string (e.g. PELICAN_NO_JINJA) into the post-content. If the plugin finds the special string, it does not parse the post at all. Here's a small patch:

diff --git a/pelican/plugins/jinja2content/jinja2content.py b/pelican/plugins/jinja2content/jinja2content.py
index 95b2064..db0c620 100644
--- a/pelican/plugins/jinja2content/jinja2content.py
+++ b/pelican/plugins/jinja2content/jinja2content.py
@@ -47,7 +47,8 @@ class JinjaContentMixin:

     def read(self, source_path):
         with pelican_open(source_path) as text:
-            text = self.env.from_string(text).render()
+            if "<!-- PELICAN_NO_JINJA -->" not in text:
+                text = self.env.from_string(text).render()

         with NamedTemporaryFile(delete=False) as f:
             f.write(text.encode())

A better way would probably to use this special string as a start and end marker where the text in between would not be parsed.

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.