Including Attributes in OPML export

I want to utilize $Startdate in an OPML export so that the date appears in the body of a note in the final outline.
I assume the way to do this is to include $Startdate in the OPML Item template but its not clear to me how to add the attribute.
Is there any documentation that might help me figure out the solution. Unfortunately I’m under a deadline to complete a document and don’t have a lot of time for trial and error in changing the code. And, pretty obviously I’m not a programmer.
Any pointers would be much appreciated.

Per the OPML spec there is no formal ‘Startdate’ attribute. Whilst you can put your Tinderbox $Startdate (perhaps you meand StartDate?) values into OPML export (e.g. by modifying the built-in OPML export template).

A common misconception is OPML supports any attribute you add. In fact, whilst OPML-capable processes should support the spec, further additions are app-dependent. Just adding custom attributes to your raw OPML doesn’t mean all OPML consuming apps will extract the non-standard data.

Thanks for your response.

So perhaps I need to ask a broader question:

Is there a way to get a “date” attribute into an OPML export and then have the date show up as the heading to the notes in the OPML document and subsequently in an Omnioutliner document?

I’d export a note with such a date from OmniOutliner (I don’t the the app just now), I it exports the date, it will likely import it. Adjust your Tinderbox OPML export template to reflect the layout of the OO exported OPML.

If now sure how to do that, please post a link to the OO-exported OPML.

Sure.

Where the usual OPML export template says

^value(attributeEncode($Name))^

you’d have

^value(attributeEncode($Name)) ^value($StartDate) ^

In other words, instead of just exporting the name, export the name and the start date.

This works. I can get the date into the Omnioutliner document as I need.

One more question. In the example given above there is a space at end of the line before the last caret. Is that correct? I’m getting a stray caret when the attribute prints and I wonder if the space is necessary and perhaps the source of the problem.

Try

^value(attributeEncode($Name)) ^value($StartDate)

There is one too many carets in the example.

Or

^value(attributeEncode($Name))^ ^value($StartDate)^

For infrequent users of export code, I recommend always adding the optional closing caret as it saves Tinderbox having to guess where an export code finishes.

1 Like

I now have the result I wanted.

Thanks to everyone who responded, especially on a Sunday.

Hi, I’m very interested in this topic.
I change an OPML template to this

_note="^value(attributeEncode($Text))^ ^value($File)^ ^value($URL)^

It’s successfull to export “File” and “URL” attributes on a note area of an OmniOutliner element.

Is it possible to insert “Return Code=new lines for each attributes” between them? :star_struck:

The following content can now be exported to OPML export including File and URL attributes.
However, attributes for notes that do not contain text will not be exported.

Is it possible to export notes that do not contain any text, but only the attributes are extracted? :upside_down_face:

^if(ChildCount)^^indent("\t",^value($OutlineDepth(parent)-1))^<outline^if(Text)^ text="^value(attributeEncode($Name))^" _note="^value(attributeEncode($Text))^ ^value($File)^ ^value($URL)^"^else^ text="^value(attributeEncode($Name))^"^endIf^^if($Checked)^ _status="checked"^endIf^>
^children(/Templates/OPML/OPML item)^^indent("\t",^value($OutlineDepth(parent)-1))^</outline>
^else^^indent("\t",^value($OutlineDepth(parent)-1))^<outline^if(Text)^ text="^value(attributeEncode($Name))^" _note="^value(attributeEncode($Text))^ ^value($File)^ ^value($URL)^"^else^ text="^value(attributeEncode($Name))^"^endIf^^if($Checked)^ _status="checked"^endIf^/>
^endIf^

I’m not fully sure what you mean but I assume something like this pair of examples:

<outline^if($Text)^  text="^value(attributeEncode($Name))^"^endIf^ _note="^value(attributeEncode($Text))^"^^if($Checked)^ _status="^value(attributeEncode($Checked))^"^endIf^>

giving output:

<outline text="Some note" _note="This is where the $Text goes" _status="true">

vs a desired output like:


<outline 
text="Some note"
 _note="This is where the $Text goes"
 _status="true"
>

Whilst the latter might be more easily read by the human eye, but OMPL is not meant to be read by humans but by HTML parsers.

So why do you want the line breaks?

1 Like

Hi, Mark
Sorry my poor explain. :face_with_peeking_eye:

This code

^if(ChildCount)^^indent("\t",^value($OutlineDepth(parent)-1))^<outline^if(Text)^ text="^value(attributeEncode($Name))^" _note="^value(attributeEncode($Text))^ ^value($Authors)^ ^value($URL)^"^else^ text="^value(attributeEncode($Name))^"^endIf^^if($Checked)^ _status="checked"^endIf^>
^children(/Templates/OPML/OPML item)^^indent("\t",^value($OutlineDepth(parent)-1))^</outline>
^else^^indent("\t",^value($OutlineDepth(parent)-1))^<outline^if(Text)^ text="^value(attributeEncode($Name))^" _note="^value(attributeEncode($Text))^ ^value($Authors)^ ^value($URL)^"^else^ text="^value(attributeEncode($Name))^"^endIf^^if($Checked)^ _status="checked"^endIf^/>
^endIf^


Makes my TBX to an OPML like,

But I’d like to make it something like,

:upside_down_face:

1 Like

No apologies needed and thanks for the clarification.

As the last screengrabs are of some other app (OmniOutliner?) I’ll explain that I think @ham’s problem is that the $URL data is being appended to the end of the last paragraph of the $Text but it is desired to have the URL as a discrete paragraph.

We can do this at export by code like this:

... _note="^value(attributeEncode($Text)+"\n")^ ...

with a result like so:

But in OmniOutliner you get this:

Sio the problem isn’t a Tinderbox one. Instead you need to go read the documentation for your OMPL app and find what characters is accepts for paragraph breaks in text.

IMPORTANT: the OPML standard does note define a method for line breaks in text. Indeed, it doesn’t define an attribute as used here for $Text. OPML uses ‘text’ for the note title. The _notes attribute is a non-standard customisation starred (I believe) by Omni for their OmniOutliner. Though widely copied (for compatibility) is is not standard, therefore you cannot rely, without actual deliberate testing—, whether two apps use the same ‘standard’ for line breaks.

… some time spend researching OmniOutliner …

It appears OmniOutliner needs a &#10; to make a line break when ingesting OPML textual attribute values. So, we amend our Tinderbox template:

... _note="^value(attributeEncode($Text)+"&#10;")^ ...

and, yes, we get (in OmniOutliner) the desired line-breaks.:

This reinforces my point above re standards. Virtually no OMPL data uses only the OPML standard. If you make or are given OPML and it works where needed, then great. Otherwise, you have work to do as you’re using non-standard data and you’ll have to figure out the customisations (which are rarely, if ever) explicitly documented. I think the latter occurs because many app devs don’t bother to read the OPML standard but just implement what works with “SomeApp” as compatibility-with-SomeApp is likely why OPML import/export is added. Ugh. Over the years OPML ‘assumptions’ have wasted more time than any other format I’ve been asked to use.

Here is the TBX is used for testing this: breaks-in-opml.tbx (98.8 KB)

1 Like

Thank you soooo much! your advice and the sample tbx.!!!
I’ll keep studying!!
:heart_eyes:

1 Like

Happy to help. :slight_smile: