Recommended place to store common functions?
Hi everyone! Been using Leo for a while and I love it. One thing that alludes me is - what's considered best coding practice for storing Leo specific python code that I'd reuse elsewhere? For instance, sometimes I have outline specific commands that make call the undoer to make undoing easier. However, I also have some commands at a global level stored in myLeoSettings.leo that also call this undoer function. Since the code is specific to Leo, but sometimes shared across projects, where should I store the helper functions to keep it reusable across my outlines? Thanks, Sapphira Armageddos -- 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: Ready to release 5.8 final?
There might be these bugs were filed earlier for editing files with an external editor: https://github.com/leo-editor/leo-editor/issues/981 https://github.com/leo-editor/leo-editor/issues/977 I think the root cause is the same. I did write a fix for my local copy of Leo, but wanted to know if there was a reason Leo behaved like this for editing with an external editor. On Wednesday, September 26, 2018 at 3:02:12 AM UTC-7, Edward K. Ream wrote: > > There seem to be no significant bugs reported against 5.8 b1. > > Matt, are you good with releasing 5.8 final? > > 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: Need help with bidirectional relationships with differing commentary on each side
Took the time to do a writeup for additional clarity. The below describes the kinds of relationships a character node in the Leo file I'm working on would have, but I'm not sure if this is the right approach. Currently relationships use UNLs to denote which characters they affect in their body text. --- *Relationship Nodes* A relationship node should only contain other relationships. This is to show that this relationship spawned other relationships. Do not clone any nodes that aren't relationships into them. There are a few kinds of relationships that are important for tracking a character. *Hierarchical Ties* Hierarchical ties show when one character came before the other, or when one character strictly has command over another. Some examples of hierarchical ties include chains of command and families. Technically this should be okay as a tree, but, characters contain a lot of child nodes that are not their offspring or subordinates. Why? Character nodes have data that only concern themselves. It's also impossible to avoid cluttering all the involved people nodes if done that way. *Equal Ties* These are cyclical, but don't have differing data for each viewpoint. Common examples of these include coworkers, friends, and classmates. *Asymmetric* These are cyclical, but different data for each viewpoint. Common examples of these include predator and prey; teacher and student; so on so forth. -- 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.
Need help with bidirectional relationships with differing commentary on each side
Hi everyone! Been cruising along since I started getting the hang of Leo and scripting for it. I'm having a bit of trouble figuring out what I should do to handle the problem below. Say I have a piece of data that has the following relationships: Character<-(is in)->Setting Character<-(is in)->Story (separate file) Species-(is a)->Character Character-(parent of)->Character Character<-(friend of)->Character Right now I'm handling where a character is from and what species they are as clones under those category bins. But I'm not sure how I should represent family relationships or if they're in a certain story. Stories I keep in separate files from my world building data Leo file. My current solutions seem to be: - UNLs: Straightforward, but can lead to needing to manually copy the individual UNLs to track bidirectional relationships across files. Also allows for commentary on those relationships. - Backlinks: Tried the plugin, liked it, but, storing additional data for the relationship (name, commentary) requires an intermediate node. Sometimes that commentary differs per character despite it being the same relationship type. Also doesn't handle cross file bidirectional relationships. Has anyone else encountered similar use cases? If so, what did you do to solve such? If not, what would you recommend to look into? Thanks, Sapphira -- 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: Way to export/ignore headlines like markdown auto exporter, but across any file type?
Finished reading through the documentation for g.findRootsWithPredicate. That helps with what I'm looking for! It's a still bit daunting reading through the Leo documentation, but I think I'm getting used to it. I found it's easier to Ctrl+F through the Leo doc files inside of Leo. On Tuesday, August 21, 2018 at 3:29:28 AM UTC-7, Edward K. Ream wrote: > > On Mon, Aug 20, 2018 at 3:54 AM Sapphira Armageddos < > shadowkyo...@gmail.com > wrote: > > Is there a cleaner way, file type agnostic way to do this without using a >> write-only @auto node? I'm not sure how to handle node inclusion with >> @others to control output of the headline. >> > > It sounds like you are comfortable writing scripts, so I would suggest a > script that would write a selected tree to a file. Some tips: > > 1. g.getScript(p) will create the script as though p were the root node, > expanding section references, etc. This has several kwargs that you will > want to set appropriately. > > 2. g.findRootsWithPredicate will search up and down the tree for desired > roots, just like the rst3 and pylint commands. > > HTH. Please feel free to ask more questions. > > 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: Control Headline Output in a File Agnostic Manner?
Ooh, I see. I just didn't group the rst nodes together. I placed them under an organization node for file releases and it made all the files now. Thanks! -- 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: Control Headline Output in a File Agnostic Manner?
Hi George! Read through the documentation for the rst3 command and it does exactly what I want! I edited my example to use the rst directives and it works like how I have my asciidoc files structured. Is there a way to also On Monday, August 20, 2018 at 11:44:42 AM UTC-7, Chris George wrote: > > Hi Sapphira, > > I too use Leo for writing. Luckily I discovered Leo over a decade ago and > only had legacy txt and doc files to deal with when building a workflow. > > Leo's rst handling does exactly what you want. > > Asciidoctor will convert asciidoc to docbook. Pandoc will convert docbook > to rst. I am not sure how robust this would be for your application but > once you have your content as rst, you should be good to go. Read through > the rst section in the Leo docs to see if it will meet your needs. > > HTH, > > Chris > > > On Mon, Aug 20, 2018 at 1:54 AM Sapphira Armageddos < > shadowkyo...@gmail.com > wrote: > >> Hi everyone! I just discovered Leo yesterday and love it. It makes it a >> lot easier to keep track of my characters across settings. >> >> I'm not sure how to control the output of headlines with @others, though. >> There was an example of that in markdown's auto exporter, so I copied that >> for asciidoc since the plugin for asciidoc is currently broken (It doesn't >> work with the current API, and most of my stories were converted to >> asciidoc format when I decided to hop off of Google Drive). >> >> I attached both the copied exporter and a Leo file showing how I normally >> organize stories outside of Leo. Some nodes I want to keep their names, as >> they represent important sections of a story (main title, chapter title, so >> on so forth). Other nodes, however, I don't want to keep their names since >> it detracts. Examples of this are scenes I may want to rearrange into >> different chapters later on. >> >> The @auto nodes indicate file releases for the story and its chapters. >> >> Reading the documentation for @others suggests that the body is always >> glued in the output file, but no option to include the headline in the >> output. The closest example to what I'm looking for is the Flatten Outline >> export, but it doesn't handle selectively outputting the headline when >> needed. >> >> Is there a filetype agnostic way to do this? Using a write-only @auto >> node doesn't seem right. >> >> (( PS: If you see a similar post appear in leo-editor, it might be >> because I double posted this and didn't know if it went through. )) >> >> -- >> 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+...@googlegroups.com . >> To post to this group, send email to leo-e...@googlegroups.com >> . >> Visit this group at https://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 https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
Way to export/ignore headlines like markdown auto exporter, but across any file type?
Hi everyone! Just discovered Leo yesterday and started organizing some of my worldbuilding documents. It's going great, but I'm running into a bit of a stump with getting it to manage my asciidoc files for my stories. Above is an example story project format that's similar to how I have my stories organized outside of Leo. Currently I've tweaked a copy of the MarkdownWriter class to handle exporting to asciidoc, but haven't coded an importer for asciidoc. The current asciidoc plugin isn't updated with the current Leo API, hence why I did this approach. It works, but, it's not exactly clean in a design sense. I'm pretty sure not having an auto importer to go with the writer might break a few things (I just don't know which atm). The closest thing I'm looking for would be to Flatten Selected Outline (since I just want Leo to handle setting section depth for an asciidoc file depending on where it is). Sometimes I also want the node names in the output. The use case I have for this would be stories released in a chapter by chapter format, but allow easily exporting the full story. Nodes that I wouldn't want to have their names expanded in full would be scenes. Is there a cleaner way, file type agnostic way to do this without using a write-only @auto node? I'm not sure how to handle node inclusion with @others to control output of the headline. -- 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. story-project.leo Description: Binary data #@+leo-ver=5-thin #@+node:ekr.20140726091031.18073: * @file writers/markdown.py '''The @auto write code for markdown.''' # pylint: disable=unused-import import leo.core.leoGlobals as g import leo.plugins.writers.basewriter as basewriter #@+others #@+node:ekr.20140726091031.18075: ** class AsciidocWriter class AsciidocWriter(basewriter.BaseWriter): '''The writer class for markdown files.''' # def __init__(self,c): # basewriter.BaseWriter.__init__(self,c) #@+others #@+node:ekr.20140726091031.18076: *3* adocw.write def write(self, root): """Write all the *descendants* of an @auto-asciidoc node.""" # Fix bug 66: errors inhibited read @auto foo.adoc. # New in Leo 5.5: Skip !headlines. Convert all others to '#' sections. self.root = root self.write_root(root) for p in root.subtree(): if hasattr(self.at, 'force_sentinels'): self.put_node_sentinel(p, '// ', delim2='') self.write_headline(p) # Ensure that every section ends with exactly two newlines. s = p.b.rstrip() + '\n\n' lines = s.splitlines(False) for s in lines: if not g.isDirective(s): self.put(s) root.setVisited() return True #@+node:ekr.20141110223158.20: *3* adocw.write_headline def write_headline(self, p): ''' Write or skip the headline. New in Leo 5.5: Always write '#' sections. This will cause perfect import to fail. The alternatives are much worse. ''' level = p.level() - self.root.level() assert level > 0, p.h kind = p.h and p.h[0] if kind == '!': pass # The signal for a declaration node. # elif kind in '=-': # self.put(p.h) # self.put(kind*max(4,len(p.h))) else: self.put('=%s %s' % ('='*level, p.h)) #@+node:ekr.20171230170642.1: *3* adocw.write_root def write_root(self, root): '''Write the root @auto-org node.''' lines = [z for z in g.splitLines(root.b) if not g.isDirective(z)] for s in lines: self.put(s) #@-others #@-others writer_dict = { '@auto': ['@auto-adoc','@auto-asciidoc',], 'class': AsciidocWriter, 'extensions': ['.adoc',], } #@@language python #@@tabwidth -4 #@-leo
Control Headline Output in a File Agnostic Manner?
Hi everyone! I just discovered Leo yesterday and love it. It makes it a lot easier to keep track of my characters across settings. I'm not sure how to control the output of headlines with @others, though. There was an example of that in markdown's auto exporter, so I copied that for asciidoc since the plugin for asciidoc is currently broken (It doesn't work with the current API, and most of my stories were converted to asciidoc format when I decided to hop off of Google Drive). I attached both the copied exporter and a Leo file showing how I normally organize stories outside of Leo. Some nodes I want to keep their names, as they represent important sections of a story (main title, chapter title, so on so forth). Other nodes, however, I don't want to keep their names since it detracts. Examples of this are scenes I may want to rearrange into different chapters later on. The @auto nodes indicate file releases for the story and its chapters. Reading the documentation for @others suggests that the body is always glued in the output file, but no option to include the headline in the output. The closest example to what I'm looking for is the Flatten Outline export, but it doesn't handle selectively outputting the headline when needed. Is there a filetype agnostic way to do this? Using a write-only @auto node doesn't seem right. (( PS: If you see a similar post appear in leo-editor, it might be because I double posted this and didn't know if it went through. )) -- 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. #@+leo-ver=5-thin #@+node:ekr.20140726091031.18073: * @file writers/markdown.py '''The @auto write code for markdown.''' # pylint: disable=unused-import import leo.core.leoGlobals as g import leo.plugins.writers.basewriter as basewriter #@+others #@+node:ekr.20140726091031.18075: ** class AsciidocWriter class AsciidocWriter(basewriter.BaseWriter): '''The writer class for markdown files.''' # def __init__(self,c): # basewriter.BaseWriter.__init__(self,c) #@+others #@+node:ekr.20140726091031.18076: *3* adocw.write def write(self, root): """Write all the *descendants* of an @auto-asciidoc node.""" # Fix bug 66: errors inhibited read @auto foo.adoc. # New in Leo 5.5: Skip !headlines. Convert all others to '#' sections. self.root = root self.write_root(root) for p in root.subtree(): if hasattr(self.at, 'force_sentinels'): self.put_node_sentinel(p, '// ', delim2='') self.write_headline(p) # Ensure that every section ends with exactly two newlines. s = p.b.rstrip() + '\n\n' lines = s.splitlines(False) for s in lines: if not g.isDirective(s): self.put(s) root.setVisited() return True #@+node:ekr.20141110223158.20: *3* adocw.write_headline def write_headline(self, p): ''' Write or skip the headline. New in Leo 5.5: Always write '#' sections. This will cause perfect import to fail. The alternatives are much worse. ''' level = p.level() - self.root.level() assert level > 0, p.h kind = p.h and p.h[0] if kind == '!': pass # The signal for a declaration node. # elif kind in '=-': # self.put(p.h) # self.put(kind*max(4,len(p.h))) else: self.put('=%s %s' % ('='*level, p.h)) #@+node:ekr.20171230170642.1: *3* adocw.write_root def write_root(self, root): '''Write the root @auto-org node.''' lines = [z for z in g.splitLines(root.b) if not g.isDirective(z)] for s in lines: self.put(s) #@-others #@-others writer_dict = { '@auto': ['@auto-adoc','@auto-asciidoc',], 'class': AsciidocWriter, 'extensions': ['.adoc',], } #@@language python #@@tabwidth -4 #@-leo story-project.leo Description: Binary data