puppygirl-py/README.md

876 B

puppygirl

an easy to train html templating system

usage

<!-- index.html -->
 <!DOCTYPE html>
 <html lang="en">
    <head>
      <template id="pg-template">
        <slot></slot>
      </template>
    </head>
    <body>
      <puppygirl-domme template="pg-template">
        <p>rawerf :3</p>
      </puppgirl-domme>
    </body>
  </html>

cli

usage: puppygirl build [-h] [-p] INPUT OUTPUT

positional arguments:
  INPUT
  OUTPUT

options:
  -h, --help    show this help message and exit
  -p, --pretty
$ puppygirl build --pretty index.html dist/index.html

programmatically

pg = Puppygirl(
  renderer=ServerSideRenderer(),
  elements=[PuppygirlDomme]
)

# parsed using the above config
parsed = pg.fetch("index.html")

using open("dist/index.html", "w") as f:
  f.write(parsed.prettify()) # parsed is a beautifulsoup4 object