What OPML attributers are parsed on import

When Scrivener imports OPML, what per-item fields/attributes does it parse and to where. The manual isn’t too clear and OPML is a rather loosely defined format (q.v. http://dev.opml.org/spec2.html).

Background: I’m trying to assist a Tinderbox user who wants to export some zettelkasten-type note to Scrivener via OPML and wants to retain an index (i.e. zettelkasten GUID) number. In Tinderbox it is trivial to put this source user attribute into the OPML via an export template as a discrete attribute=“value”. But, I can’t be sure what Scrivener does with inbound OPML. For instance, does Scrivener only parse certain default OPML item attributes and ignore the rest; or if there are custom (but OPML format valid) attributes to where are these imported.



Hey Mark, nice to see you around here.

Unfortunately the OPML importer is quite simple, it only reads from the “_note” attribute into the specified area in settings (by default, into the main text editor). The “text” attribute will go into the outline heading.

Now something you could do in the content area itself is to “hack” an annotation into it. Annotations, in plain-text form, looks a bit like raw RTF:

{\Scrv_annot \color={\R=0.54323\G=0.0\B=0.02382} \text= GUID:This is a test \end_Scrv_annot}

To get that to work on the Scrivener side, they’d want their Sharing: Import preferences set to Import notes into: Main Text, or Notes, both of which support inline annotations.

So here is an example XML structure that would import nicely:

[code]<?xml version="1.0" encoding="utf-8"?>

Annotation Test [size=80][/size]

That would be a decent result in and of itself. The code won’t export by default, being in an annotation like that, and would be readily accessible via search. But if they wanted to take it a step further and extract these into a custom metadata field, some kind of setup with Keyboard Maestro would probably need to be done (other than sheer manual labour of course).

And in case you’re wondering, no there is no way to import metadata values. Probably the best solution would be to write a script that hacks the .scrivx XML, but that would take a fair amount of work.

Yet to dive into the detail but that looks do-able as I’ve a fair degree of control on the Tinderbox export end. I’ll give it a go - it may be a few days, but I’ll report back if all works.

Many thanks.