emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Announcing my Python module to read org-mode files
@ 2009-03-15  3:37 Charles Cave
  2009-03-15  8:35 ` Ian Barton
  2009-03-16 18:28 ` Mark Elston
  0 siblings, 2 replies; 5+ messages in thread
From: Charles Cave @ 2009-03-15  3:37 UTC (permalink / raw)
  To: emacs-orgmode

Over the last couple of months I have developed a Python module
to read an org-mode file and return the nodes as a list
of objects.  The module is the basis of a Python/TK GUI
program to display a "Word of the Day" (another article
will be published about this program soon).

Here is the article (and source code)
http://members.optusnet.com.au/~charles57/GTD/orgnode.html

This is an example of what the module can do:

import Orgnode
nodelist = Orgnode.makelist("newgtd.org")

print "\n--------- PROJECT LIST ----------------"
for node in nodelist:
   if node.Tag() == "PROJECT":
       print "[ ]", node.Heading()


I hope the module is of interest to Python programmers!

Charles

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Announcing my Python module to read org-mode files
  2009-03-15  3:37 Announcing my Python module to read org-mode files Charles Cave
@ 2009-03-15  8:35 ` Ian Barton
  2009-03-16 18:28 ` Mark Elston
  1 sibling, 0 replies; 5+ messages in thread
From: Ian Barton @ 2009-03-15  8:35 UTC (permalink / raw)
  To: emacs-orgmode

> Over the last couple of months I have developed a Python module
> to read an org-mode file and return the nodes as a list
> of objects.  The module is the basis of a Python/TK GUI
> program to display a "Word of the Day" (another article
> will be published about this program soon).
> 
> I hope the module is of interest to Python programmers!
> 
Charles,

That looks very interesting. Amongst other uses it opens the way to 
produce customized Web pages via mod_python, which in some circumstances 
would be easier than tweaking the current org export function.

I have been experimenting with producing html exported pages optimized 
for my Nokia N95. At the moment I detect the browser string and then 
apply a different style sheet for the mobile version. However, this does 
have limitations, apart from those arising from my lack of css skills.

Using mod_python I can produce completely different output depending on 
the detected browser.

Ian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Announcing my Python module to read org-mode files
  2009-03-15  3:37 Announcing my Python module to read org-mode files Charles Cave
  2009-03-15  8:35 ` Ian Barton
@ 2009-03-16 18:28 ` Mark Elston
  2009-03-17  1:22   ` Charles Cave
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Elston @ 2009-03-16 18:28 UTC (permalink / raw)
  To: emacs-orgmode

Charles,

* Charles Cave wrote (on 3/14/2009 8:37 PM):
> Over the last couple of months I have developed a Python module
> to read an org-mode file and return the nodes as a list
> of objects.  The module is the basis of a Python/TK GUI
> program to display a "Word of the Day" (another article
> will be published about this program soon).
> 

This looks interesting.  I had started a thread about a month
ago dealing with reading and writing org files from an external
process.  I already was extracting data from external sources
and writing these files but I didn't have a way of effectively
*updating* these files, only overwriting them.  This looks like
what I was looking for to allow me to accomplish this.

The only thing better would be a way to use this package to
update the nodes and then write them back out.  Hmmmmm......

Mark

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Announcing my Python module to read org-mode files
  2009-03-16 18:28 ` Mark Elston
@ 2009-03-17  1:22   ` Charles Cave
  2009-03-17  1:40     ` Mark Elston
  0 siblings, 1 reply; 5+ messages in thread
From: Charles Cave @ 2009-03-17  1:22 UTC (permalink / raw)
  To: emacs-orgmode

Mark Elston <m.elston <at> advantest-ard.com> writes:
 
> The only thing better would be a way to use this package to
> update the nodes and then write them back out.  Hmmmmm......

The changes to the package to write the node output out are...

1. A means of storing the org-mode preamble .. all the lines before
the first headline.  Maybe this could be in a node with level 0
and headline of null. The bodytext of this object could be
the preamble lines.

2. A method to output a node in ord-mode format echoing the
** prefix, TODO tag, headline, tags, properties and body text.

3. The module currently discards lines beginning with #.
These should now be preserved.

I wouldnt imagine this being a great deal of work.
I will add this to my (very long list) of things to do!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: Announcing my Python module to read org-mode files
  2009-03-17  1:22   ` Charles Cave
@ 2009-03-17  1:40     ` Mark Elston
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Elston @ 2009-03-17  1:40 UTC (permalink / raw)
  Cc: emacs-orgmode



* Charles Cave wrote (on 3/16/2009 6:22 PM):
> Mark Elston <m.elston <at> advantest-ard.com> writes:
>  
>> The only thing better would be a way to use this package to
>> update the nodes and then write them back out.  Hmmmmm......
> 
> The changes to the package to write the node output out are...
> 
> 1. A means of storing the org-mode preamble .. all the lines before
> the first headline.  Maybe this could be in a node with level 0
> and headline of null. The bodytext of this object could be
> the preamble lines.
> 
> 2. A method to output a node in ord-mode format echoing the
> ** prefix, TODO tag, headline, tags, properties and body text.
> 
> 3. The module currently discards lines beginning with #.
> These should now be preserved.
> 
> I wouldnt imagine this being a great deal of work.
> I will add this to my (very long list) of things to do!
> 

Actually, for my purposes, I think the problem is simpler.  As these
files are automatically generated (and, eventually, updated) the
preamble is 'pre-defined' for each file.  It could be written out
new each time the file is updated.  So #1 and #3 are non-issues as far
as I am concerned.

#2 is, of course, the primary issue.  I will probably need to deal with
properties as I get more involved in 'tweaking' my generators so I am
thrilled to see you already support them.

Mark

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-17  1:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-15  3:37 Announcing my Python module to read org-mode files Charles Cave
2009-03-15  8:35 ` Ian Barton
2009-03-16 18:28 ` Mark Elston
2009-03-17  1:22   ` Charles Cave
2009-03-17  1:40     ` Mark Elston

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).