4 votes

TidyHtml

Umbraco datatype to help embedding xml/html (paste or load from file/url) and apply cleaning operations to remove content, tags and tag attributes.

Basically it is used as text content box with a filter applied - the text input is html/xml, and the result after the filter is applied is text or some subset of the original html/xml - depending on your setup of the datatype.

Why would you use this? An obvious situation is that you (or your content editor) sometimes want to embed existing html/xml files into a site, without going into too much trouble cleaning up the text to import.

E.g. some 3rd party software for handling sport events typically output their results as html pages. An easy way to import these results into a site would be to add a TidyHtml datatype to a document type of your site, and then import the result html when creating a new node of this document type. If the TidyHtml datatype is set up to handle the sport result html (e.g. by skipping all content outside and including the <body> tags and afterwards removing all tag attributes) then your template would be table to directly output the TidyHtml field content and a nice way using the layout etc. from the site.

You now also have the option to embed xml and save it as xml - this is useful in case you want to use- and query the xml from e.g. a xslt macro.

The data type is still in a beta state, so please feel free to report issues.

 

Installation

Download and install the package - this is done as for all packages from the Packages option in the Developer section of the Umbraco backend.

What is installed is basically a setup for a DataType, i.e. only the TidyHtml render-control is available by default - not any ready-to-use datatypes.

 

Getting started

Set up the data type

Start up by making a new Data Type and select the "Tidy Html" render control from the drop down.

Now you have to specify TidyHtml properties, e.g. what this datatype is supposed to tidy up.

 

Using the Data Type

Include your data type in one of your document types, and make a new content node of the document type.

When looking at your new TidyHtml field in the content node you will see a text box for the html/xml content, and a fields fields below.

These fields can be used for loading content from file/web page - fill in the address and click the content node Save button to load the content.

Now click the Tidy-button to actually perform your predefined tidy-functions, and save the result.

To use the result (e.g. render the content) use the field as any other text field.

 

Screenshots

Archived files

Documentation

Source code

Package owner

Tommy Poulsen

Tommy Poulsen

Tommy has 708 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions:

Package Information

  • Package owner: Tommy Poulsen
  • Created: 24/03/2010
  • Current version 0.3
  • License MIT
  • Downloads on Our: 934

External resources