Code Type:
Code Scope of Action:
Code First Added:
Code Altered:
DEPRECATED - use ^value(attributeEncode())^. See ^value^, attributeEncode().
^opmlEncode( data )^
Revised in v5.5.0, the correct usage for this code is :
<code>^opmlEncode(^value($AttributeName)^)^</code>
Apart from necessary use of format() for Color, Set and such data types, no other encoding of attribute data is now needed for OPML. Use of ^title^ and ^text^ in this context is deprecated (since v5.5.0).
Originally, opmlEncode() code would find and encode all paragraph breaks (hard line breaks) and encode them as <code> </code> entity. Addressing several edge cases, from v5.5.0, opmlEncode encodes all of the following to HTML entities:
- left angle bracket
- right angle bracket
- ampersand
- (straight) double quote
- (straight) apostrophe
- line feed character (ASCII #10).
The action code equivalent - of the original code is attributeEncode(). Note, the latter didn't reflect the v5.5.0 improvements to opmlEncode() until v5.8.0.
OPML
OPML is UTF-8 encoded XML. As Tinderbox v5+ now exports in UTF-8 encoding, the entities address several XML related factors. A requirement of XML is that literal left angle bracket, right angle bracket and ampersand literal characters - e.g. as in attribute values - must be in entity form. Although not specified, the same is needed for double quotes as these are the delimiter for XML attribute values and a literal " will otherwise cause early closure of an attribute value and confuse downstream parsing of data. Likewise a line feed character (used for paragraph breaks) is normal not expected in XML attributes but is handled safely if an entity. The entifying of single quotes is belt & braces to avoid issues of alternate use of quoting types.