Coder Social home page Coder Social logo

emmett-framework / renoir Goto Github PK

View Code? Open in Web Editor NEW
32.0 32.0 3.0 109 KB

A templating engine designed with simplicity in mind

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

Python 98.42% HTML 1.58%
python renoir template-engine templates

renoir's People

Contributors

dependabot[bot] avatar gi0baro avatar remcoboerma 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

Watchers

 avatar  avatar  avatar  avatar  avatar

renoir's Issues

Template inheritance - example from doc

I'm getting to know the project, it looks interesting. I checked one of the examples from the documentation and it didn't work as I expected. the word "Index" was not included in the title. Something is wrong or I don't understand the idea.

https://github.com/emmett-framework/renoir/blob/master/docs/quickstart.md
Template inheritance
output:

<html lang="en">
<head>
    <link rel="stylesheet" href="style.css" />
    <title> - My Webpage</title>
    <style type="text/css">
        .title { color: #336699; }
    </style>
</head>
<body>
    <div id="content">

Index

<h1>Index</h1>
<p class="title">
    Welcome to my awesome homepage.
</p>

    </div>
    <div id="footer">
        Copyright 2020 by you.
    </div>
</body>
</html>

How to output HTML from a function in a template

Hi

what is the Renoir syntax to output an unescaped HTML string created by a function in a template?
If I have {{=f()}} in the template then I get an escaped string e.g.
<div class="some-class" ...
obviously I want

Thanks.

asis not defined

I want to use a string that contains html and use it unescaped in my template.

I thought I could use asis inside renoir for it but it does not work:

Template:

<title>My Webpage</title> {{ =asis(message) }}

error:

File "/Users/kkeller/Development/websaw_upytl/websaw/example.html", line 6, in template
{{ =asis(message) }}
NameError: name 'asis' is not defined

Could you help me?

Thanks!

Include in Try/Except Block Breaks Renoir

If an include block is used inside a try / except or if / then / else logic it breaks renoir.

Please refer to this discussion for regarding the use case:

emmett-framework/emmett#387

Example template code:

<div class="columns">
      [[try:]]
        [[if level == 'manager':]]
          [[include 'manager_menu.html']]
          <div class="column is-10">
            <div class="box">
                [[include]]
            </div>
          </div>

        [[elif level == "admin":]]
          [[include 'admin_menu.html']]
          <div class="column is-10">
            <div class="box">
              [[include]]
            </div>
          </div>

        [[else:]]
        <div class="column is-12">
          [[include]]
        </div>
        [[pass]]
      [[except:]]
          <div class="column is-12">
            [[include]]
          </div>
      [[pass]]

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.