Re: jupyter files

2017-08-30 Thread Edward K. Ream
On Tue, Aug 29, 2017 at 6:04 AM, Josef  wrote:

>
>
> On Saturday, 26 August 2017 19:40:47 UTC+2, Edward K. Ream wrote:
>>
>> On Sat, Aug 26, 2017 at 8:30 AM, Josef  wrote:
>>
>> I was hoping to be able to read into an @clean node instead of using
>>> @auto or @nosent, as I need to cooperate with others, not using Leo.
>>>
>>
>> ​Why is this a problem?  Just read the file into @auto the first time,
>> then change it to @clean.​
>>
>
> Doh! Of course that is the simplest solution and works fine for the latex
> files.
>


> It won't work out of the box for jupyter files, since these contain all
> kind of stuff which should not go into the normal python node bodies,
> but still need to be written back if we want to round-trip jupyter files.
> If that other stuff is moved out of the way to be able to run jupyter
> files as scripts in Leo, then we will have to undo this moving out of the
> way when writing jupyter files back.
>

​I don't remember what the "other stuff" is, but perhaps it could be moved
into uA's.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Tabular data in Leo outlines

2017-08-30 Thread Edward K. Ream
On Tue, Aug 29, 2017 at 9:55 AM, Arjan  wrote:

> I'd like to work with tabular data in my Leo outlines, such that the table
> structure is visualized inside a node body (aligned column widths) and a
> key binding should facilitate navigation/data entry (e.g. tab jumps to next
> column). In other words, it should work roughly like OrgMode tables.
>

​I have just created #546
 for this. ​ In
February of this year I began work on tables.py (in LeoPluginsRef.leo), but
have done nothing with it since.

I've started looking at this and it seems the basic transformations aren't
> too problematic. But, I'm not very experienced with Python (or other
> languages, for that matter), nor with Leo plugins. I've made a first very
> rough version which seems to work for the basics. So my questions are: Is
> the idea in general likely to work well in Leo? And, how terrible is the
> attached approach? ;)
>

​I would welcome any help you could give. You might find some of the code
in tables.py useful, or not.
​

> I've made an @button with two functions (see below): text_to_table() turns
> lines with |-separators into a list of lists (rows containing cells), and
> align_table() aligns the columns in such a table using whitespace, and
> returns the whole thing as a string.
>
> Some specifics I'm wondering about now:
> 1) Is it possible to re-assign e.g. the tab key to trigger the alignment,
> but only on nodes of a new type (say @tabular)?
>

​Anything is possible, given enough work. Leo already has special cases for
the tab key, so rather than mess with bindings themselves, scripts (or
tables.py) could monkey-patch the code.

The code is in question is the updateTab helper of the
EditCommandsClass.selfInsertCommand method, in
leo/commands/editCommands.py.

As you can see, there is a lot going on there, and in the doPlainTab and
updateAutoIndent helpers.  But that is where I might look.

But for testing I would just define some new commands, and bind some other
keys to those commands.  Later, if you really want to, I would look at
"overloading" the tab key.
​

> 2) Would same be possible for a newly defined "@language tabular", so it
> would work on just the tabular section of a node?
>

​Maybe.  Again, I would focus on the alignment code first, and leave the
frills for later.
​

> 3) The current approach relies on number of characters for aligning, so a
> mono-spaced font is required. Is it possible to use a particular font for
> just a particular node type (or language)?
>

​Sure, if you work really hard.  I would stick with using blanks (with a
mono font) for starters.
​

> 4) Or are there ways of aligning text other than via mono-spaced fonts?
>

​You could use hard tabs, but that will create other problems.  I recommend
using blanks.
​

> 5) Is it feasible to use two different vnode body formats, where the GUI
> format would use the whitespace and visual separator such as |, but the
> on-disk format would be transformed to CSV or tab-separated plain text
> (stripped of the extra alignment whitespace)?
>

​Let me answer this "sideways".  I actually don't remember anything about
my original intentions for tables.py, but almost surely they were based on
trying to duplicate org-mode's table editing

as closely as possible.​  I recommend that you do the same, which means, I
think, that all you should be trying to do is insert '|' and space
characters automagically.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Tabular data in Leo outlines

2017-08-30 Thread Josef
Just a few pointers relating to the topic:

Recent versions of the Zim-wiki (written in Python) feature a table plug-in 
using a gtk widget to edit the table, which is then stored in plain text 
format.

Org-mode defines a couple of textual table formats and Emacs org-mode has 
some neat features for editing such tables (in e-lisp of course).

Restructured Text has again a slightly different textual table format.

I would like to see alignment of LaTeX tables (yet again different textual 
table format).

I think (re-)alignment alone is not enough. Switching, deleting and adding 
columns would be greatly appreciated features.

Currently I edit CSV tables simply with LibreOffice Calc, though that is 
not ideal, because Calc (and more so Excel) tends to interpret some input 
in a specific way (for example, text looking like dates in the locale 
become date entries), which is annoying.

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.