Skip to main content

Dynamic HTML code generation

Project description

html-creator

Python library to dynamically generate html in an etree-like structure

Docs


Document(title=''): Your HTML document.

Args

  • title: The title of your document. This is optional and can be specified later

Methods

  • Using str() on this object will return the formatted html content of the Document.

Properties

  • Document.children: The direct children of the document
  • Document.head: The head tag of the document (automatically generated)
  • Document.body: The body tag of the document (automatically generated)

Element(tag='p',attrs={},content=''): A single HTML element/tag

Args

  • tag: The tag name, like div, p, or h1
  • attrs: The attributes of the element, in a dict
  • content: Text content of your tag

Methods

  • Using str() on this object will return the formatted html tag, including formatted html versions of all child tags
  • Using len(Element object) will return the number of children
  • Using Element[index] will return the element at that index
  • Using Element.append(new Element object instance) or Element.add_child(new Element object instance) adds a child Element to the Element

Properties

  • tag, attrs, content: See Args
  • children: The direct children on the Element

CSS(Dict={}): A utility class for generating CSS

Args

  • Dict: Specifies a starting dictionary (Must be in form {selector: {property: value,property: value,property: value}, selector2: {property: value,property: value,property: value}})

Methods

  • del CSS[selector] and CSS[selector], respectively, delete and get the specified selector in the CSS object
  • add_sel(selector): Adds a selector to add properties to
  • add_property(selector, property, value): Adds property property with value value to selector selector
  • del_property(selector, property): Deletes property property from selector selector
  • str(CSS object): Returns a formatted CSS string

Properties

  • dict: The dictionary used by the CSS object. Can be edited directly, but could cause issues

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

html_creator-1.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

html_creator-1.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file html_creator-1.1.tar.gz.

File metadata

  • Download URL: html_creator-1.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.5.4

File hashes

Hashes for html_creator-1.1.tar.gz
Algorithm Hash digest
SHA256 bcff0dd39714fa4dc93986a773984b8fb3de2383e2e18d030810d1200cfa93cb
MD5 8ecd1eefcde8df9898030f64bf18a29d
BLAKE2b-256 5594549886c8c527b4ae5d844eb13c07c75e274e2d9d6bdc047350c3fd822f61

See more details on using hashes here.

File details

Details for the file html_creator-1.1-py3-none-any.whl.

File metadata

  • Download URL: html_creator-1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.5.4

File hashes

Hashes for html_creator-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d9630944441ec0497f7e6de8478abcfe11d90fb6e9f936acdb4807af23c5ba60
MD5 6d81b54e9d572a860904638fc799fefc
BLAKE2b-256 5f4c6c4cd7d6d25457d27b0e8c0cdddebb373a975d23e2bd585b43c10810ceb4

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