Re: Advices for a leo cub - Want to turn Leo into basic Sphinx editor

2014-11-12 Thread Matt Wilkie
 I think I had a look at every c submodules... So stupid I am !


heheh. But look how smart you are now, you've seen it, and a whole new
world opened up. :)

I'm striving to look for those Doh! moments as often as possible. Bring
'em on! It means I'm learning. (It wasn't always that way, I used to be too
worried about looking silly, and learning was slower because of it.)

-matt

-- 
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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Advices for a leo cub - Want to turn Leo into basic Sphinx editor

2014-11-11 Thread Davy Cottet

Thanks every one for your contribution to this subject.
I have to accept that I got a bit lost on the discussion about databases 
;)... anyway, i got a lot of useful informations there.

- @Edward : 
*At present, Leo's core rst related code is, of course, based on 
reStructuredText, not sphinx.  I have no real opinion about whether using 
sphinx as a foundation would simplify things.​*  I think you gave me more 
complicated intentions that are mines... 
By the way, does that mean that *@bool rst3_call_docutils = False* make Leo 
use Sphinx for generating html (externally, that's the point) but still use 
docutil to generate rst files ? I don't think that's really a limitation 
(at least to begin), but I do not really know yet which rst features are 
exclusively brought by Sphinx. 

*I use sphinx in a stylized way, after creating rST .txt files.* In fact, 
that's also what I wanted to do, but just by adding some menu/command 
shortcuts to run sphinx make commands and configure settings plus by 
integrating sphinx file/folder structure into a .leo model file (if 
possible...). 

- From Kent  Thierry exchanges, I deduce that converting a leo tree 
structure to a folder/file structure is not as trivial as I thought... If I 
understand well, active-path.py does only the other way ? Are'nt @file  
@auto able to generate real files ? Are folders the main problem ? 

- @Kent*Such that the great idea above wouldn't require a .leo file but 
could live in a @tree node (or some such)*. I think that's exactly what I 
mean : this template idea (maybe I should call it model ?) is no to 
create another setting type .leo file but a standalone project file 
including all settings needed for user to easily work with sphinx 
(including file/folder structure). To be clear, a user would have simply to 
download it, open it, and modify directly it's content with his custom 
parameters, rst contents, templates, Sphinx settings

- In my mind, the sweet spot would be to build the most simple and ready 
to use interface (ie menus) for a very specific task. Sphinx documentation 
is the first of them as it involve, I think, much less complexity than a 
Django project for which we could buid a lot of more complex features (ie 
shortcuts to create new models, views, urls, Templates...). And the fact is 
that this Leo based Sphinx editor would be really useful to document any of 
my further Leo  Phyton projects ;)

- Sorry Edward, but I don't really understand what you mean by *perhaps 
you can devise a simpler way to drive the script from outline data..*. But 
I think that's why I'm lost on the database discussion part :D


PS : a very practical question to finish : which Leo command return the 
path of the currently opened .leo project ?

-- 
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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Advices for a leo cub - Want to turn Leo into basic Sphinx editor

2014-11-11 Thread 'Terry Brown' via leo-editor
On Tue, 11 Nov 2014 19:56:24 -0800 (PST)
Davy Cottet cottet.d...@gmail.com wrote:

 - From Kent  Thierry exchanges, I deduce that converting a leo tree 
 structure to a folder/file structure is not as trivial as I
 thought... If I understand well, active-path.py does only the other
 way ? Are'nt @file  @auto able to generate real files ? Are folders
 the main problem ? 

I don't think there's a problem here - @file and @auto nodes *do*
create real files, and sub-folders as needed.  You can use nested @path
nodes, active-path.py just makes that a bit tidier - active-path.py is
focused mainly on file system - Leo, but that's because Leo core
handles Leo - file system.

Cheers -Terry

-- 
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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Advices for a leo cub - Want to turn Leo into basic Sphinx editor

2014-11-11 Thread Matt Wilkie
On Tue, Nov 11, 2014 at 7:56 PM, Davy Cottet cottet.d...@gmail.com wrote:

 PS : a very practical question to finish : which Leo command return the
 path of the currently opened .leo project ?


It's very complicated:

c

:)From the scripting page
http://leoeditor.com/scripting.html#positions:

   - c is the commander of the outline containing the script.

To echo the file name to the log pane, put this in a body pane and hit
[Ctrl-B]. g is global, es is echo-screen (I think):

g.es(c)

-matt

-- 
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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Advices for a leo cub - Want to turn Leo into basic Sphinx editor

2014-11-11 Thread Davy Cottet
Really ?  g.es(c) ! :D
I think I had a look at every c submodules... So stupid I am !
Thanks for that !

-- 
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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Advices for a leo cub - Want to turn Leo into basic Sphinx editor

2014-11-10 Thread Edward K. Ream
On Sun, Nov 9, 2014 at 11:56 AM, Davy Cottet cottet.d...@gmail.com wrote:

​ ​
My idea
​ [is] to turn Leo complexity to the most simple but complete Sphinx editor.

That's a great idea.  Leo's rst commands do indeed have way too many hidden
features.  Maybe the set of features used by all of Leo's features is a
largish subset of those features, but if we can do without them so much the
better!

​ ​
it could be possible to build a kind of Leo-Sphinx-template.leo containing
all the needs of a sphinx project, without even modifying Leo's code and
writing a new plugin.

​Interesting idea.  At present, Leo's core rst related code is, of course,
based on reStructuredText, not sphinx.  I have no real opinion about
whether using sphinx as a foundation would simplify things.​

​QQQ​QQ
1 - First thing would be to give this template all the file/folder
structure required by Shinx (build,sources, statics, templates, setup.py,
Makefile...).

2 - Perhaps use attrib-edit-py to graphically configure conf.py
parameters... otherwise, maybe just link to edit conf.py or maybe a new
directive for every parameter (probably useless...)

3 - Make new menus by introducing right @settings and @commands (and even
delete some default scary ones for newbies and useless for basic Sphinx
use).

For example I though about this kind of simple structure for this
sphinx-template.leo:

@settings
@menus
@menu Sphinx
@item Configure  (gui edit for conf.py ?) or @item Edit conf.py
and @item Edit conf.py
@item -
@menu make
@item ReST
​[snip]​

@item html
@item epub
...
@menu Open
@item html
@item pdf
@item epub

That seems really easy to call make html or other make commands since it's
always from the root folder.

​[snip]​
​Q​

Seems reasonable.

​ ​
So, I wonder if I'm right thinking of customization with this kind of
sphinx-template.leo (eg not using myLeoSettings.leo and not using plugin
system).

​The best, most stable code is code that doesn't need to be written.  So
I'm all for it :-)​

​ ​
Does Leo users use to share this kind of personal customized .leo file (I'm
aware about security problem...). Are there a lot of Sphinx/Leo users ?

​It's hard to say anything for sure about Leo users because we don't know
what percentage of them contribute to this group.  All I can say is that it
is not common *here* to share .leo files.  However, it would clearly be
possible to add entries to leoSettings.leo, or to put a sphinx-template
file into the leo/config folder.  It would then be conceivable to add
support for a my-sphinx-template file...​

​ ​
Do you think it would be a good idea to build this kind of templates for
vari
​o​
us basic needs (we could think about other static blog
​g​
ing tools like Pelican and this type of editing usages...), I mean
different set of menus for different use ?
Personally I think that could be a good way to make the power of Leo to
really help people without programming skills.

​Yes, I think it would be a great idea.​

​ ​
Anyway, I'm beginning scripting around Leo An enjoy it. Thanks to the devs
for offering that great tool to us python hackers
​ :)

You're welcome.

Just so the NSA understands (yes, they *are* monitoring this conversation),
I assume that you are using the word hacker in the sense that it first
had about 40 years ago, namely a person who like to mess around with the
internals of systems in order to understand it.  Since then, the word
hacker has acquired much darker meanings :-)

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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Advices for a leo cub - Want to turn Leo into basic Sphinx editor

2014-11-10 Thread 'Terry Brown' via leo-editor
On Mon, 10 Nov 2014 08:01:36 -0600
Kent Tenney kten...@gmail.com wrote:

 Does Leo currently offer the ability to define a tree
 structure template? I seem to recall this.
 
 Such that the great idea above wouldn't require a .leo file
 but could live in a @tree node (or some such)

Rings a very vague bell for me too, although nothing specific, it might
be a long time ago.

But I'm sure there are a lot of systems that ready to go tree layouts
would be good for, Sphinx but also Django, the Python web framework, it
has a somewhat complicated directory layout that is much easier to
manage with Leo.  OTOH active-path.py plugin is quite good for pulling
in the layout after it's been created on disk by the Django utils.
Hard to know where the sweet spot is for this.

Cheers -Terry

 On Mon, Nov 10, 2014 at 7:05 AM, Edward K. Ream edream...@gmail.com
 wrote:
  On Sun, Nov 9, 2014 at 11:56 AM, Davy Cottet
  cottet.d...@gmail.com wrote:
 
 
  My idea
  [is] to turn Leo complexity to the most simple but complete Sphinx
  editor.
 
  That's a great idea.  Leo's rst commands do indeed have way too
  many hidden features.  Maybe the set of features used by all of
  Leo's features is a largish subset of those features, but if we can
  do without them so much the better!
 
 
  it could be possible to build a kind of Leo-Sphinx-template.leo
  containing all the needs of a sphinx project, without even
  modifying Leo's code and writing a new plugin.
 
  Interesting idea.  At present, Leo's core rst related code is, of
  course, based on reStructuredText, not sphinx.  I have no real
  opinion about whether using sphinx as a foundation would simplify
  things.
 
  Q
  1 - First thing would be to give this template all the file/folder
  structure required by Shinx (build,sources, statics, templates,
  setup.py, Makefile...).
 
  2 - Perhaps use attrib-edit-py to graphically configure conf.py
  parameters... otherwise, maybe just link to edit conf.py or maybe a
  new directive for every parameter (probably useless...)
 
  3 - Make new menus by introducing right @settings and @commands
  (and even delete some default scary ones for newbies and useless
  for basic Sphinx use).
 
  For example I though about this kind of simple structure for this
  sphinx-template.leo:
 
  @settings
  @menus
  @menu Sphinx
  @item Configure  (gui edit for conf.py ?) or @item Edit
  conf.py and @item Edit conf.py
  @item -
  @menu make
  @item ReST
  [snip]
 
  @item html
  @item epub
  ...
  @menu Open
  @item html
  @item pdf
  @item epub
 
  That seems really easy to call make html or other make commands
  since it's always from the root folder.
 
  [snip]
  Q
 
  Seems reasonable.
 
 
  So, I wonder if I'm right thinking of customization with this kind
  of sphinx-template.leo (eg not using myLeoSettings.leo and not
  using plugin system).
 
  The best, most stable code is code that doesn't need to be
  written.  So I'm all for it :-)
 
 
  Does Leo users use to share this kind of personal customized .leo
  file (I'm aware about security problem...). Are there a lot of
  Sphinx/Leo users ?
 
  It's hard to say anything for sure about Leo users because we don't
  know what percentage of them contribute to this group.  All I can
  say is that it is not common *here* to share .leo files.  However,
  it would clearly be possible to add entries to leoSettings.leo, or
  to put a sphinx-template file into the leo/config folder.  It would
  then be conceivable to add support for a my-sphinx-template file...
 
 
  Do you think it would be a good idea to build this kind of
  templates for vari
  o
  us basic needs (we could think about other static blog
  g
  ing tools like Pelican and this type of editing usages...), I mean
  different set of menus for different use ?
  Personally I think that could be a good way to make the power of
  Leo to really help people without programming skills.
 
  Yes, I think it would be a great idea.
 
 
  Anyway, I'm beginning scripting around Leo An enjoy it. Thanks to
  the devs for offering that great tool to us python hackers
  :)
 
  You're welcome.
 
  Just so the NSA understands (yes, they *are* monitoring this
  conversation), I assume that you are using the word hacker in the
  sense that it first had about 40 years ago, namely a person who
  like to mess around with the internals of systems in order to
  understand it.  Since then, the word hacker has acquired much
  darker meanings :-)
 
  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 

Re: Advices for a leo cub - Want to turn Leo into basic Sphinx editor

2014-11-10 Thread Fidel N
I have been trying to define tree-structures-templates ever since I got
into Leo. Always trying to create useful-for-more-than-myself templates.
But the problem is what Terry just said, I often found it very difficult to
find the sweet spot, in which they are easy to document and understand,
and useful to you.
That can only be solved through experience on what you want, and most of
the times everyone's needs will be different so I guess that answers to why
you cant find many Leo files with templates to do cool things with them :P



On Mon, Nov 10, 2014 at 6:08 PM, 'Terry Brown' via leo-editor 
leo-editor@googlegroups.com wrote:

 On Mon, 10 Nov 2014 08:01:36 -0600
 Kent Tenney kten...@gmail.com wrote:

  Does Leo currently offer the ability to define a tree
  structure template? I seem to recall this.
 
  Such that the great idea above wouldn't require a .leo file
  but could live in a @tree node (or some such)

 Rings a very vague bell for me too, although nothing specific, it might
 be a long time ago.

 But I'm sure there are a lot of systems that ready to go tree layouts
 would be good for, Sphinx but also Django, the Python web framework, it
 has a somewhat complicated directory layout that is much easier to
 manage with Leo.  OTOH active-path.py plugin is quite good for pulling
 in the layout after it's been created on disk by the Django utils.
 Hard to know where the sweet spot is for this.

 Cheers -Terry

  On Mon, Nov 10, 2014 at 7:05 AM, Edward K. Ream edream...@gmail.com
  wrote:
   On Sun, Nov 9, 2014 at 11:56 AM, Davy Cottet
   cottet.d...@gmail.com wrote:
  
  
   My idea
   [is] to turn Leo complexity to the most simple but complete Sphinx
   editor.
  
   That's a great idea.  Leo's rst commands do indeed have way too
   many hidden features.  Maybe the set of features used by all of
   Leo's features is a largish subset of those features, but if we can
   do without them so much the better!
  
  
   it could be possible to build a kind of Leo-Sphinx-template.leo
   containing all the needs of a sphinx project, without even
   modifying Leo's code and writing a new plugin.
  
   Interesting idea.  At present, Leo's core rst related code is, of
   course, based on reStructuredText, not sphinx.  I have no real
   opinion about whether using sphinx as a foundation would simplify
   things.
  
   Q
   1 - First thing would be to give this template all the file/folder
   structure required by Shinx (build,sources, statics, templates,
   setup.py, Makefile...).
  
   2 - Perhaps use attrib-edit-py to graphically configure conf.py
   parameters... otherwise, maybe just link to edit conf.py or maybe a
   new directive for every parameter (probably useless...)
  
   3 - Make new menus by introducing right @settings and @commands
   (and even delete some default scary ones for newbies and useless
   for basic Sphinx use).
  
   For example I though about this kind of simple structure for this
   sphinx-template.leo:
  
   @settings
   @menus
   @menu Sphinx
   @item Configure  (gui edit for conf.py ?) or @item Edit
   conf.py and @item Edit conf.py
   @item -
   @menu make
   @item ReST
   [snip]
  
   @item html
   @item epub
   ...
   @menu Open
   @item html
   @item pdf
   @item epub
  
   That seems really easy to call make html or other make commands
   since it's always from the root folder.
  
   [snip]
   Q
  
   Seems reasonable.
  
  
   So, I wonder if I'm right thinking of customization with this kind
   of sphinx-template.leo (eg not using myLeoSettings.leo and not
   using plugin system).
  
   The best, most stable code is code that doesn't need to be
   written.  So I'm all for it :-)
  
  
   Does Leo users use to share this kind of personal customized .leo
   file (I'm aware about security problem...). Are there a lot of
   Sphinx/Leo users ?
  
   It's hard to say anything for sure about Leo users because we don't
   know what percentage of them contribute to this group.  All I can
   say is that it is not common *here* to share .leo files.  However,
   it would clearly be possible to add entries to leoSettings.leo, or
   to put a sphinx-template file into the leo/config folder.  It would
   then be conceivable to add support for a my-sphinx-template file...
  
  
   Do you think it would be a good idea to build this kind of
   templates for vari
   o
   us basic needs (we could think about other static blog
   g
   ing tools like Pelican and this type of editing usages...), I mean
   different set of menus for different use ?
   Personally I think that could be a good way to make the power of
   Leo to really help people without programming skills.
  
   Yes, I think it would be a great idea.
  
  
   Anyway, I'm beginning scripting around Leo An enjoy it. Thanks to
   the devs for offering that 

Re: Advices for a leo cub - Want to turn Leo into basic Sphinx editor

2014-11-10 Thread Edward K. Ream
On Mon, Nov 10, 2014 at 12:34 PM, Fidel N fidelpe...@gmail.com wrote:

I have been trying to define tree-structures-templates ever since I got
 into Leo. Always trying to create useful-for-more-than-myself templates.
 But the problem is what Terry just said, I often found it very difficult
 to find the sweet spot, in which they are easy to document and
 understand, and useful to you.
 That can only be solved through experience on what you want, and most of
 the times everyone's needs will be different so I guess that answers to why
 you cant find many Leo files with templates to do cool things with them :P


​Very interesting direction this discussion is taking.

Before offering my two cents, you should be aware that I know very little
about django, python web framework or even sphinx.  I use sphinx in a
stylized way, after creating rST .txt files.

With this caveat, my opinion is that Leo scripts offer the ultimate in
flexibility.  That's a mixed blessing: it's easy to go overboard, as the
code for the rst3 command in leoRst.leo shows.​

Leo scripts are attractive because they have such easy access to both
outline data *and* its structure.  This suggest driving the script from
the outline data, which is really what the rst3 command does.  Perhaps you
can devise a simpler way to drive the script from outline data...

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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Advices for a leo cub - Want to turn Leo into basic Sphinx editor

2014-11-10 Thread Kent Tenney
I was wondering if there exists a syntax to describe a
tree structure in a node, like:

#headline
@tree myproject

#body
@auto index.html
@path style
@auto main.css
@auto simple.css
 @path js
 @auto model.js
 @auto view.js
 @auto controller.js

...

such that an rclick on @tree, or a command, would  create
the defined paths and files, sort of inverted active-path.



On Mon, Nov 10, 2014 at 12:49 PM, Edward K. Ream edream...@gmail.com wrote:
 On Mon, Nov 10, 2014 at 12:34 PM, Fidel N fidelpe...@gmail.com wrote:

 I have been trying to define tree-structures-templates ever since I got
 into Leo. Always trying to create useful-for-more-than-myself templates.
 But the problem is what Terry just said, I often found it very difficult
 to find the sweet spot, in which they are easy to document and understand,
 and useful to you.
 That can only be solved through experience on what you want, and most of
 the times everyone's needs will be different so I guess that answers to why
 you cant find many Leo files with templates to do cool things with them :P


 Very interesting direction this discussion is taking.

 Before offering my two cents, you should be aware that I know very little
 about django, python web framework or even sphinx.  I use sphinx in a
 stylized way, after creating rST .txt files.

 With this caveat, my opinion is that Leo scripts offer the ultimate in
 flexibility.  That's a mixed blessing: it's easy to go overboard, as the
 code for the rst3 command in leoRst.leo shows.

 Leo scripts are attractive because they have such easy access to both
 outline data *and* its structure.  This suggest driving the script from
 the outline data, which is really what the rst3 command does.  Perhaps you
 can devise a simpler way to drive the script from outline data...

 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 http://groups.google.com/group/leo-editor.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Advices for a leo cub - Want to turn Leo into basic Sphinx editor

2014-11-10 Thread Fidel N

 Leo scripts are attractive because they have such easy access to both
 outline data *and* its structure.  This suggest driving the script from
 the outline data, which is really what the rst3 command does.  Perhaps you
 can devise a simpler way to drive the script from outline data..


I am currently studying Database and XML standards history among other
things, (which never did before) and I realized that Leo database structure
is not the most modern one.

Codd's relational databases are the most widely used ones, and that is for
a reason (which I didnt imagine before having to study them hehe)
Also, I have been reading a lot about XML, and how businesses use it as
standard for sharing businesses information and processes.

So if you think about two of the most  successful ways to share information
and business processes, they have both:
- Extreme standardization for data structures and types definition (XML,
with the XML Schemas)
- Easiness to spread the data away from the information structure
(Relational databases)

Until Leo cant take the best of those two worlds, I think we will be tied
to have the same problems that our ancestors had when they used earlier
databases to the relational model suggested by Codd. There is simply no way
to separate the information away from the outlined data structure.

It was very enlightening to watch how normal forms are defined for data
structures https://www.youtube.com/watch?v=x9BuWCUQawY, and then again
that made me think my life-long strugle to be able to embed my data into
Leo with complete flexibility will fail, same as previous-to-Codd database
structures did.

Nevertheless, after the exams I intend to do, I will go on with the
research for this. Sorry if I said something out of ignorance, this is
still a very new ground for me.


On Mon, Nov 10, 2014 at 8:30 PM, Kent Tenney kten...@gmail.com wrote:

 I was wondering if there exists a syntax to describe a
 tree structure in a node, like:

 #headline
 @tree myproject

 #body
 @auto index.html
 @path style
 @auto main.css
 @auto simple.css
  @path js
  @auto model.js
  @auto view.js
  @auto controller.js

 ...

 such that an rclick on @tree, or a command, would  create
 the defined paths and files, sort of inverted active-path.



 On Mon, Nov 10, 2014 at 12:49 PM, Edward K. Ream edream...@gmail.com
 wrote:
  On Mon, Nov 10, 2014 at 12:34 PM, Fidel N fidelpe...@gmail.com wrote:
 
  I have been trying to define tree-structures-templates ever since I got
  into Leo. Always trying to create useful-for-more-than-myself templates.
  But the problem is what Terry just said, I often found it very difficult
  to find the sweet spot, in which they are easy to document and
 understand,
  and useful to you.
  That can only be solved through experience on what you want, and most of
  the times everyone's needs will be different so I guess that answers to
 why
  you cant find many Leo files with templates to do cool things with them
 :P
 
 
  Very interesting direction this discussion is taking.
 
  Before offering my two cents, you should be aware that I know very little
  about django, python web framework or even sphinx.  I use sphinx in a
  stylized way, after creating rST .txt files.
 
  With this caveat, my opinion is that Leo scripts offer the ultimate in
  flexibility.  That's a mixed blessing: it's easy to go overboard, as the
  code for the rst3 command in leoRst.leo shows.
 
  Leo scripts are attractive because they have such easy access to both
  outline data *and* its structure.  This suggest driving the script from
  the outline data, which is really what the rst3 command does.  Perhaps
 you
  can devise a simpler way to drive the script from outline data...
 
  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 http://groups.google.com/group/leo-editor.
  For more options, visit https://groups.google.com/d/optout.

 --
 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 http://groups.google.com/group/leo-editor.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 http://groups.google.com/group/leo-editor.
For more options, visit 

Re: Advices for a leo cub - Want to turn Leo into basic Sphinx editor

2014-11-10 Thread 'Terry Brown' via leo-editor
On Mon, 10 Nov 2014 21:34:27 +0100
Fidel N fidelpe...@gmail.com wrote:

 
  Leo scripts are attractive because they have such easy access to
  both outline data *and* its structure.  This suggest driving the
  script from the outline data, which is really what the rst3 command
  does.  Perhaps you can devise a simpler way to drive the script
  from outline data..
 
 I am currently studying Database and XML standards history among other
 things, (which never did before) and I realized that Leo database
 structure is not the most modern one.
 
 Codd's relational databases are the most widely used ones, and that

Had to Google that :-) I think for Codd's relational databases you
could write relational databases - it seems like Codd was responsible
for codifying the ideas we call relational databases now.

There's been work with Leo and databases before, Leo's data can be
expressed in a couple of tables:

The Nodes table:
  NodeID ID,
  Header Text, 
  Body Text

and the Links table:
  ParentNodeID ID,
  ChildNodeID ID,
  ChildPosition Int

(ignoring unknownAttributes for simplicity, and the fluff in the XML
for expanded nodes and last selected node.)

ParentNodeId and ChildNodeID would both have to reference NodeID.

Clones occur when the same NodeID occurs as the ChildNodeID in
more than one Link record.

This DB structure can represent loops which Leo can't handle, but
specifying that they can't exist is probably beyond the scope of an
RDBMS.

It's pretty trivial to translate Leo's data structure to these tables,
and it's been investigated for various applications (lazy loading,
collaboration) in the past.

I'm not sure if you've looked at Tree structures in RDBMSs yet, but
they are somewhat more cumbersome to handle than other data types,
because of the recursion needed to process them.  So even with a RDMS
as a back end, you probably end up with an iterator layer similar to
Leo's iterators.

Leo's XML doesn't have an XML-Schema definition, but it's fairly
simple, and if you use Leo's Python API (which is its only API :-) you
don't need to deal with it.

Leo's data structure is basically the Nodes and Links tables I
mentioned above, so there's no simple way to map arbitrary data into it
other than what works best for a particular application.  The
unknownAttributes v.u dict can be used for storing record like info. on
Leo nodes if that helps.

It's interesting to think about Leo from a RDMS point of view, but an
strong example of improvement to Leo by using one has never really
been put forward.  Do you have a particular example in mind?

Cheers -Terry

 is for a reason (which I didnt imagine before having to study them
 hehe) Also, I have been reading a lot about XML, and how businesses
 use it as standard for sharing businesses information and processes.
 
 So if you think about two of the most  successful ways to share
 information and business processes, they have both:
 - Extreme standardization for data structures and types definition
 (XML, with the XML Schemas)
 - Easiness to spread the data away from the information structure
 (Relational databases)
 
 Until Leo cant take the best of those two worlds, I think we will be
 tied to have the same problems that our ancestors had when they used
 earlier databases to the relational model suggested by Codd. There is
 simply no way to separate the information away from the outlined data
 structure.
 
 It was very enlightening to watch how normal forms are defined for
 data structures https://www.youtube.com/watch?v=x9BuWCUQawY, and
 then again that made me think my life-long strugle to be able to
 embed my data into Leo with complete flexibility will fail, same as
 previous-to-Codd database structures did.
 
 Nevertheless, after the exams I intend to do, I will go on with the
 research for this. Sorry if I said something out of ignorance, this is
 still a very new ground for me.
 
 
 On Mon, Nov 10, 2014 at 8:30 PM, Kent Tenney kten...@gmail.com
 wrote:
 
  I was wondering if there exists a syntax to describe a
  tree structure in a node, like:
 
  #headline
  @tree myproject
 
  #body
  @auto index.html
  @path style
  @auto main.css
  @auto simple.css
   @path js
   @auto model.js
   @auto view.js
   @auto controller.js
 
  ...
 
  such that an rclick on @tree, or a command, would  create
  the defined paths and files, sort of inverted active-path.
 
 
 
  On Mon, Nov 10, 2014 at 12:49 PM, Edward K. Ream
  edream...@gmail.com wrote:
   On Mon, Nov 10, 2014 at 12:34 PM, Fidel N fidelpe...@gmail.com
   wrote:
  
   I have been trying to define tree-structures-templates ever
   since I got into Leo. Always trying to create
   useful-for-more-than-myself templates. But the problem is what
   Terry just said, I often found it very difficult to find the
   sweet spot, in which they are easy to document and
  understand,
   and useful to you.
   That can only be solved through experience on what you want, and
   most of the times everyone's 

Re: Advices for a leo cub - Want to turn Leo into basic Sphinx editor

2014-11-10 Thread 'Terry Brown' via leo-editor
On Mon, 10 Nov 2014 15:12:15 -0600
'Terry Brown' via leo-editor leo-editor@googlegroups.com wrote:

 It's pretty trivial to translate Leo's data structure to these tables,

So just for amusement, here's some code that does that:

import sqlite3
con = sqlite3.connect(:memory:)
cur = con.cursor()
cur.execute(create table node (node gnx, head text, body text))
cur.execute(create table link (parentnode gnx, childnode gnx, childposition 
int))
for nd in c.all_unique_nodes():
cur.execute(insert into node values (?, ?, ?), [nd.gnx, nd.h, nd.b])
for n, child in enumerate(nd.children):
cur.execute(insert into link values (?, ?, ?), [nd.gnx, child.gnx, n])
ans = cur.execute(select count(*) from node)
g.es(ans.fetchone()[0], 'nodes')
ans = cur.execute(select count(*) from link)
g.es(ans.fetchone()[0], 'links')

using SQLite3 (included in Python) and PEP 249
http://legacy.python.org/dev/peps/pep-0249/

SQLite3 has loose typing so it accepts the unknown type name gnx, you
could use text in another RDMS.  The code doesn't create indexes or
enforce the existence of a corresponding Node record for each link
record, but that could be added.  The question is, now that the
outline's in a RDB, what to do with it?

Cheers -Terry

-- 
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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Advices for a leo cub - Want to turn Leo into basic Sphinx editor

2014-11-10 Thread Fidel N
Thank you Terry, those posts go to my To-study list for when I finish the
exam :D

On Mon, Nov 10, 2014 at 10:27 PM, 'Terry Brown' via leo-editor 
leo-editor@googlegroups.com wrote:

 On Mon, 10 Nov 2014 15:12:15 -0600
 'Terry Brown' via leo-editor leo-editor@googlegroups.com wrote:

  It's pretty trivial to translate Leo's data structure to these tables,

 So just for amusement, here's some code that does that:

 import sqlite3
 con = sqlite3.connect(:memory:)
 cur = con.cursor()
 cur.execute(create table node (node gnx, head text, body text))
 cur.execute(create table link (parentnode gnx, childnode gnx,
 childposition int))
 for nd in c.all_unique_nodes():
 cur.execute(insert into node values (?, ?, ?), [nd.gnx, nd.h, nd.b])
 for n, child in enumerate(nd.children):
 cur.execute(insert into link values (?, ?, ?), [nd.gnx,
 child.gnx, n])
 ans = cur.execute(select count(*) from node)
 g.es(ans.fetchone()[0], 'nodes')
 ans = cur.execute(select count(*) from link)
 g.es(ans.fetchone()[0], 'links')

 using SQLite3 (included in Python) and PEP 249
 http://legacy.python.org/dev/peps/pep-0249/

 SQLite3 has loose typing so it accepts the unknown type name gnx, you
 could use text in another RDMS.  The code doesn't create indexes or
 enforce the existence of a corresponding Node record for each link
 record, but that could be added.  The question is, now that the
 outline's in a RDB, what to do with it?

 Cheers -Terry

 --
 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 http://groups.google.com/group/leo-editor.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Advices for a leo cub - Want to turn Leo into basic Sphinx editor

2014-11-10 Thread Edward K. Ream
On Mon, Nov 10, 2014 at 3:12 PM, 'Terry Brown' via leo-editor 
leo-editor@googlegroups.com wrote:


  I am currently studying Database and XML standards history among other
  things, (which never did before) and I realized that Leo database
  structure is not the most modern one.


​Now for something completely different ;-)

My brother Speed uses Leo as a DB, and claims Leo's view of the world is
essentially identical to this product: http://www.sentences.com/  YMMV.

I've asked Speed repeatedly to discuss how he uses .leo files as
self-contained DB's, but he's a busy guy...

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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.