If you should ever want to export your data from Leo, Leo can do that for 
you.  Leo's ordinary file saving methods will save your entire tree of 
cards.  If you follow the format suggested by my previous post, the 
resulting file will be easy to parse if you want to adapt it to some other 
system.  For example, a simple AWK script could split the file into 
individual cards, and other scripts could turn the gnx ids into navigation 
targets

The two easiest ways to do this are with @clean or @rst files.  For an 
@clean file, just add the directive *@others *to the bottom of the body of 
the first node (the "@clean" one).  Your tree could look like this:

@clean ~/data/zettel_output.txt
    your tree here...

When you save your outline, the @clean tree will be created and saved too.

If you opt for using an @rst tree, you can just select a node in the tree 
and invoke the minibuffer command *rst3*.  The *@others* directive is not 
necessary.  Your tree's top node could look like this:

@clean ~/data/zettel_rst_output.rst

After saving this way, all your data will be contained in a largish text 
file.  You can process it with an RsT processor, just scroll through it by 
hand and edit anything you want, write a script to extract all the 
individual cards, convert it to XML or JSON and use XML or JSON tools on 
it, index it with a whole-text indexing system, or do any number of other 
things.

My next post will cover rendering cards or the tree of cards with 
Viewrendered3, and working with a set of individual cards using the new 
Freewin plugin.

On Thursday, June 17, 2021 at 11:18:23 PM UTC-4 [email protected] wrote:

> The card-case system needs each card to have a unique and permanent id 
> number.  This id is used for finding cross-referenced cards.  Leo creates a 
> unique id for each node, so I decided to use this identifier, known as a 
> *gnx*.  An example gnx is *tom.20210521095407.1*.  This id can be extracted 
> by a bit of code in a script.
>
> Make in last year's thread, I had suggested that our "zettel" cards could 
> be marked up with a bit of Restructured Text.  Identifiers and key words, 
> like the id, could be written in RsT's "Field List" format.  This would 
> make them easy to parse, and they would display very readably if rendered 
> as RsT.
>
> This format sets off the key word between colons, like this:
>
> :id: tom.20210521095407.1
> :seealso: tom.20210321135407.1
> :eventdate: 2021-05-21
>
> It also turned out to be very helpful to add the name of target cards to 
> the field list lines, and the name of the node as a header for the card.
>
> With these additions, the body of a card looks like this:
>
> William Collins
> ----------------
>
> :id: tom.20210520181722.1
> :created: 2021-05-20 18:17
> :type: person
>
> :tag: Collins Immigration
> :marriage: tom.20210605195824.1 `Collins-King`_
> :born: ~1615
> :died: 1687
>
> Born in Maidstone, Kent County, England.  Died at Isle of Wight County, VA.
>
> Immigration Into America
> ^^^^^^^^^^^^^^^^^^^^^^^^^
>
> William Collins emigrated from Kent County, England to King and Queen 
> County, VA in 1635 aboard the ship "Plain Jane".
>
> The two underlines tell RsT to render the previous line as different title 
> levels.  They are optional but look good in a RsT rendered view of a larger 
> part of a tree of cards.
>
> The backticks followed by an underscore are an optional markup that lets 
> an RsT processor turn them into clickable links to the target.  They do not 
> add much visual clutter, and allow for navigation in a rendered browser 
> view.
>
> A rendered view of a card or a subtree can be had using the Viewrendered3 
> plugin.  This plugin can also export the rendered HTML to your browser.
>
> The attached Leo outline contains the little scripts I use, together with 
> the key bindings I use for them.  You would put them into the *@settings* 
> tree of your card-case outline, or into *MyLeoSettings.leo* if you want 
> them available in all outlines.
>
> The two most used commands are *zettel-convert-card* (F8) and 
> *zettel-go-to-target* (F9).  When you select a node and press F8, the 
> current node will be converted into a zettel card.  This means that the 
> node headline is inserted with its underline as the title, and the id and 
> date fields are also inserted.
>
> When you select or put the cursor on a field list line that contains a gnx 
> as the second field, the selection jumps to the target card. This makes 
> navigation extremely fast and easy.
>
> Almost as important is *zettel-goto-with-backlink* (F6).  This jumps to 
> the target node like F9 but also inserts a backlink to the sending card if 
> the target does not already have one.  If the target has a backlink but the 
> backlink line does not contain a label, the script will insert the sending 
> card's title as the label.
>
> Since backlinks are a key feature of any zettelkasten system, this script 
> makes generating them accurate and nearly painless.
>
> The new backlink will be inserted as the first line of the target node, 
> with the generic name *:link:*.  You probably will want to move the line 
> somewhere else, and to replace the string `link` with something more 
> appropriate.  But even if you don't, navigation will still function 
> normally.
>
> The command *zettel-copy-gnx* (F7) lets you easily copy a card's gnx to 
> the clipboard so you can paste it into another card as a target.  Then F6 
> will take you to that target and insert a backlink.  Another F6 will add 
> the target's label to the link line of the sending card.  Now both cards 
> have been labeled and equipped with mutual backlinks.
>
> Pleas note that my original F8 script from last year had a bug that 
> sometimes inserted an incorrect gnx.  Also, it created entire new car, but 
> I find my new way of converting an existing node to be easier and quicker.
>
> To summarize this navigation system, the field list lines like
>
> :link: gnx label
>
> let you navigate to any crosslinked card within a leo outline, and the 
> optional RsT label/backtick/underscore markup lets you navigate in a 
> rendered view displayed in a web browser.
>
> You can also use any of Leo's search capabilities to search through the 
> cards.  I find the Nav pane to be especially good for this.
>
> In my next post, I will cover ways to get your data out of Leo if you need 
> to.  It can be very simple.
>
> On Thursday, June 17, 2021 at 11:10:26 PM UTC-4 [email protected] wrote:
>
>> Over a year ago we had a long thread on the "Zettelkasten" system:
>>
>> https://groups.google.com/g/leo-editor/c/TqiNdBfnEig
>>
>> To briefly reprise, a *zettelkasten* is a system for capturing and 
>> cross-linking of knowledge.  The term can be translated as "card case", and 
>> the original - or at least the one that became somewhat well known - 
>> comprises a set of index cards, a group of file drawers to store them, and 
>> a way of numbering the cards so that they cross-refer to other cards.  Each 
>> card (or "zettel") is expected to carry a short, narrowly focused, thought 
>> or essay-like paragraph about some topic.
>>
>> The system was written about by Niklas Luhmann, who apparently was wildly 
>> prolific as a writer and known for his deep knowledge of a number of fields 
>> of study.  He credited his zettelkasen with much of his success, referring 
>> to it as a second brain or a very smart companion.
>>
>> See, e.g., "Communicating with Slip Boxes by Niklas Luhmann":
>>
>> http://luhmann.surge.sh/communicating-with-slip-boxes
>>
>> Luhmann had developed a way of numbering and cross-linking his cards that 
>> seems to have worked extraordinarily well for him.
>>
>> The thread on Google Groups was mostly concerned with whether Leo could 
>> be used for such a system, and how that would work.  There are several 
>> software systems that claim to be designed for this purpose, but I didn't 
>> find any of them satisfactory, and it would generally have been hard to 
>> impossible to get your data back out in a usable form if you wanted to 
>> switch to another way of working.
>>
>> Eventually I distilled the points that had been discussed into a set of 
>> user requirements, and I realized that with a few simple scripts and a 
>> standard way of working, a zettelkasten system in Leo would be extremely 
>> easy and effective.
>>
>> One of the key points is to have a way to extract your data easily, which 
>> means working with a text format or something that can be converted to a 
>> text format easily. As you will see, that is quite simple.
>>
>> After all this, I got diverted and didn't do much with it until recently, 
>> a year and more later.  I wanted to capture some genealogy/family history 
>> data and organize it somehow.  So I have been working with the card-case 
>> system, and I've learned some practical things.  This has led me to 
>> slightly change the scripts, and to settle on a way to format and use the 
>> cards.  I think it's working really well, and I'd like to pass this 
>> experience along.
>>
>> I have attached the requirements I came up with along with some links to 
>> more material about this kind of system. In my next post I will talk about 
>> the card format and the scripts that make it all work.
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/ce29130d-48e4-4a93-a8e7-2eea92ddc936n%40googlegroups.com.

Reply via email to