Skip to main content

Html template renderer

Project description

HTMLTemplateRender

  • Rendering html file with variables into text

Installation

  • Install Package Using pip
    python3 pip install HTMLTemplateRender
    

How to use:

  • HTML File (test.html) Use {{ variable }} to assign value

     <!DOCTYPE html>
     <html lang="en">
     <head>
         <meta charset="UTF-8">
         <title>Test</title>
     </head>
     <body>
         <h1>Hey there {{ username }}</h1>
         <h2>It's {{ day_name }}</h2>
     </body>
     </html>
    
    • Lets Render the file
    from HTMLTemplateRender.renderer import render_template
    
    context = {
        'username': 'Anonymous',
        'day_name': 'Sunday'
    }
    
    result = render_template(template_path='test.html', context=context)
    print(result)
    
  • Output

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Test</title>
    </head>
    <body>
        <h1>Hey there Anonymous</h1>
        <h2>It's Sunday</h2>
    </body>
    </html>
    
    Process finished with exit code 0
    

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

HTMLTemplateRender-1.0.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

HTMLTemplateRender-1.0.1-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file HTMLTemplateRender-1.0.1.tar.gz.

File metadata

  • Download URL: HTMLTemplateRender-1.0.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for HTMLTemplateRender-1.0.1.tar.gz
Algorithm Hash digest
SHA256 81c0ae6f9af11eb71d9dfcfff2d6c9b950a524e658248af0a587a32ba76f7fcb
MD5 f74ad214a7d604d407997779987a76fe
BLAKE2b-256 8de2d1c1752c50710c8428ef524c48c86accb48d09f5f17bec2d3aa65d335f53

See more details on using hashes here.

File details

Details for the file HTMLTemplateRender-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: HTMLTemplateRender-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for HTMLTemplateRender-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5e28b8c4bf4fd914da8ca955bafce10c4d5fa2f7eae961390fb7f5cf482099c2
MD5 22148ca62e09e183c4ad82a1aba602d8
BLAKE2b-256 5ffb88e9ef88ce917e6c699ac83be60662410390a1c5e94c13a6077e880ae468

See more details on using hashes here.

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