Git Product home page Git Product logo

pyorgmode's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyorgmode's Issues

Broken tests

Hey, not sure what's the issue exaclty, but I think this commit b5aa934 broke tests in 'test_dates.py'

It would be advisable you provide some examples of usage.

I am trying your PyOrgMode module, and I cannot figure out the hierarchy of the objects, properties and methods. I beg your pardon: it is my lack of python oop knowledge.

May I ask you to provide the community some examples, specially about moving from one node to another, and get the node properties?

Miguel Ruiz
12-18 yr Physics Teacher
Sevilla, SPAIN.

PyPi version has no OrgDataStructure

The pypi version seems to be out of data and lacks the OrgDataStructure class.
I fixed it by installing directly from git, but it would be nice to have a working pypi version for a requirements.txt file.

Parse DEADLINE/SCHEDULED/CLOSED on the same line

My version of org-mode inserts the DEADLINE, SCHEDULED and CLOSED keywords all on the same line:

*** DONE report a PyOrgMode issue for parsing multiple keywords on a line
SCHEDULED: <2011-03-27 Sun> DEADLINE: <2011-03-28 Mon> CLOSED: [2011-03-29 Tue 09:46]

PyOrgMode doesn't seem to parse this correctly.

Links in headlines confused as priority cookies

Thanks for this great library! I recently tried to use it to parse a file with links in headlines, and I think PyOrgMode may have confused the beginning of the link syntax with a priority cookie, which ended up causing a few other problems.

Before:

* [[http://github.com][Github]] :tag:

After:

* [#http://github.com][Github]

Note that the outermost brackets are lost, as was the tag, and a "#" was inserted.

The relevant section of the org-mode syntax doc says:

A headline is defined as:

STARS KEYWORD PRIORITY TITLE TAGS

STARS is a string starting at column 0, containing at least one asterisk (and up to org-inlinetask-min-level if org-inlinetask library is loaded) and ended by a space character. The number of asterisks is used to define the level of the headline. It’s the sole compulsory part of a headline.

KEYWORD is a TODO keyword, which has to belong to the list defined in org-todo-keywords-1. Case is significant.

PRIORITY is a priority cookie, i.e. a single letter preceded by a hash sign # and enclosed within square brackets.

TITLE can be made of any character but a new line. Though, it will match after every other part have been matched.

TAGS is made of words containing any alpha-numeric character, underscore, at sign, hash sign or percent sign, and separated with colons.

It looks like PRIORITY needs the "#", and it seems that TITLE is permissive enough to support links. I'll submit a PR shortly with a fix that worked for me.

Need to support direct connection to Emacs-Orgmode (through org-protocol ?)

This should be done. It will provide :

  • Possibilities to edit/add/… directly from a file
  • Use the orgmode way to do things (not re-inventing the wheel each time)
  • Ways to export the files easily

Maybe allowing an org-babel with python to manipulate buffers through org-protocol would be a nice idea. I don't know…

Scheduled Todos dont have schedule date

Hi,

When loading a todo list, Todos don t have scheduled date even if there are in my todo file :

b = PyOrgMode.OrgDataStructure()
b.load_from_file('test.org')
for t in base.extract_todo_list():
    print(a.scheduled)

So i maybe not use it correctly ...

* TODO Test 1
SCHEDULED: <2018-09-25 Tue>
[2018-09-17 Mon 21:37]

Multiple tags not parsed nor serialized properly

Hi, and thank you for this useful library.
On a node with multiple tags, such as this:

     ** Renew servers :work:urgent:

What I get is an OrgElement with tags attribute ['work', 'urgent'] (fine) but with heading Renew servers :work

On the serialization side, if I create an OrgElement with tags ['work', 'urgent'] and heading Renew servers, I'll get this:

     ** Renew servers :work::urgent:

I have some working code that corrects this, that I'm willing to submit properly, but I noticed while reviewing the existing tests test.org has such a line.

* TAGS TEST :TAG1::TAG2:

Since I'm a somewhat limited user of org-mode, I wonder if there's anything actually intentional in this

REQUESTED: samples of OrgDrawer

Let's say this sample doc.org

  • Sample node with properties
    :PROPERTIES:
    :Property1: Value1
    :Property2: Value2
    :END:

And the code

import PyOrgMode
tree = PyOrgMode.DataStructure()
tree.load_from_file('doc.org')

print tree.root.content[0] #It prints full node

How can i get the full drawer, and the properties one by one?

properties not saved in same sequence as original file

having fun with this library and I noticed that it doesn't keep the order of properties as found in original file.

original:

* DONE Call john
CLOSED: [2019-01-24 Thu 13:22] SCHEDULED: <2019-01-23 Wed 20:45>

new saved:

* DONE Call john
SCHEDULED: <2019-01-23 Wed 20:45> CLOSED: [2019-01-24 Thu 13:22]

is there a reason for this ? semantically it doesn't matter much for orgmode but it would be nice this library could avoid being "destructive" in its edits.

First heading with subheadings eats all subsequent top-level headings

Consider a test.org file:

* one
* two
** two point one
* three
* four

and a script test.py:

import PyOrgMode
tree = PyOrgMode.DataStructure()
tree.load_from_file('test.org')
for item in tree.root.content:
    print item.heading, len(item.content)

Running this script with test.org from above produces:

one 0
two 3

In other words, heading "one" has no subheadings but heading "two" has three subheadings. The correct output would be:

one 0
two 1
three 0
four 0

tags not being returned by OrgNode plugin

but I think this fixes it. It did in my case (with and without links in the headline)

PyOrgMode.py:487
was

 heading_without_links = re.sub(" \[(.+)\]","",heading[0][2])

should be

 heading_without_links = re.sub(" \[(.+)\]","",heading[0][3])

EDIT: I accidentally removed a leading space in that re, having previously thought that was the issue. It works with or without the space, from what I see.

extract_todo_list not working.

When I try to get the list of todos from a file I get nothing and I'm sure that file contains TODOs. I'm doing like this:

def getTODOS():
    base = PyOrgMode.OrgDataStructure()
    base.load_from_file("index.org")

    print('archivo cargado')

    states = base.get_todo_states('todo')
    todos = base.extract_todo_list(states)

    for t in todos:
        print(t)`

it's an issue or is code error?

TODO parsing with context?

I'm writing a script to scrape org-mode TODOs, and move them to a status screen (or maybe to RTM). But, after going through the TODO's, I have no context. For example:

* Big Project
** TODO: Step one
** TODO: Step Two
Some stuff about step two
***Some more stuff about step two
** TODO: Step three

When I grab the todos, I have this:
TODO: Step one
TODO: StepTwo
TODO: Step three

But there's no links or references so I can tell that the TODO is a child of Big Project, or that Step Two has some child details.

Thoughts?

REQUEST: want support for CLOCK timestamps

PyOrgMode already supported SCHEDULED and DEADLINE timestamps. I request for support CLOCK timestamp lists. It is important feature for integration with orgmode's timetracking and building custom agenda views with python.

Date not parsed properly

Loading an org file of mine throws this error:

Traceback (most recent call last):
File "", line 1, in
File "/Users/bayerj/devel/third-party/PyOrgMode/PyOrgMode.py", line 487, in load_from_file
current = plugin.treat(current,line)
File "/Users/bayerj/devel/third-party/PyOrgMode/PyOrgMode.py", line 135, in treat
return self._treat(current,line.lstrip(" \t"))
File "/Users/bayerj/devel/third-party/PyOrgMode/PyOrgMode.py", line 240, in _treat
self._append(current,self.Element(scheduled, deadline,closed))
File "/Users/bayerj/devel/third-party/PyOrgMode/PyOrgMode.py", line 257, in init
self.scheduled = OrgDate(scheduled)
File "/Users/bayerj/devel/third-party/PyOrgMode/PyOrgMode.py", line 49, in init
self.set_value(value)
File "/Users/bayerj/devel/third-party/PyOrgMode/PyOrgMode.py", line 83, in set_value
self.value = time.strptime(value,"%H:%M")
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/_strptime.py", line 454, in _strptime_time
return _strptime(data_string, format)[0]
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/_strptime.py", line 325, in _strptime
(data_string, format))
ValueError: time data '2011-07-27 Wed 19:00 -1w +1w' does not match format '%H:%M'

some tests not passing

I'm trying to use this module, and ran the tests. Unfortunately, two of them seem to fail. Am I missing some modules at all ?

$ python ./test_clock.py

ERROR: test_duration_format (main.TestClockElement)

Durations are formatted identically to org-mode

Traceback (most recent call last):
File "./test_clock.py", line 15, in test_duration_format
formatted_str = orgdate_element.get_value()
File "/home/fleury/TEMP/PyOrgMode/PyOrgMode.py", line 187, in get_value
'{start}{date}{repeat}{end}'.format(**fmt_dict), self.value)
AttributeError: OrgDate instance has no attribute 'value'


$ python ./test.py

ERROR: test_test_org (main.TestExampleOrgFile)

Traceback (most recent call last):
File "./test.py", line 26, in test_test_org
test.save_to_file("output.org")
File "/home/fleury/TEMP/PyOrgMode/PyOrgMode.py", line 747, in save_to_file
output.write(str(node))
File "/home/fleury/TEMP/PyOrgMode/PyOrgMode.py", line 260, in str
return self.output()
File "/home/fleury/TEMP/PyOrgMode/PyOrgMode.py", line 253, in output
return self.indent+self._output()
File "/home/fleury/TEMP/PyOrgMode/PyOrgMode.py", line 531, in _output
output = output + element.str()
File "/home/fleury/TEMP/PyOrgMode/PyOrgMode.py", line 260, in str
return self.output()
File "/home/fleury/TEMP/PyOrgMode/PyOrgMode.py", line 253, in output
return self.indent+self._output()
File "/home/fleury/TEMP/PyOrgMode/PyOrgMode.py", line 531, in _output
output = output + element.str()
File "/home/fleury/TEMP/PyOrgMode/PyOrgMode.py", line 260, in str
return self.output()
File "/home/fleury/TEMP/PyOrgMode/PyOrgMode.py", line 253, in output
return self.indent+self._output()
File "/home/fleury/TEMP/PyOrgMode/PyOrgMode.py", line 531, in _output
output = output + element.str()
File "/home/fleury/TEMP/PyOrgMode/PyOrgMode.py", line 260, in str
return self.output()
File "/home/fleury/TEMP/PyOrgMode/PyOrgMode.py", line 253, in output
return self.indent+self._output()
File "/home/fleury/TEMP/PyOrgMode/PyOrgMode.py", line 355, in _output
output = output + "SCHEDULED: "+self.scheduled.get_value()+" "
File "/home/fleury/TEMP/PyOrgMode/PyOrgMode.py", line 187, in get_value
'{start}{date}{repeat}{end}'.format(**fmt_dict), self.value)
AttributeError: OrgDate instance has no attribute 'value'


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.