Skip to content
/ pyg Public

Writing HTML with a better syntax using plain Python

License

Notifications You must be signed in to change notification settings

ccharly/pyg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A pythonic alternative to write HTML (highly inspired from pug.js) using only plain Python.

Why pyg?

HTML is painful to write. Python is powerful, easy and fun to write. How about combining them then to get something cool for writing HTML? This is what pyg tries to achieve by not re-creating (yet) another language.

What does it look like?

## That's a basic view.. This should be named `view.py`
from pyg import *

with div('#div-id.div-class.and.another-class'): # A block element
    +span["How wonderful is pyg isn't it?"]      # An inline element

You can either use python interpreter to pretty-print the HTML or you can use the pyg script like so:

python view.py
# or
pyg view.py

This gives us the following output:

<div id="div-id" class="div-class and another-class">
  <span>How wonderful is pyg isn't it?</span>
</div>

About

Writing HTML with a better syntax using plain Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages