Skip to main content

Sierra is a skeletal micro templating library for web frameworks in Python

Project description

sierra

sierra logo

Sierra is a Python3 templating library for web frameworks

Sierra makes skeletal integration with Flask easier and faster! See the examples below.

Downloads Downloads


Documentation

Check out the documentation of Sierra.

Check out a comprehensive example of its use.


Sierra

Sierra can also be used standalone without Flask, if you like

from sierra import *

title('The title goes here')
head('Sierra!', type='h2', color="#0388fc")
openBody()

with open_tag('newTag') as t:
    with div('someClass') as d:
        p('Some text')
        d.css(background_color='rgb(211, 111, 121)')
        with section('anotherClass', "id='some_id'"):
            with bullets(ul=True, points=['pt1', 'pt2']):
                pass
            p('THIS IS SO EASY! Lesser code and more productivity!')
            
    with image(src='sierra.jpg'):
        i.show()
        i.css(opacity=1.2)
            
autoPrettify() 
        

Using this with Flask makes life easier if you're developing web applications with just HTML and CSS. Adding JS is not supported by Sierra and has to be done manually, if desired

from flask import Flask, render_template
from sierra import *

app = Flask(__name__)

def the_template():
    title('bulleted_and_description_lists')
    head('this is a bulleted list')
    
def bulleted_list():
    the_template()
    with bullets(ul=True, points=['This', 'is', 'easy', 'stuff!']):
        pass
    autoPrettify()
    write_to_template('index1.html')

def description_list():
    the_template()
    a = [[['coffee', 'tea'], ['black coffee', 'black tea']], [['new_coffee'], ['foo', 'tea', 'green_tea']]]
    def_lists(a)
    autoPrettify()
    write_to_template('index2.html')

@app.route("/bulleted_list")
def show_bulleted_list():
    bulleted_list()
    return render_template('index1.html')
    

@app.route("/description_list")
def show_description_list():
    description_list()
    return render_template('index2.html')
    
if __name__ == '__main__':
    app.run()

Of course, you can also define the functions in separate files and import it

The directory structure needs to be sorted out first before running this. Run the code outside of templates/.

See the documentation for more!


Installation

To download the library (PyPi Version):

pip install sierra

To download the library (GitHub Version):

pip git+git://github.com/BrainStormYourWayIn/sierra

Upgrade

Use to upgrade the library:

pip install --upgrade sierra

Upcoming

We're working on making this a templating library for web frameworks. The next release will have major revamps to both the syntax and the working, including efficient handling of closing and opening tags, using div section and p tags, and addition of attributes to HTML tags among others


License

Copyright 2021 BrainStormYourWayIn

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Pandas (pandas)

Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team.

Copyright (c) 2011-2020, Open source contributors.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sierra-2.0.0.tar.gz (28.9 kB view hashes)

Uploaded Source

Built Distribution

sierra-2.0.0-py3-none-any.whl (16.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page