org_parser 0.1.1+1

  • Readme
  • Changelog
  • Example
  • Installing
  • new60

org_parser #

An Org-mode parser for Dart.

Usage #

For displaying Org-mode documents in Flutter applications, see org_flutter. For an example application that displays Org-mode documents with org_parser and org_flutter, see orgro.

This package allows you to parse raw Org-mode documents into a structured in-memory representation.

import 'package:org_parser/org_parser.dart';

final doc = OrgDocument.parse('''* TODO [#A] foo bar
baz buzz''');
print(doc.children[0].headline.keyword); // TODO

See the example for more.

Caveats #

This parser was developed for an application that is halfway between pretty-printing and evaluating/interpreting, so in many cases the parsed structure does not split out constituent parts as thoroughly as needed for some applications.

Supported syntax #

  • Sections/headlines

      * TODO [#A] foo bar
    
  • Blocks

      #+BEGIN_SRC
      foo bar
      #+END_SRC
    
  • Affiliated keywords

      #+name: foo
    
  • Fixed-width areas

      : foo bar
      : baz buzz
    
  • Tables

      | foo | bar |
      |-----+-----|
      | biz | baz |
    
  • Lists

      - foo
        - [X] bar
          1. baz
          2. buzz
    
  • Drawers

      :PROPERTIES:
      foo bar
      :END:
    
  • Footnotes

      Foo bar[fn:1] biz buzz
    
      [fn:1] Bazinga
    
  • Links

      [[http://example.com][example]]
    
      http://example.com
    
  • Emphasis markup

      *bold* /italic/ _underline_ +strikethrough+ ~code~ =verbatim=
    
  • Timestamps

      [2020-05-05 Tue]
    
      <2020-05-05 Tue 10:00>
    
  • Macro references

      {{{kbd(C-c C-c)}}}
    

[0.1.1+1] - 2020-05-21 #

  • Add example

[0.1.1] - 2020-05-06 #

  • Added OrgTable.columnIsNumeric API for determining if a table column is primarily comprised of numbers

[0.1.0] - 2020-05-05 #

  • Initial release

example/example.dart

import 'package:org_parser/org_parser.dart';

void main() {
  const docString = '''* TODO [#A] foo bar
baz buzz''';
  final doc = OrgDocument.parse(docString);
  final section = doc.children[0];
  print(section.headline.keyword);
  final title = section.headline.title.children[0] as OrgPlainText;
  print(title.content);
  final paragraph = section.content.children[0] as OrgParagraph;
  final body = paragraph.body.children[0] as OrgPlainText;
  print(body.content);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  org_parser: ^0.1.1+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:org_parser/org_parser.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
25
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
60
Learn more about scoring.

We analyzed this package on May 23, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.1
  • pana: 0.13.8-dev

Health issues and suggestions

Document public APIs. (-0.15 points)

365 out of 376 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (petitparser).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
petitparser ^2.4.0 2.4.0 3.0.2
Transitive dependencies
meta 1.1.8
Dev dependencies
test ^1.12.0