docs.roxen.comView this page in a printer friendly mode
DocsRoxenWebServer 4.5Web Developer ManualText Tags
Copyright © 2012, Roxen Internet Software
Suggestions, comments & compliments
manuals@roxen.com
 DEMO  DOCS  PIKE
 COMMUNITY  DOWNLOAD
www.roxen.com

   

<ai>
<autoformat>
<case>
<charset>
<comment>
<?comment ?>
<default>
<doc>
<foldlist>
<format-number>
<obox>
<random>
<recode>
<replace>
<sed>
<smallcaps>
<sort>
<strlen>
<tablify>
<trimlines>
<wash-html>

<wash-html></wash-html>

Provided by module: Tags: HTML washer

This tag is mostly useful for turning user freetext input from a form into HTML intelligently, by turning sections of the text separated by more than one newline into <p>paragraphs</p>, filtering out or explicitly allowing some HTML tags in the input and creating <a>anchor-links</a> out of potential www-addresses.


Attributes

keep-all

Leave all tags containing info intact. Overrides the value of keep-tags and keep-containers. This attribute is useful together with the attributes unparagraphify and unlink.


<wash-html keep-all='1'>
  Some text, <i>italic</i>, <b>bold</b>,
  <i><b>bold italic</b></i>.

  <hr />A little image:<img src='/internal-roxen-next' />.
</wash-html>
Some text, italic, bold, bold italic.
A little image:.

keep-tags="list"

Comma-separated array of empty element <tags> not to filter. Quote all other empty element tags, i.e. transform "<", ">" and "&" to "&lt;", "&gt;" and "&amp;".


<wash-html keep-tags='hr'>
  Some text, <i>italic</i>, <b>bold</b>,
  <i><b>bold italic</b></i>.

  <hr />A litle image:<img src='/internal-roxen-next' />.
</wash-html>
Some text, <i>italic</i>, <b>bold</b>, <i><b>bold italic</b></i>.
A litle image:<img src='/internal-roxen-next' />.

keep-containers="list"

Comma-separated array of <container>...</> tags not to filter. Quote all other container tags, i.e. transform "<", ">" and "&" to "&lt;", "&gt;" and "&amp;".


<wash-html keep-containers='b'>
  Some text, <i>italic</i>, <b>bold</b>,
  <i><b>bold italic</b></i>.

  <hr />A little image:<img src='/internal-roxen-next' />.
</wash-html>
Some text, <i>italic</i>, bold, <i>bold italic</i>. <hr />A little image:<img src='/internal-roxen-next' />.

keep-attributes="list"

List of attributes to preserve in keep-containers and keep-tags. If the attribute is omitted all attributes for tags will be preserved. The format is tag1:attribute1,tag1:attribute2,tag2:attribute1... Useful for allowing tags but not attributes, i.e. allow the <quote> tag but not attributes such as onclick etc.


<wash-html keep-containers="a,font">
  <a href="http://docs.roxen.com">Roxen docs</a>
  <font style="color:red;">Text</font>
</wash-html>
Roxen docs Text

Note that all attributes for preserved tags are kept.


<wash-html keep-containers="a,font" keep-attributes="a:href">
  <a href="http://docs.roxen.com">Roxen docs</a>
  <font style="color:red;">Text</font>
</wash-html>
Roxen docs Text

Only the href attribute for the a tag is kept.


linkify

Makes text that looks like it might be useful as a link, e g http://www.roxen.com/, into a link. Text that starts with "http://", "https://", "ftp://", "www." or "http." will be converted to a clickable link with the text as the link label.


<wash-html linkify='a' keep-containers='a' keep-tags='br'>
  <a href="http://docs.roxen.com">Roxen docs</a><br />
  http://pike.roxen.com<br />
  www.roxen.com
</wash-html>
Roxen docs
http://pike.roxen.com
http://www.roxen.com

link-target

If the linkify attribute is used, set the link target to this.


unlinkify

Undo a linkify-conversion. Only the links that has the same label as address will be converted to plain text.


<wash-html unlinkify='1' keep-tags='br' keep-containers='a'>
  <a href="http://www.roxen.com">http://www.roxen.com</a><br />
  <a href="http://www.roxen.com">Roxen IS</a>
</wash-html>
http://www.roxen.com
Roxen IS

remove-illegal-xml-chars

Removes illegal and discouraged XML characters. Legal characters include #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]. Discouraged characters include [#x7F-#x84], [#x86-#x9F], [#xFDD0-#xFDDF], [#1FFFE-#x1FFFF], [#2FFFE-#x2FFFF], [#3FFFE-#x3FFFF], [#4FFFE-#x4FFFF], [#5FFFE-#x5FFFF], [#6FFFE-#x6FFFF], [#7FFFE-#x7FFFF], [#8FFFE-#x8FFFF], [#9FFFE-#x9FFFF], [#AFFFE-#xAFFFF], [#BFFFE-#xBFFFF], [#CFFFE-#xCFFFF], [#DFFFE-#xDFFFF], [#EFFFE-#xEFFFF], [#FFFFE-#xFFFFF], [#10FFFE-#x10FFFF]


paragraphify

If more than one newline exists between two text elements, this attribute automatically makes the next text element into a paragraph.


<wash-html paragraphify='1'>
A Paragraph

Another paragraph.
Some more text to the same paragraph.
</wash-html>
In the output source code, this would look like:
<p>
A Paragraph</p>
<p>Another paragraph.
Some more text to the same paragraph.
</p>

unparagraphify

Turn paragraph breaks into double newlines instead.


<wash-html unparagraphify='1'>
<p>A Paragraph</p>
<p>Another paragraph.
Some more text to the same paragraph.</p>
</wash-html>
In the output source code, this would look like:
A Paragraph

Another paragraph.
Some more text to the same paragraph.

The <pre> is only used in the example for layout-purposes.


close-tags

Terminate all tags with an ending slash, making them XML-compliant.