Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1 2 
Send Topic Print
OPML for Scrivener import (ex:Notes for a Novel) (Read 40782 times)
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: OPML for Scrivener import (ex:Notes for a Novel)
Reply #15 - Jan 11th, 2010, 5:37am
 
Can I suggest one small tweak to your TBX? In the 'Chapter' prototype, set it OnAdd to: $Prototype="Scene";. That way, the user only has to set the prototype for chapters as their content prototype is auto-set.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Ioa Petra-ka
Full Member
*
Offline



Posts: 103
Portland, Oregon, USA
Re: OPML for Scrivener import (ex:Notes for a Novel)
Reply #16 - Jan 11th, 2010, 8:49am
 
Good point, I'll make that update to the description. That's the kind of thing that would have definitely evolved out of regular usage. Likewise the Draft container could have a similar rule set up to set added children to Chapters.

For anyone else reading this: I'm also working on a variant that uses simple MultiMarkdown and exports a single file. This way, outlines of arbitrary depth can be exported and full note titles relayed into Scrivener Binder order, rather than the sequential numbering system currently used. I should have that posted later today.
Back to top
 
« Last Edit: Jan 11th, 2010, 9:01am by Ioa Petra-ka »  

Av
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: OPML for Scrivener import (ex:Notes for a Novel)
Reply #17 - Jan 11th, 2010, 9:20am
 
The next Tinderbox beta, incidentally, has an experimental feature that encodes paragraph breaks as 
 for the benefit of Scrivener and related OPML importers.
Back to top
 
 
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: OPML for Scrivener import (ex:Notes for a Novel)
Reply #18 - Jan 11th, 2010, 11:44am
 
I don't have Scrivener, but (further to Mark's comment above) I believe this specimen OPML NewOPMLTest.opml should now import correctly into Scrivener if someone could give it a try.

The outline items are from TB note names and the '_note' attributes have TB note text (where there is any) including multi-paragraph text. If it works this should give a nice fast/light interchange method, with Amber's MultiMarkdown solution providing a more comprehensive alternate approach.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
AsafKeller
Full Member
*
Offline



Posts: 77

Re: OPML for Scrivener import (ex:Notes for a Novel)
Reply #19 - Jan 11th, 2010, 2:31pm
 
Mark: I cannot open the file. Is it a TBX? It downloads with XML extension. Scrivener cannot import it; IT returns "Some files could not be imported because they were of an unsupported file type or contained data that could not be read." I opened it in TextWrangler and cannot see anything obviously wrong.
Back to top
 
« Last Edit: Jan 11th, 2010, 2:38pm by AsafKeller »  
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: OPML for Scrivener import (ex:Notes for a Novel)
Reply #20 - Jan 11th, 2010, 3:08pm
 
No, it's an OPML file (which is an XML of sorts, I guess). If Safari tries to open it, use the menu File -> Save As and save as "NewOPMLTest.opml". Then try importin the OPML file to Scrivener.  Sometimes, web browsers tend to try a bit too hard at opening things ... and get it wrong.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Ioa Petra-ka
Full Member
*
Offline



Posts: 103
Portland, Oregon, USA
Re: OPML for Scrivener import (ex:Notes for a Novel)
Reply #21 - Jan 11th, 2010, 5:10pm
 
I'm getting a no-go on the OPML file, too. I've saved it properly and dragged it into the Binder with the error message stating it is unrecognised. Examining the file, it appears there are syntax errors in it. Should it really be:

Code:
<outline text="<outline text="More stuff &gt; less stuff"/> 



Rather than:

Code:
<outline text="More stuff &gt; less stuff" /> 



If this is attempting nesting, OmniOutliner does it like:

Code:
<outline text="Blah" _note="More blah"><outline ... /></outline> 



But perhaps I don't understand what is going on. And indeed see other cases where nesting is done properly.

Once I S&R `"<outline text="` with `"` and add a final </outline> to the file, it works.

There are also a lot of entities in the last note that do not relay well.
Back to top
 
« Last Edit: Jan 11th, 2010, 5:26pm by Ioa Petra-ka »  

Av
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: OPML for Scrivener import (ex:Notes for a Novel)
Reply #22 - Jan 11th, 2010, 5:37pm
 
Ah, mea culpa. Let me take another look...
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: OPML for Scrivener import (ex:Notes for a Novel)
Reply #23 - Jan 11th, 2010, 5:46pm
 
Try it again now (same URL - here). I'd left out a closure for a non-nested element and a closing ^endIf^. I've walked the tag nesting in BBEdit and it looks OK now.  I've put in deliberate characters that will cause problem if I've not encoded them correctly. Sorry for the earlier typo.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Ioa Petra-ka
Full Member
*
Offline



Posts: 103
Portland, Oregon, USA
Re: OPML for Scrivener import (ex:Notes for a Novel)
Reply #24 - Jan 11th, 2010, 6:28pm
 
Latest revision works with no modification.

The mentioned encoded characters pass straight through to Scrivener, by the way. The "standard" ones are fine in the other nodes, but the final import looks like &#xa1;Hola! in the text editor, and the title is full of these as well. Perhaps that is what you are going for, but if so there are going to be limitations in character sets, potentially.
Back to top
 
 

Av
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: OPML for Scrivener import (ex:Notes for a Novel)
Reply #25 - Jan 11th, 2010, 6:52pm
 
Re your last, I'm just the monkey-with-typewriter in this, testing features! I've been mainly working on getting decent recursing OPML export templates with some level-indenting in code (to help when/if triaging the source code) and the new vertical tab feature to which Mark's alluded.

The &#xa1 is a valid hex-based XML/HTML entity for an upside-down exclamation mark. I guess Scrivener doesn't parse all HTML entities. I wonder what Scrivener outputs for text containing "ˇHola!" when exporting to OPML (does it export OPML?).

If the TB user knows what Scrivener does/doesn't parse out of XML it's probably possible to make up a rubric for TB users to follow. As a bystander, I don't see much mileage in pushing for more engineering at the TB end as it now seems to export valid OPML code (including the vertical tab for line/paragraph breaks).
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Ioa Petra-ka
Full Member
*
Offline



Posts: 103
Portland, Oregon, USA
Re: OPML for Scrivener import (ex:Notes for a Novel)
Reply #26 - Jan 11th, 2010, 11:04pm
 
I've posted instructions and an example Tinderbox file, using the MMD method, here:

http://www.literatureandlatte.com/forum/viewtopic.php?f=2&t=7244&p=59129#p59...

As mentioned before and there as well, this will not preserve rich text styling in the note text. If you need that, it is better to suffer with generic title names for now, using the originally posted method.

P.S. Is there any way to turn off entities entirely? That is one thing that is bugging me and it looks like the only way to get around it is post-processing the exported file.

P.P.S. It looks like whatever XML engine Scrivener is using (probably a Cocoa solution) to decode the OPML file can handle named entities, but not Unicode entities.
Back to top
 
« Last Edit: Jan 11th, 2010, 11:05pm by Ioa Petra-ka »  

Av
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: OPML for Scrivener import (ex:Notes for a Novel)
Reply #27 - Jan 12th, 2010, 3:51am
 
Turning off enitities - look into HTMLMarkupText, HTMLQuoteHTML and QuickLists.

Re named vs Unicode entities, I see what you mean. Though if Scrivener aims to import OPML and to support characters beyond ASCII, it really needs to extend its XML parser and I believe from comments up thread that it's author is open to fixing/changing the  OPML import.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Ioa Petra-ka
Full Member
*
Offline



Posts: 103
Portland, Oregon, USA
Re: OPML for Scrivener import (ex:Notes for a Novel)
Reply #28 - Jan 12th, 2010, 8:42am
 
Yes, those were the first two attributes I played with, but to no avail. HTMLMarkupText only impacts the generation of lists, links, and so forth; HTMLEntities only impacts characters that would otherwise disrupt HTML, such as ampersand and great-than. Typographic quotes, umlauts, and other such things still get converted to entities.

With above settings tweaked to logical states:

Code:
Third “level & depth” test. 



Becomes:

Code:
Third &#x201c;level & depth&#x201d; test. 


Back to top
 
 

Av
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: OPML for Scrivener import (ex:Notes for a Novel)
Reply #29 - Jan 12th, 2010, 9:16am
 
With ^value($Text)^, I get your example to export with no enitity creation - regardless of HTMLQuoteHTML ands HTMLMarkupText state.  Even with both of those attributes as 'false' if instead I use ^text(plain)^, the smart quotes in your example are entified. The latter code variant is older and doubtless works off different assumptions about the consuming application for the output.

The ^value()^ export approach assumes you'll encode the attributes as required, e.g. ^value(escapeHTML($Text))^ is in effect doing the $HTMLQuoteHTML task.

One 'gotcha' with the ^value()^ and $Text is inline ^export^ codes aren't evaluated. That means that it may be hard to use one set of notes for HTML and XML export if the note $Text includes ^code^; you may need to re-structure your codes/templates to fit the sort of output you're making. The old and new export method don't tear down in the same way (and I'm deliberately not taking a view as to whether they should or shouldn't).
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Pages: 1 2 
Send Topic Print