newbie stuck

76 views
Skip to first unread message

ch rr

unread,
Aug 29, 2022, 6:15:29 PM8/29/22
to leo-editor
Hi,

If you want you can skip to "Problem" below.

I'm new to Leo  but not to Python, and not to the world. For 30 years, I've been trying to recapture the magic of MORE (and ThinkTank...) , but on Windows (had to switch in 1989, never used a Mac since).  No way. Recently got fed up, got a Mac Mini M1, an iPhone and iPad, bought OmniOutliner,  but I now only use it on IOS to exchange OPML files with Windows because _BREVITYALERT_.  Even though I got to a decent level in Python, I never tried LEO because  _BREVITYALERT_

But THIS IS THE ONE. Wow!

Problem
Of course, my first message is also about a problem. I'm pretty sure I got the leoOPML.py plugin configuration right (file, tree, directives, body panel), but when I type write-opml-file in the mini-buffer (and by the way this procedure seems to be nowhere on leoeditor.com or davy39.github.io/leo-editor/apidoc/leo.plugins.html. Thanks, Google),
I get this:

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\leo\core\leoKeys.py", line 2521, in callAltXFunction
    func(event)
  File "C:\Python310\lib\site-packages\leo\plugins\leoOPML.py", line 346, in writeOpmlCommand
    c.opmlCommands.writeFile(fileName)
  File "C:\Python310\lib\site-packages\leo\plugins\leoOPML.py", line 319, in writeFile
    ok = self.c.fileCommands.write_Leo_file(
TypeError: FileCommands.write_Leo_file() got an unexpected keyword argument 'outlineOnlyFlag'

 everytime, either with my own narrow set of parameter plugins or with the one in leosettings.leo.

I went through the plugin code, tried to remove line 321, but then Tostring=False  became unexpected too. Then I tried to learn about c.filecommands, but I thought it better to join the group and write this.
???

Thanks in advance for help,

Chris

tbp1...@gmail.com

unread,
Aug 29, 2022, 11:07:08 PM8/29/22
to leo-editor
Without knowing anything about the plugin, it looks like the signature of fc.write_leo_file() is currently not the signature the plugin thinks it is.  I'd try commenting out the extra params in the plugin, and see what what you get:

    ok = self.c.fileCommands.write_Leo_file(
        fileName#,
        #outlineOnlyFlag=not self.opml_write_derived_files,
        #toString=False, toOPML=True
        )
 
You would have to restart Leo, or run a new Leo session, to try the changes out.

chr...@gmail.com

unread,
Aug 30, 2022, 12:11:37 PM8/30/22
to leo-editor
That's what I did, and the resulting file was not OPML. Check my previous message: https://groups.google.com/g/leo-editor/c/bV98DK9QtPI/m/m7bLQioQCgAJ

tbp1...@gmail.com

unread,
Aug 30, 2022, 12:18:50 PM8/30/22
to leo-editor
Shouldn't be hard to adjust the output format, I would think (not knowing anything about the actual plugin).  Do you know of an OPML validator so potential fixes could be tested?
Message has been deleted

chr...@gmail.com

unread,
Aug 31, 2022, 10:13:37 AM8/31/22
to leo-editor
I found only one public one at http://validator.opml.org/ (website and validator by Dave Winer, the original OPML guy, still at the wheel), but it doesn't seem to work so well.
Message has been deleted
Message has been deleted

tbp1...@gmail.com

unread,
Aug 31, 2022, 11:06:53 AM8/31/22
to leo-editor
Here is Dave (Winer)'s spec.  I would think that there would be an XML schema (or maybe a DTD would be able to the the joib) somewhere that could be used for validating an OPML file, but I didn't find one in a very hasty search.

Since OPML only includes what Leo calls headline text, I'm wondering if there would ever be any use for text in (Leo) node bodies.  An OPML outline node can contain other information besides the headline text, so maybe that's why the plugin may deal with Leo's user attributes - the info has to go somewhere.  

Is it the case, @chr, that you want to round-trip OPML files with other applications with full fidelity (except maybe data about an editor's state)?  Or do you only need to include a subset of information?



Message has been deleted

chr...@gmail.com

unread,
Aug 31, 2022, 11:13:17 AM8/31/22
to leo-editor
Dave Winer the man himself validated my file on his OPML validator, so it works just fine. I recommend
as long as you use a URL straight from a web server, and not from Dropbox etc. as I did.
And you can't do better than using
for questions and issues with fixing Leo OPML output, always keeping in mind that it is an EXCHANGE FORMAT, and that less is more. And of course,



On Tuesday, August 30, 2022 at 6:18:50 PM UTC+2 tbp1...@gmail.com wrote:
Message has been deleted

chr...@gmail.com

unread,
Aug 31, 2022, 11:33:48 AM8/31/22
to leo-editor
I believe there is no schema or DTD, unfortunately. You could ask why at the github link I posted just before (and deleted and re-edited several times!)
During my many test of Windows outliners, I remember that one interpreted an OmniOutliner column (each headline can have columns), which was also present in the OmniOutliner-output OPML file. The column was interpreted as an extra attribute of the headline (or maybe a "sub-attribute", if there's such a thing in XML?)
Strangely, the Windows program showed it ABOVE each headline (maybe because of alphabetical sorting, because the headline column was call "Topic" and the second column "Description"), slightly offset to the right, and it was editable. So, of course, it would be great if the TEXT of the body pane could pass into the OPML file! I Other content would not pass through. I hope OmniOutliner would show it as a column, but having not read the whole OPML 2.0 spec, I don't know how that works. I'm willing to reinstall all those dodgy Windows "outliners" to test this, if you want.

chr...@gmail.com

unread,
Aug 31, 2022, 12:08:27 PM8/31/22
to leo-editor
Attached: two-column OmniOutliner Pro OPML file.

Chris
Document_2-columns.opml
Message has been deleted
Message has been deleted

chr...@gmail.com

unread,
Aug 31, 2022, 5:52:38 PM8/31/22
to leo-editor
tbp1...@gmail.com, I don't know if you are a developer or member of the Leo team, so I'm not sure if the info I'm sending is useful, please let me know.

You may already know about this, but there are two leoOPML.py settings that were implemented for the integration of body text into the OPML file:
    @bool opml_use_outline_elements = True
    @bool opml_write_body_text = True

and the one about writing <v> elements (why? I know nothing about vnodes etc., but I suppose they're useless outside of Leo, so they have no place in OPML)
    @bool opml_write_leo_globals_attributes = False

It seems no XML schema or DTD means anything goes with the names of attributes in OPML. One of the outliners I tried offered the possibility of changing the name of the first outline attribute  in its .ini file for OPML import/export. I found this clever.
OmniOutliner Pro follows the spec 2.0 for the first attribute, calling it "text", and then it's the names of columns for further attributes.  leoOPML currently would uses <leo:body> for the body text, apparently. I suppose accepting anything that comes in for that "body text" second attribute during import and keeping it for export would be a good idea. If the file is first exported by Leo, then of course <leo:body> is fine. Additional @settings could be used to clarify this, or maybe not. I hope I'm not making a fool of myself here...


On Wednesday, August 31, 2022 at 5:06:53 PM UTC+2 tbp1...@gmail.com wrote:

Edward K. Ream

unread,
Aug 31, 2022, 6:24:20 PM8/31/22
to leo-editor
On Wednesday, August 31, 2022 at 4:52:38 PM UTC-5 chr...@gmail.com wrote:
tbp1...@gmail.com, I don't know if you are a developer or member of the Leo team, so I'm not sure if the info I'm sending is useful, please let me know.

Please continue this discussion offline.

When you have resolved the issues, please feel free to file a bug report.

Edward

tbp1...@gmail.com

unread,
Aug 31, 2022, 7:33:56 PM8/31/22
to leo-editor
I've done some Leo development, both plugins and internals.  I'm not very familiar with most of Leo and not at all with this plugin.  If you can get an email to me at my gmail address, I'll send you the email I actually want to use, and maybe we can make some progress.

chr...@gmail.com

unread,
Sep 1, 2022, 6:44:35 AM9/1/22
to leo-editor
OK, but all I can see here is  tbp1...@gmail.com

tbp1...@gmail.com

unread,
Sep 1, 2022, 7:28:52 AM9/1/22
to leo-editor
Sometimes I can get Groups to show the full address, but usually not when I really want to.  My gmail address, if Groups doesn't obfuscate it, is


I hardly ever remember to look at it, as it's not the address I want to use for most of my correspondence, but I'll be looking now.

As for the OPML plugin, I don't know what the author's concept of operations was, but for round-tripping OPML files it has at least two problems:

1. It didn't import the second column (body text) from your 2nd example file;
2. The write command writes a Leo file with an "OPML" extension, not an OPML file.  This file can't be even be reused by Leo unless the extension were changed to ".leo".

Actually there is another thing wrong with it.  It isn't very Leonine.  The example OPML file opened with all the top-level nodes at the top level in the outline.  That means you could not have more than one OPML file per Leo outline.  But to get the most out of Leo, you should be able to have any number of OPML files in one outline (probably but not necessarily related.  The OPML files could be organized into subtrees that make sense to you.  The typical Leo-like way to do this is to have the OPML file's representation in Leo start with a node whose headline starts with @opml path-to-file.  There would be a command that - when you selected a node in that file's subtree - would write the OPML file for that entire file.

Anyway, send me your email address, and we'll go on from there.

Thomas Passin

unread,
Sep 1, 2022, 12:01:21 PM9/1/22
to leo-editor
Let's try that again.  Maybe this will be usable:

"tbp100
dot
tp"
[this line intentionally left blank]
"at"
[this line intentionally left blank]
Reply all
Reply to author
Forward
0 new messages