Skip to main content

gomobile.xhtmlmp provides XHTML mobile profile cleaner. It takes in arbitary HTML code and turns it to valid XHTML-MP code which can be dropped in XHTML MP page.

The code will also filter possible malicious code in external feed content, like <script> tags.

Requirements

This package has no dependencies to Plone or GoMobile and can be used with any Python code.

Features

  • Turn any incoming HTML/XHTML to mobile profile compatible

    • Enforce ALT text on images - especially useful for external tracking images (feedburner tracker)

  • Protect against Cross-Site Scripting Attacks (XSS) and other nastiness, as provided by lxml.html.clean

  • Unicode compliant - eats funky characters

Usage

clean_xhtml_mp(html)

This function will do everyhing you need.

Run XHTML mobile profile cleaner for HTML code:

@param html: HTML as a string or lxml Document
@return: XHTML, utf-8 encoded string

Example:

from gomobile.xhtmlmp.transformers.xhtmlmp_safe import clean_xhtml_mp

html = '<img src="http://www.foobar.com">'
output = clean_xhtml_mp(html)
self.assertEqual(output, '<img src="http://www.foobar.com" alt=""/>', "Got:" + output)

Roadmap

Future features will include:

  • Automatic resize for image sources

Unit tests

Put gomobile.xhtmlmp to your PYTHONPATH.

Run unit tests normally like:

python tests/test_image.py

See also

Author

Twinapex Team - Professional Python and Plone hackers for hire..

Changelog

0.1

  • Initial release

Metadata

Release files for gomobile.xhtmlmp 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gomobile.xhtmlmp 0.1
File Size Uploaded Provenance
gomobile.xhtmlmp-0.1.tar.gz 4.0 kB Without provenance Details

Release files / gomobile.xhtmlmp-0.1.tar.gz

Download URL gomobile.xhtmlmp-0.1.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
74e93067a2afd17b7db86447a8fd18f0895ffbc3972f63c09cd0ef9c703086e2
BLAKE2b-256 checksum
How to use checksums
fbfa34ec0508d12dfd23b9d6ad75f3a372ebd98aee0f99e3ff94ce385b02d33c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for gomobile.xhtmlmp 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page