Skip to main content

Simple Pythonic HTML Creator

Project description

Simple Pythonic HTML Creator

  • Very alpha yet but works

  • Compatible with Python3/ 2.x

  • Source: https://github.com/shon/sphc

  • Any suggestions/issues | <https://github.com/shon/sphc/issues>

  • Critisism or if you feel such thing already implemented feel free to write Authour.

As simple as below:

>> import sphw

>> tf = sphw.TagFactory()

>> html = tf.HTML()
>> html.head = tf.HEAD()
>> html.body = tf.BODY()
>> html.body.content = tf.DIV("Some Text here.", Class='content')
>> html.body.content.br = tf.BR()
>> html.body.content.br = tf.BR()
>> html.footer = tf.FOOTER()

>> data = [('One', '1'), ('Two', '2'), ('Three', '3')]
>> atable = tf.TABLE()
>> for element in data:
>>     row = tf.TR()
>>     row.cells = [tf.TD(element[0]), tf.TD(element[1])]
>>     atable.row = row

>> more_cells = [tf.TD('Four'), tf.TD('4')]
>> row = tf.TR()
>> row.cells = more_cells

>> atable.row = row

>> html.body.content.atable = atable
>> html.body.content.attributes['id'] = 'content_id'

>> print(html.pretty())

Similar packages

TODO

  • To add more tests

  • A document class ?

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

sphc-0.3.1.tar.gz (2.5 kB view details)

Uploaded Source

File details

Details for the file sphc-0.3.1.tar.gz.

File metadata

  • Download URL: sphc-0.3.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sphc-0.3.1.tar.gz
Algorithm Hash digest
SHA256 4e1b86cbab17a9f52e743af362801a9a67df3480699d570bcab215dec23ac67f
MD5 f1f753ce31c872b5f8337a1330ea3cc2
BLAKE2b-256 ea5bb20227eba66ebbef672cf1e5a311762831fadcecc053709552694545ec55

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