A library for working with Org files. Specifically, this provides utilities for:
- Parsing Org text to an AST (Abstract Syntax Tree)
- Regenerating Org text from an AST
- Basic manipulation and analysis of an Org document AST
- Generating basic representations Org content in the terminal, and a few other forms.
With the exception of some of the particularly fancy capabilities provided by
org-mode (like Babel and Calc-based spreadsheeting), this project aims to
exactly match the interpretation of Org mode markup — specifically the AST
generated by org-element.el. This goal is not yet achieved, however
the bulk of the work is now complete.
Org.jl implements the vast majority of the org-syntax document (see the
Progress table). This can be checked by looking at Org.compatability in
Julia.
# after installing with ~] add Org~ or ~Pkg.add("Org")~
using Org
text1 = org"Some *Org* markup, written with ease using the ~org\"\"~ macro."
parsetree(text1) # show the generated parse tree
text2 = parse(OrgDoc, "Some *Org* markup, written with ease using the ~parse~ function.")
diff(text1, text2) # show the components of the parse trees that differ
dochead = @doc Org.Heading # the documentation for the Heading component (::OrgDoc)
org(dochead) # generate Org text that produces the Org.Heading object
string(dochead) # as above, but produces a String
parse(OrgDoc, string(dochead)) == dochead # round-trip equality
# get the lang of each source block
[c.lang for c in dochead.components if c isa Org.SourceBlock]| Component | Type | Parse | Org | Term | HTML |
|---|---|---|---|---|---|
| Heading | X | X | X | X | X |
| Section | X | X | X | X | X |
| Affiliated Keywords | X | X | X | X | |
| GreaterBlock | X | X | X | X | X |
| Drawer | X | X | X | X | X |
| DynamicBlock | X | X | X | X | X |
| FootnoteDefinition | X | X | X | X | |
| InlineTask | X | ||||
| Item | X | X | X | X | X |
| List | X | X | X | X | X |
| PropertyDrawer | X | X | X | X | X |
| Table | X | X | X | X | X |
| BabelCall | X | X | X | X | X |
| Block | X | X | X | X | |
| Clock | X | X | X | X | |
| DiarySexp | X | X | X | X | |
| Planning | X | X | X | X | |
| Comment | X | X | X | X | X |
| FixedWidth | X | X | X | X | X |
| HorizontalRule | X | X | X | X | X |
| Keyword | X | X | X | X | |
| LaTeXEnvironment | X | X | X | X | |
| NodeProperty | X | X | X | X | X |
| Paragraph | X | X | X | X | X |
| TableRow | X | X | X | X | X |
| TableHRule | X | X | X | X | X |
| BlankLine | X | X | X | X | X |
| OrgEntity | X | X | X | X | X |
| LaTeXFragment | X | X | X | X | |
| ExportSnippet | X | X | X | X | X |
| FootnoteReference | X | X | X | X | X |
| InlineBabelCall | X | X | X | X | X |
| InlineSrcBlock | X | X | X | X | X |
| RadioLink | X | X | X | X | X |
| PlainLink | X | X | X | X | X |
| AngleLink | X | X | X | X | X |
| RegularLink | X | X | X | X | X |
| LineBreak | X | X | X | X | X |
| Macro | X | X | X | X | X |
| Citation | X | X | X | X | X |
| RadioTarget | X | X | X | X | X |
| Target | X | X | X | X | X |
| StatisticsCookie | X | X | X | X | X |
| Subscript | X | X | X | X | X |
| Superscript | X | X | X | X | X |
| TableCell | X | X | X | X | X |
| Timestamp | X | X | X | X | X |
| TextPlain | X | X | X | X | X |
| TextMarkup | X | X | X | X | X |