Skip to content

dahu/vimpeg-orgmode-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simplified Org-Mode Parser

Note
If you have the vim-type-datetime library installed, vimpeg-parser-orgmode will parse orgmode style dates and store them internally in a sortable, comparable, adjustable format.

Quick Overview

:call WriteOrgModeFile(ReadOrgModeFile('sample.orgmode'), 'out.orgmode')
:let orgdata = ReadOrgModeFile('sample.orgmode')

For the provided sample.orgmode file, the resulting orgdata is:

Note
The following does not show vim-type-datetime dates, but rather simple textual representations, as will happen when you don’t have vim-type-datetime installed.
{
  'directives': [
    ['TITLE:', 'My Personal Todo file'],
    ['AUTHOR:', 'Some One'],
    ['EMAIL:', 'some.one@gmail.com'],
    ['FILETAGS:', 'PERSONAL']
  ],
  'headlines': [
    {
      'contents': [],
      'drawers': [],
      'level': 1,
      'metadata': {},
      'priority': '',
      'tags': '',
      'title': 'Tasks',
      'todo': ''
    },
    {
      'contents': [],
      'drawers': [['PROPERTIES', [{'name': 'Effort', 'value': '0:30'}]]],
      'level': 2,
      'metadata': {},
      'priority': '',
      'tags': '',
      'title': ' Revisit Medical Insurance, get Another covered by it as well',
      'todo': 'TODO'
    },
    {
      'contents': ['Some arbitrary content'],
      'drawers': [
        [
          'PROPERTIES',
          [{'name': 'Cost', 'value': '100.00'}, {'name': 'Effort', 'value': '2:00'}]
        ]
      ],
      'level': 2,
      'metadata': {'CLOSED': {'type': 'datetime', 'value': '2014-05-29 Thu 17:57'}},
      'priority': '',
      'tags': '',
      'title': ' Not Working with unicode charaters.',
      'todo': 'DONE'
    },
    {
      'contents': ['Some more arbitrary content'],
      'drawers': [],
      'level': 3,
      'metadata': {
        'CLOSED': {'type': 'datetime', 'value': '2014-01-25 Sat 19:36'},
        'DEADLINE': {'type': 'date', 'value': '2014-01-24 Fri'}
      },
      'priority': '',
      'tags': '',
      'title': ' Visit Gas Agency',
      'todo': 'DONE'
    }
  ]
}
:call WriteOrgModeFile(orgdata, 'sample.orgmode')
Note
Currently WriteOrgModeFile() will throw an exception if the target file already exists.

About

Example vimpeg parser for a simplified orgmode format

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published