Need help with orgparse?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

karlicoss
212 Stars 29 Forks BSD 2-Clause "Simplified" License 217 Commits 18 Opened issues

Description

Python module for reading Emacs org-mode files

Services available

!
?

Need anything else?

Contributors list

# 30,389
The Jul...
emacs-l...
julia-l...
auto-co...
146 commits
# 62,986
HTML
chromiu...
quantif...
Haskell
47 commits
# 188,755
Emacs
emacs-l...
keymap
HTML
6 commits
# 55,594
CSS
multiag...
medium
Sass
3 commits
# 705,197
CSS
Python
Shell
org-mod...
1 commit
# 470,436
Python
Shell
org
django-...
1 commit
# 16,307
Go
plainte...
Django
google-...
1 commit

===========================================================

orgparse - Python module for reading Emacs org-mode files

  • Documentation (Read the Docs) 
    _
  • Repository (at GitHub) 
    _
  • PyPI 
    _

Install

pip install orgparse

Usage

There are pretty extensive doctests if you're interested in some specific method. Otherwise here are some example snippets:

Load org node ^^^^^^^^^^^^^ ::

from orgparse import load, loads

load('PATH/TO/FILE.org') load(file_like_object)

loads('''

  • This is org-mode contents You can load org object from string.
    • Second header ''')

Traverse org tree ^^^^^^^^^^^^^^^^^

root = loads(''' ... * Heading 1 ... ** Heading 2 ... *** Heading 3 ... ''') for node in root[1:]: # [1:] for skipping root itself ... print(node) * Heading 1 ** Heading 2 *** Heading 3 h1 = root.children[0] h2 = h1.children[0] h3 = h2.children[0] print(h1) * Heading 1 print(h2) ** Heading 2 print(h3) *** Heading 3 print(h2.getparent()) * Heading 1 print(h3.getparent(max_level=1)) * Heading 1

Accessing node attributes ^^^^^^^^^^^^^^^^^^^^^^^^^

root = loads(''' ... * DONE Heading :TAG: ... CLOSED: [2012-02-26 Sun 21:15] SCHEDULED: <2012-02-26 Sun> ... CLOCK: [2012-02-26 Sun 21:10]--[2012-02-26 Sun 21:15] => 0:05 ... :PROPERTIES: ... :Effort: 1:00 ... :OtherProperty: some text ... :END: ... Body texts... ... ''') node = root.children[0] node.heading 'Heading' node.scheduled OrgDateScheduled((2012, 2, 26)) node.closed OrgDateClosed((2012, 2, 26, 21, 15, 0)) node.clock [OrgDateClock((2012, 2, 26, 21, 10, 0), (2012, 2, 26, 21, 15, 0))] bool(node.deadline) # it is not specified False node.tags == set(['TAG']) True node.getproperty('Effort') 60 node.getproperty('UndefinedProperty') # returns None node.get_property('OtherProperty') 'some text' node.body ' Body texts...'

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.