Thanks, Paul. Might I propose updated versions of the templates? The proposals are
functionally the same, one-for-one replacements, as the demo's templates but differ in using some newer TB syntax and codes which may avoid some encoding edge cases and other issues:
New OPML-Wrapper:
Code:<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>^title^</title>
<expansionState></expansionState>
</head>
<body>
^children(/TEMPLATES/OPML-item)^
</body>
</opml>
New OPML-Item:
Code:^if(ChildCount)^^if(Text)^<outline text="^opmlEncode(^value($Name)^)^" _note="^opmlEncode(^value($Text)^)^">^else^<outline text="^opmlEncode(^value($Name)^)^">^endIf^
^children(/TEMPLATES/OPML-item)^
</outline>^else^
<outline text="^opmlEncode(^value($Name)^)^"/>^endIf^
I notice Carbon Fin's own OPML output uses single quotes for attribute values. Whilst XML allows either single or double quotes, double seems the more normal convention and TB's
^opmlEncode()^ makes it safe to use attribute values with quotes in as these are changed to XML/OPML-safe entities.
If you wanted to share ToDo list ticks, Carbon Fin uses an OPML attribute "status". I'd suggest having a TB user Boolean attribute, like
$IsComplete and a string attribute
$status (N.B. lowercase initial to match CF export). I'd envisage
$IsComplete being a key attribute for notes and $status being not shown in TB. Carbon Fin's exported 'status' value is either 'checked' or nothing. Importing CF OPML to TB will set the status field; use Rules or agents to cross-map the $status and $IsComplete attributes:
TB to imported CF state:
if($status){$IsComplete=true}else{$IsComplete=false}Export TB state to CF:
if($IsComplete){$status="checked"}else($status=""}An OPML-Item template including the status:
Code:^if(ChildCount)^^if(Text)^<outline text="^opmlEncode(^value($Name)^)^" _note="^opmlEncode(^value($Text)^)^" _status="^value($status)^">^else^<outline text="^opmlEncode(^value($Name)^)^" _status="^value($status)^">^endIf^
^children(/TEMPLATES/OPML-item)^
</outline>^else^
<outline text="^opmlEncode(^value($Name)^)^" _status="^value($status)^"/>^endIf^
We don't need to opmpEncode the value of
$status as it is only ever
checked (or no value).