org-ruby 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/History.org +205 -0
- data/README.org +217 -0
- data/bin/org-ruby +5 -1
- data/lib/org-ruby/html_output_buffer.rb +5 -0
- data/lib/org-ruby/line.rb +1 -1
- data/lib/org-ruby/markdown_output_buffer.rb +8 -1
- data/lib/org-ruby/output_buffer.rb +36 -0
- data/lib/org-ruby/parser.rb +8 -4
- data/lib/org-ruby/version.rb +1 -1
- metadata +19 -19
- data/History.txt +0 -196
- data/README.rdoc +0 -87
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 7d07a29896ee308b52b9825976e831dcfca958c5
|
|
4
|
+
data.tar.gz: cab39ec8f560b174c593fab6faa4c82b968e30be
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 6abb23cb0b3217a0fc85923f0af373a1c27c40d7887784cb638e9ac24e074e08eddb31611a4702f1ed0ddaddb392ef4463093ad386e91811cc2ffcd8ecf6da94
|
|
7
|
+
data.tar.gz: 0ae80c077087c8445affaea40039bb2b019036a0d0b5c17310ce758f853f75eb2238475f688db05948795f00f76988efb6cc7ce366d44bd7dcbd7e323f95ae9e
|
data/History.org
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# -*- mode: org; mode: auto-fill; -*-
|
|
2
|
+
#+title: Changelog
|
|
3
|
+
#+startup: showeverything
|
|
4
|
+
|
|
5
|
+
* 0.9.7 / 2014-06-22
|
|
6
|
+
|
|
7
|
+
- Custom markup support for exporters via YAML files (by [[https://github.com/gnusosa][@gnusosa]])
|
|
8
|
+
- Bugfix: Recognize =#+RESULTS:= block from named blocks
|
|
9
|
+
|
|
10
|
+
* 0.9.6 / 2014-05-06
|
|
11
|
+
|
|
12
|
+
- Support named results blocks
|
|
13
|
+
|
|
14
|
+
* 0.9.5 / 2014-04-24
|
|
15
|
+
|
|
16
|
+
- Small bugfix to remove warning due to VERSION being repeated
|
|
17
|
+
|
|
18
|
+
* 0.9.4 / 2014-04-18
|
|
19
|
+
|
|
20
|
+
- Track block names within the line properties
|
|
21
|
+
- Add option to skip-syntax-highlighting explicitly
|
|
22
|
+
|
|
23
|
+
* 0.9.3 / 2014-03-25
|
|
24
|
+
|
|
25
|
+
- Fix code blocks prepended comma stripping
|
|
26
|
+
|
|
27
|
+
* 0.9.2 / 2014-03-22
|
|
28
|
+
|
|
29
|
+
- Fix Org mode syntax for escaping html: Syntax actually now is =@@html:<text>@@=
|
|
30
|
+
|
|
31
|
+
- Fix '#=TITLE:' to render as a h1 headline
|
|
32
|
+
|
|
33
|
+
- Remove rewriting links to '.org' files as '.html'
|
|
34
|
+
|
|
35
|
+
- Implement :exports options for code blocks
|
|
36
|
+
|
|
37
|
+
* 0.9.1 / 2014-02-13
|
|
38
|
+
|
|
39
|
+
- Backport =CGI::escapeHTML= function from Ruby to have same output among different Ruby versions
|
|
40
|
+
|
|
41
|
+
* 0.9.0 / 2014-02-08
|
|
42
|
+
|
|
43
|
+
- Add explicit enable or disable of include file feature
|
|
44
|
+
- Add lang attribute to src code block to support syntax highlight in Github
|
|
45
|
+
|
|
46
|
+
* 0.8.3 / 2014-02-02
|
|
47
|
+
|
|
48
|
+
- Bugfix :: Two backslashes \\ at the end of the line make a line break without breaking paragraph.
|
|
49
|
+
- Bugfix :: Fix inline formatting not working for definition lists
|
|
50
|
+
- Add basic markdown exporter
|
|
51
|
+
|
|
52
|
+
* 0.8.2 / 2013-11-09
|
|
53
|
+
|
|
54
|
+
- Manage the #=INCLUDE tag in org files (contribution by pierre-lecocq)
|
|
55
|
+
- #=INCLUDE is disabled by default. Needs either ORG_RUBY_INCLUDE_ROOT or
|
|
56
|
+
ORG_RUBY_ENABLE_INCLUDE_FILES environment variables in order to be enabled.
|
|
57
|
+
- Link abbreviations with #=LINK tag are supported (by pierre-lecocq too, thanks!)
|
|
58
|
+
- Strip prepended commas added by Emacs Org mode to src/example blocks
|
|
59
|
+
|
|
60
|
+
* 0.8.1 / 2013-02-17
|
|
61
|
+
|
|
62
|
+
- Fix for html escaping when code is inline
|
|
63
|
+
|
|
64
|
+
* 0.8.0 / 2013-02-10
|
|
65
|
+
|
|
66
|
+
- A lot of refactoring work and bugfixes contributed by vonavi (many thanks!)
|
|
67
|
+
- Raw HTML is supported with #=html
|
|
68
|
+
- Code indentation for code blocks is fixed now
|
|
69
|
+
- Support for definition lists is improved
|
|
70
|
+
- Bugfix for when including headlines in center and quote blocks.
|
|
71
|
+
- Indentation of HTML output improved
|
|
72
|
+
- Improvements to entities support for Textile and HTML outputs
|
|
73
|
+
|
|
74
|
+
* 0.7.2 / 2012-10-07
|
|
75
|
+
|
|
76
|
+
- Many fixes to the regular expressions used for emphasis, contributed by [[http://github.com/vonavi][vonavi]]
|
|
77
|
+
- Bug fix for when a table starts with a headline, thanks to [[http://github/til][til]]
|
|
78
|
+
- Asterisk can be used for definition lists too
|
|
79
|
+
- Use text lexer as default option for Pygments and Coderay when no language is specified
|
|
80
|
+
|
|
81
|
+
* 0.7.1 / 2012-08-04
|
|
82
|
+
|
|
83
|
+
- Make source code blocks from lisp dialects use Pygments scheme lexer
|
|
84
|
+
- Bugfix: Make Coderay fallback to text lexer when unsupported lang is set
|
|
85
|
+
|
|
86
|
+
* 0.7.0 / 2012-07-08
|
|
87
|
+
|
|
88
|
+
- Highlight source code blocks using Pygments or CodeRay when available
|
|
89
|
+
|
|
90
|
+
* 0.6.4 / 2012-07-08
|
|
91
|
+
|
|
92
|
+
- Fixed lists behavior when code fragments, tables and examples were present
|
|
93
|
+
- Remove code tags with lang class and use instead src-:lang like org-exporter
|
|
94
|
+
- Fixed property drawers to consider properties with hyphens like :noweb-ref:
|
|
95
|
+
|
|
96
|
+
* 0.6.3 / 2012-05-22
|
|
97
|
+
|
|
98
|
+
- Minor enhancement: Correct handling of .org URIs in HTML markup routine (thanks, rayl)
|
|
99
|
+
|
|
100
|
+
* 0.6.1 / 2012-04-14
|
|
101
|
+
|
|
102
|
+
- Added encoding directive to support Ruby 1.9.2
|
|
103
|
+
- Headlines with the COMMENT keyword, and the PROPERTIES drawer are not exported
|
|
104
|
+
- Angle links in org-mode are embedded in anchor tags on html output
|
|
105
|
+
- #=BEGIN/END_SRC lang code blocks are embedded in code tags with class that specifies the coding language
|
|
106
|
+
- Fixed bug in code blocks when a colon was at the beginning
|
|
107
|
+
- More than five dashes create an horizontal rule in html output
|
|
108
|
+
|
|
109
|
+
* 0.6.0 / 2011-09-03
|
|
110
|
+
|
|
111
|
+
- Added support for a "header offset" -- turns one star into an H2, etc. (thanks, niku)
|
|
112
|
+
- The anchor text for a link can now be an image, and will get an img tag (thanks, punchagan)
|
|
113
|
+
- Fixed bug in tables; only the first row is a header even if others have divider lines (thanks, leathekd)
|
|
114
|
+
- Fixed bug in the list regular expression; lists require a space after the item delimiter (thanks, punchagan)
|
|
115
|
+
- Lots from ruediger:
|
|
116
|
+
* subscript / superscript
|
|
117
|
+
* definition lists
|
|
118
|
+
* centered text
|
|
119
|
+
* symbol replacement
|
|
120
|
+
|
|
121
|
+
* 0.5.3 / 2010-02-15
|
|
122
|
+
|
|
123
|
+
- Minor enhancement: Displays inline images
|
|
124
|
+
|
|
125
|
+
* 0.5.2 / 2010-01-05
|
|
126
|
+
|
|
127
|
+
- Refactored to improve layering.
|
|
128
|
+
|
|
129
|
+
* 0.5.1 / 2009-12-30
|
|
130
|
+
|
|
131
|
+
- Minor enhancement: Recognize lines starting with ":" as examples.
|
|
132
|
+
- Minor enhancement: Recognize #=BEGIN_SRC as source blocks
|
|
133
|
+
- Minor enhancement: Add "src" and "example" classes to <pre> blocks.
|
|
134
|
+
|
|
135
|
+
* 0.5.0 / 2009-12-30
|
|
136
|
+
|
|
137
|
+
- Parse (but not necessarily *use*) in-buffer settings. The following
|
|
138
|
+
in-buffer settings *are* used:
|
|
139
|
+
* Understand the #=TITLE: directive.
|
|
140
|
+
* Exporting todo keywords (option todo:t)
|
|
141
|
+
* Numbering headlines (option num:t)
|
|
142
|
+
* Skipping text before the first headline (option skip:t)
|
|
143
|
+
* Skipping tables (option |:nil)
|
|
144
|
+
* Custom todo keywords
|
|
145
|
+
* EXPORT_SELECT_TAGS and EXPORT_EXLUDE_TAGS for controlling parts of
|
|
146
|
+
the tree to export
|
|
147
|
+
- Rewrite "file:(blah).org" links to "http:(blah).html" links. This
|
|
148
|
+
makes the inter-links to other org-mode files work.
|
|
149
|
+
- Uses <th> tags inside table rows that precede table separators.
|
|
150
|
+
- Bugfixes:
|
|
151
|
+
* Headings now have HTML escaped.
|
|
152
|
+
|
|
153
|
+
* 0.4.2 / 2009-12-29
|
|
154
|
+
|
|
155
|
+
- Got rid of the extraneous newline at the start of code blocks.
|
|
156
|
+
- Everything now shows up in code blocks, even org-mode metadata.
|
|
157
|
+
- Fixed bugs:
|
|
158
|
+
* Regressed smart double quotes with HTML escaping. Added a test
|
|
159
|
+
case and fixed the regression.
|
|
160
|
+
|
|
161
|
+
* 0.4.1 / 2009-12-29
|
|
162
|
+
|
|
163
|
+
- HTML is now escaped by default
|
|
164
|
+
- org-mode comments will show up in a code block.
|
|
165
|
+
|
|
166
|
+
* 0.4.0 / 2009-12-28
|
|
167
|
+
|
|
168
|
+
- The first thing output in HTML gets the class "title"
|
|
169
|
+
- HTML output is now indented
|
|
170
|
+
- Proper support for multi-paragraph list items.
|
|
171
|
+
- Fixed bugs:
|
|
172
|
+
* "rake spec" wouldn't work on Linux. Needed "require 'rubygems'".
|
|
173
|
+
|
|
174
|
+
* 0.3.0 / 2009-12-27
|
|
175
|
+
|
|
176
|
+
- Uses rubypants to get better typography (smart quotes, elipses, etc.).
|
|
177
|
+
- Fixed bugs:
|
|
178
|
+
* Tables and lists did not get properly closed at the end of file
|
|
179
|
+
* You couldn't do inline formatting inside table cells
|
|
180
|
+
* Characters in PRE blocks were not HTML escaped.
|
|
181
|
+
|
|
182
|
+
* 0.2.0 / 2009-12-26
|
|
183
|
+
|
|
184
|
+
- Renamed the gem to org-ruby
|
|
185
|
+
- Added =to_html= for HTML output
|
|
186
|
+
- Now supports the following inline markup:
|
|
187
|
+
* bold
|
|
188
|
+
* italic
|
|
189
|
+
* code
|
|
190
|
+
* verbatim
|
|
191
|
+
* underline
|
|
192
|
+
* strikethrough
|
|
193
|
+
- Continued code cleanup and refactoring
|
|
194
|
+
|
|
195
|
+
* 0.1.0 / 2009-12-23
|
|
196
|
+
|
|
197
|
+
- Added support for block code
|
|
198
|
+
- Added support for list items that wrap in the org source
|
|
199
|
+
- Major code cleanup:
|
|
200
|
+
Added =OutputBuffer= class that should make the code more maintainable.
|
|
201
|
+
|
|
202
|
+
* 0.0.2 / 2009-12-21
|
|
203
|
+
|
|
204
|
+
- Initial version. Handles tables (but not headers), headlines,
|
|
205
|
+
paragraphs, block quotes, strong & emphasis formatting.
|
data/README.org
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
#+startup: showeverything
|
|
2
|
+
|
|
3
|
+
* OrgRuby
|
|
4
|
+
|
|
5
|
+
[[https://secure.travis-ci.org/wallyqs/org-ruby.png?branch=master]]
|
|
6
|
+
|
|
7
|
+
An [[http://orgmode.org][Org-mode]] parser written in Ruby.
|
|
8
|
+
|
|
9
|
+
/Originally by Brian Dewey/
|
|
10
|
+
|
|
11
|
+
** Installation
|
|
12
|
+
|
|
13
|
+
#+BEGIN_SRC ruby
|
|
14
|
+
gem install org-ruby
|
|
15
|
+
#+END_SRC
|
|
16
|
+
|
|
17
|
+
** Usage
|
|
18
|
+
|
|
19
|
+
From Ruby:
|
|
20
|
+
|
|
21
|
+
#+BEGIN_SRC ruby
|
|
22
|
+
require 'org-ruby'
|
|
23
|
+
|
|
24
|
+
# Renders HTML
|
|
25
|
+
Orgmode::Parser.new("* Hello world!").to_html
|
|
26
|
+
# => "<h1>Hello world!</h1>\n"
|
|
27
|
+
|
|
28
|
+
# Renders Textile
|
|
29
|
+
Orgmode::Parser.new("* Hello world!").to_textile
|
|
30
|
+
# => "h1. Hello world!\n"
|
|
31
|
+
|
|
32
|
+
# Renders Markdown
|
|
33
|
+
Orgmode::Parser.new("* Hello world!").to_markdown
|
|
34
|
+
# => "# Hello world!\n"
|
|
35
|
+
|
|
36
|
+
# Renders HTML with custom markup
|
|
37
|
+
Orgmode::Parser.new("* *Custom* /Markup/", { markup_file: "html.tags.yml" }).to_html
|
|
38
|
+
# => "<h1><strong>Custom</strong> <em>Markup</em></h1>\n"
|
|
39
|
+
|
|
40
|
+
# Renders Markdown with custom markup
|
|
41
|
+
Orgmode::Parser.new("* *Custom* /Markup/", { markup_file: "md.tags.yml"}).to_markdown
|
|
42
|
+
# => "# __Custom__ _Markup_\n"
|
|
43
|
+
#+END_SRC
|
|
44
|
+
|
|
45
|
+
The supported output exporters can be also called from the command line:
|
|
46
|
+
|
|
47
|
+
#+BEGIN_SRC sh
|
|
48
|
+
org-ruby --translate html sample.org
|
|
49
|
+
org-ruby --translate textile sample.org
|
|
50
|
+
org-ruby --translate markdown sample.org
|
|
51
|
+
org-ruby --markup html.tags.yml sample.org
|
|
52
|
+
org-ruby --markup md.tags.yml --translate markdown sample.org
|
|
53
|
+
#+END_SRC
|
|
54
|
+
|
|
55
|
+
** Current status
|
|
56
|
+
|
|
57
|
+
Not all of the [[http://orgmode.org/manual/][Org mode features]] are implemented yet.
|
|
58
|
+
Currently, the development of the gem is mostly oriented towards
|
|
59
|
+
giving support for exporting Org mode into other formats.
|
|
60
|
+
|
|
61
|
+
Brief list of features supported:
|
|
62
|
+
|
|
63
|
+
- Converts Org mode files to HTML, Textile or Markdown.
|
|
64
|
+
- Supports tables, block quotes, code blocks, and html blocks
|
|
65
|
+
- Supports bold, italic, underline, strikethrough, and code inline formatting.
|
|
66
|
+
- Supports hyperlinks
|
|
67
|
+
- Supports lists
|
|
68
|
+
- Supports footnotes
|
|
69
|
+
- Supports =.org= views in Rails through Tilt.
|
|
70
|
+
- Code syntax highlight of code blocks using Pygments.rb or Coderay when available
|
|
71
|
+
|
|
72
|
+
** Custom Markup
|
|
73
|
+
|
|
74
|
+
Org-ruby supports custom markups for HTML and Markdown. The custom
|
|
75
|
+
markup needs to be in the form of a YAML file with the following keys
|
|
76
|
+
and values:
|
|
77
|
+
|
|
78
|
+
*** HTML Blocktags
|
|
79
|
+
|
|
80
|
+
#+BEGIN_SRC yaml
|
|
81
|
+
---
|
|
82
|
+
:HtmlBlockTag:
|
|
83
|
+
:paragraph: p
|
|
84
|
+
:ordered_list: ol
|
|
85
|
+
:unordered_list: ul
|
|
86
|
+
:list_item: li
|
|
87
|
+
:definition_list: dl
|
|
88
|
+
:definition_term: dt
|
|
89
|
+
:definition_descr: dd
|
|
90
|
+
:table: table
|
|
91
|
+
:table_row: tr
|
|
92
|
+
:quote: blockquote
|
|
93
|
+
:example: pre
|
|
94
|
+
:src: pre
|
|
95
|
+
:inline_example: pre
|
|
96
|
+
:center: div
|
|
97
|
+
:heading1: h1
|
|
98
|
+
:heading2: h2
|
|
99
|
+
:heading3: h3
|
|
100
|
+
:heading4: h4
|
|
101
|
+
:heading5: h5
|
|
102
|
+
:heading6: h6
|
|
103
|
+
:title: h1
|
|
104
|
+
#+END_SRC
|
|
105
|
+
|
|
106
|
+
For example, you only want to change the blockquote HTML tag to be
|
|
107
|
+
translated, your YAML file would look like this:
|
|
108
|
+
|
|
109
|
+
#+BEGIN_SRC yaml
|
|
110
|
+
---
|
|
111
|
+
:HtmlBlockTag:
|
|
112
|
+
:quote: pre
|
|
113
|
+
#+END_SRC
|
|
114
|
+
|
|
115
|
+
This will change the HTML markup to be translated in the blockquote
|
|
116
|
+
element.
|
|
117
|
+
|
|
118
|
+
*** HTML Emphasis:
|
|
119
|
+
|
|
120
|
+
#+BEGIN_SRC yaml
|
|
121
|
+
---
|
|
122
|
+
:Tags:
|
|
123
|
+
"*":
|
|
124
|
+
:open: b
|
|
125
|
+
:close: b
|
|
126
|
+
"/":
|
|
127
|
+
:open: i
|
|
128
|
+
:close: i
|
|
129
|
+
"_":
|
|
130
|
+
:open: span style=\"text-decoration:underline;\"
|
|
131
|
+
:close: span
|
|
132
|
+
"=":
|
|
133
|
+
:open: code
|
|
134
|
+
:close: code
|
|
135
|
+
"~":
|
|
136
|
+
:open: code
|
|
137
|
+
:close: code
|
|
138
|
+
"+":
|
|
139
|
+
:open: del
|
|
140
|
+
:close: del
|
|
141
|
+
#+END_SRC
|
|
142
|
+
|
|
143
|
+
Let's say that you prefer =<strong>= over =<b>= in the Bold emphasis
|
|
144
|
+
element of Org-mode, your YAML file should look like this:
|
|
145
|
+
|
|
146
|
+
#+BEGIN_SRC yaml
|
|
147
|
+
---
|
|
148
|
+
:Tags:
|
|
149
|
+
"*":
|
|
150
|
+
:open: strong
|
|
151
|
+
:close: strong
|
|
152
|
+
"/":
|
|
153
|
+
:open: em
|
|
154
|
+
:close: em
|
|
155
|
+
#+END_SRC
|
|
156
|
+
|
|
157
|
+
*** Markdown:
|
|
158
|
+
|
|
159
|
+
#+BEGIN_SRC yaml
|
|
160
|
+
---
|
|
161
|
+
:MarkdownMap:
|
|
162
|
+
"*": "**"
|
|
163
|
+
"/": "*"
|
|
164
|
+
"_": "*"
|
|
165
|
+
"=": "`"
|
|
166
|
+
"~": "`"
|
|
167
|
+
"+": "~~"
|
|
168
|
+
#+END_SRC
|
|
169
|
+
|
|
170
|
+
Let's say that you prefer underscores for Bold and Italics elements in
|
|
171
|
+
Markdown, your YAML file should look like this:
|
|
172
|
+
|
|
173
|
+
#+BEGIN_SRC yaml
|
|
174
|
+
---
|
|
175
|
+
:MarkdownMap:
|
|
176
|
+
"*": "__"
|
|
177
|
+
"/": "_"
|
|
178
|
+
#+END_SRC
|
|
179
|
+
|
|
180
|
+
** Contributing
|
|
181
|
+
|
|
182
|
+
- If you see a feature missing, please create an issue so that the maintainer considers its implementation
|
|
183
|
+
- Also, PRs are always welcome! Before submitting make sure to check what breaks by running =rake spec=
|
|
184
|
+
|
|
185
|
+
** Projects using it
|
|
186
|
+
|
|
187
|
+
- Used at [[https://github.com/github/markup][github/markup]] for rendering =.org= files
|
|
188
|
+
- The [[https://github.com/gollum/gollum][Gollum]] project uses it too
|
|
189
|
+
- [[https://www.gitlab.com/][Gitlab]] includes it for rendering Org files with syntax highlighting
|
|
190
|
+
- Can be used with Jekyll for building a site: [[https://github.com/wallyqs/yet-another-jekyll-org-template][example here]]
|
|
191
|
+
|
|
192
|
+
** License
|
|
193
|
+
|
|
194
|
+
#+BEGIN_SRC
|
|
195
|
+
(The MIT License)
|
|
196
|
+
|
|
197
|
+
Copyright (c) 2009 Brian Dewey
|
|
198
|
+
|
|
199
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
200
|
+
a copy of this software and associated documentation files (the
|
|
201
|
+
'Software'), to deal in the Software without restriction, including
|
|
202
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
203
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
204
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
205
|
+
the following conditions:
|
|
206
|
+
|
|
207
|
+
The above copyright notice and this permission notice shall be
|
|
208
|
+
included in all copies or substantial portions of the Software.
|
|
209
|
+
|
|
210
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
211
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
212
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
213
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
214
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
215
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
216
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
217
|
+
#+END_SRC
|
data/bin/org-ruby
CHANGED
|
@@ -17,6 +17,10 @@ options_parser = OptionParser.new do |opts|
|
|
|
17
17
|
options[:debug] = true
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
opts.on("-m", "--markup <file>", "Set Custom Markup file") do |f|
|
|
21
|
+
options[:markup_file] = f
|
|
22
|
+
end
|
|
23
|
+
|
|
20
24
|
opts.on("-t", "--translate FORMAT", [:html, :textile, :markdown],
|
|
21
25
|
"Translate the ORG file to the specified format.") do |v|
|
|
22
26
|
options[:format] = v
|
|
@@ -39,7 +43,7 @@ begin
|
|
|
39
43
|
puts options_parser
|
|
40
44
|
else
|
|
41
45
|
data = IO.read(ARGV[0])
|
|
42
|
-
p = Orgmode::Parser.new(data)
|
|
46
|
+
p = Orgmode::Parser.new(data, (options[:markup_file] ? {:markup_file => options[:markup_file]} : {}))
|
|
43
47
|
$DEBUG = true if options[:debug]
|
|
44
48
|
puts p.to_html if options[:format] == :html
|
|
45
49
|
puts p.to_textile if options[:format] == :textile
|
|
@@ -36,6 +36,7 @@ module Orgmode
|
|
|
36
36
|
@footnotes = {}
|
|
37
37
|
@unclosed_tags = []
|
|
38
38
|
@logger.debug "HTML export options: #{@options.inspect}"
|
|
39
|
+
@custom_blocktags = {} if @options[:markup_file]
|
|
39
40
|
|
|
40
41
|
unless @options[:skip_syntax_highlight]
|
|
41
42
|
begin
|
|
@@ -49,6 +50,10 @@ module Orgmode
|
|
|
49
50
|
end
|
|
50
51
|
end
|
|
51
52
|
end
|
|
53
|
+
|
|
54
|
+
if @options[:markup_file]
|
|
55
|
+
do_custom_markup
|
|
56
|
+
end
|
|
52
57
|
end
|
|
53
58
|
|
|
54
59
|
# Output buffer is entering a new mode. Use this opportunity to
|
data/lib/org-ruby/line.rb
CHANGED
|
@@ -282,7 +282,7 @@ module Orgmode
|
|
|
282
282
|
@assigned_paragraph_type == :title
|
|
283
283
|
end
|
|
284
284
|
|
|
285
|
-
ResultsBlockStartsRegexp = /^\s*#\+RESULTS:\s*(
|
|
285
|
+
ResultsBlockStartsRegexp = /^\s*#\+RESULTS:\s*(.+)?$/i
|
|
286
286
|
|
|
287
287
|
def start_of_results_code_block?
|
|
288
288
|
@line =~ ResultsBlockStartsRegexp
|
|
@@ -4,8 +4,15 @@ module Orgmode
|
|
|
4
4
|
|
|
5
5
|
class MarkdownOutputBuffer < OutputBuffer
|
|
6
6
|
|
|
7
|
-
def initialize(output)
|
|
7
|
+
def initialize(output, opts = {})
|
|
8
8
|
super(output)
|
|
9
|
+
@options = opts
|
|
10
|
+
@logger.debug "Markdown export options: #{@options.inspect}"
|
|
11
|
+
@custom_blocktags = {} if @options[:markup_file]
|
|
12
|
+
|
|
13
|
+
if @options[:markup_file]
|
|
14
|
+
do_custom_markup
|
|
15
|
+
end
|
|
9
16
|
end
|
|
10
17
|
|
|
11
18
|
def push_mode(mode, indent)
|
|
@@ -135,6 +135,42 @@ module Orgmode
|
|
|
135
135
|
[:example, :inline_example, :raw_text, :src].include? current_mode
|
|
136
136
|
end
|
|
137
137
|
|
|
138
|
+
def do_custom_markup
|
|
139
|
+
if File.exists? @options[:markup_file]
|
|
140
|
+
load_custom_markup
|
|
141
|
+
if @custom_blocktags.empty?
|
|
142
|
+
no_valid_markup_found
|
|
143
|
+
else
|
|
144
|
+
set_custom_markup
|
|
145
|
+
end
|
|
146
|
+
else
|
|
147
|
+
no_custom_markup_file_exists
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def load_custom_markup
|
|
152
|
+
require 'yaml'
|
|
153
|
+
self.class.to_s == 'Orgmode::MarkdownOutputBuffer' ? filter = '^MarkdownMap$' : filter = '^HtmlBlockTag$|^Tags$'
|
|
154
|
+
@custom_blocktags = YAML.load_file(@options[:markup_file]).select {|k| k.to_s.match(filter) }
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def set_custom_markup
|
|
158
|
+
@custom_blocktags.keys.each do |k|
|
|
159
|
+
@custom_blocktags[k].each {|key,v| self.class.const_get(k.to_s)[key] = v if self.class.const_get(k.to_s).key? key}
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def no_valid_markup_found
|
|
164
|
+
self.class.to_s == 'Orgmode::MarkdownOutputBuffer' ? tags = 'MarkdownMap' : tags = 'HtmlBlockTag or Tags'
|
|
165
|
+
@logger.debug "Setting Custom Markup failed. No #{tags} key where found in: #{@options[:markup_file]}."
|
|
166
|
+
@logger.debug "Continuing export with default markup."
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def no_custom_markup_file_exists
|
|
170
|
+
@logger.debug "Setting Custom Markup failed. No such file exists: #{@options[:markup_file]}."
|
|
171
|
+
@logger.debug "Continuing export with default tags."
|
|
172
|
+
end
|
|
173
|
+
|
|
138
174
|
######################################################################
|
|
139
175
|
private
|
|
140
176
|
|
data/lib/org-ruby/parser.rb
CHANGED
|
@@ -294,9 +294,9 @@ module Orgmode
|
|
|
294
294
|
end
|
|
295
295
|
|
|
296
296
|
# Creates a new parser from the data in a given file
|
|
297
|
-
def self.load(fname)
|
|
297
|
+
def self.load(fname, opts = {})
|
|
298
298
|
lines = IO.readlines(fname)
|
|
299
|
-
return self.new(lines)
|
|
299
|
+
return self.new(lines, opts = {})
|
|
300
300
|
end
|
|
301
301
|
|
|
302
302
|
# Saves the loaded orgmode file as a textile file.
|
|
@@ -314,8 +314,11 @@ module Orgmode
|
|
|
314
314
|
# Exports the Org mode content into Markdown format
|
|
315
315
|
def to_markdown
|
|
316
316
|
mark_trees_for_export
|
|
317
|
+
export_options = {
|
|
318
|
+
:markup_file => @parser_options[:markup_file]
|
|
319
|
+
}
|
|
317
320
|
output = ""
|
|
318
|
-
output_buffer = MarkdownOutputBuffer.new(output)
|
|
321
|
+
output_buffer = MarkdownOutputBuffer.new(output, export_options)
|
|
319
322
|
|
|
320
323
|
translate(@header_lines, output_buffer)
|
|
321
324
|
@headlines.each do |headline|
|
|
@@ -342,7 +345,8 @@ module Orgmode
|
|
|
342
345
|
:use_sub_superscripts => use_sub_superscripts?,
|
|
343
346
|
:export_footnotes => export_footnotes?,
|
|
344
347
|
:link_abbrevs => @link_abbrevs,
|
|
345
|
-
:skip_syntax_highlight => @parser_options[:skip_syntax_highlight]
|
|
348
|
+
:skip_syntax_highlight => @parser_options[:skip_syntax_highlight],
|
|
349
|
+
:markup_file => @parser_options[:markup_file]
|
|
346
350
|
}
|
|
347
351
|
export_options[:skip_tables] = true if not export_tables?
|
|
348
352
|
output = ""
|
data/lib/org-ruby/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: org-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 0.9.7
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Brian Dewey
|
|
@@ -10,41 +9,44 @@ authors:
|
|
|
10
9
|
autorequire:
|
|
11
10
|
bindir: bin
|
|
12
11
|
cert_chain: []
|
|
13
|
-
date: 2014-
|
|
12
|
+
date: 2014-06-22 00:00:00.000000000 Z
|
|
14
13
|
dependencies:
|
|
15
14
|
- !ruby/object:Gem::Dependency
|
|
16
15
|
name: rubypants
|
|
17
|
-
requirement:
|
|
18
|
-
none: false
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
19
17
|
requirements:
|
|
20
|
-
- -
|
|
18
|
+
- - ~>
|
|
21
19
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: 0.2
|
|
20
|
+
version: '0.2'
|
|
23
21
|
type: :runtime
|
|
24
22
|
prerelease: false
|
|
25
|
-
version_requirements:
|
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
24
|
+
requirements:
|
|
25
|
+
- - ~>
|
|
26
|
+
- !ruby/object:Gem::Version
|
|
27
|
+
version: '0.2'
|
|
26
28
|
description: An Org mode parser written in Ruby.
|
|
27
29
|
email: waldemar.quevedo@gmail.com
|
|
28
30
|
executables:
|
|
29
31
|
- org-ruby
|
|
30
32
|
extensions: []
|
|
31
33
|
extra_rdoc_files:
|
|
32
|
-
- History.
|
|
33
|
-
- README.
|
|
34
|
+
- History.org
|
|
35
|
+
- README.org
|
|
34
36
|
- bin/org-ruby
|
|
35
37
|
files:
|
|
36
|
-
- History.
|
|
37
|
-
- README.
|
|
38
|
+
- History.org
|
|
39
|
+
- README.org
|
|
38
40
|
- bin/org-ruby
|
|
39
41
|
- lib/org-ruby.rb
|
|
40
42
|
- lib/org-ruby/headline.rb
|
|
41
43
|
- lib/org-ruby/html_output_buffer.rb
|
|
42
44
|
- lib/org-ruby/html_symbol_replace.rb
|
|
43
45
|
- lib/org-ruby/line.rb
|
|
46
|
+
- lib/org-ruby/markdown_output_buffer.rb
|
|
44
47
|
- lib/org-ruby/output_buffer.rb
|
|
45
48
|
- lib/org-ruby/parser.rb
|
|
46
49
|
- lib/org-ruby/regexp_helper.rb
|
|
47
|
-
- lib/org-ruby/markdown_output_buffer.rb
|
|
48
50
|
- lib/org-ruby/textile_output_buffer.rb
|
|
49
51
|
- lib/org-ruby/textile_symbol_replace.rb
|
|
50
52
|
- lib/org-ruby/tilt.rb
|
|
@@ -52,27 +54,25 @@ files:
|
|
|
52
54
|
homepage: https://github.com/wallyqs/org-ruby
|
|
53
55
|
licenses:
|
|
54
56
|
- MIT
|
|
57
|
+
metadata: {}
|
|
55
58
|
post_install_message:
|
|
56
59
|
rdoc_options: []
|
|
57
60
|
require_paths:
|
|
58
61
|
- lib
|
|
59
62
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
60
|
-
none: false
|
|
61
63
|
requirements:
|
|
62
|
-
- -
|
|
64
|
+
- - '>='
|
|
63
65
|
- !ruby/object:Gem::Version
|
|
64
66
|
version: '0'
|
|
65
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
|
-
none: false
|
|
67
68
|
requirements:
|
|
68
|
-
- -
|
|
69
|
+
- - '>='
|
|
69
70
|
- !ruby/object:Gem::Version
|
|
70
71
|
version: '0'
|
|
71
72
|
requirements: []
|
|
72
73
|
rubyforge_project: org-ruby
|
|
73
|
-
rubygems_version:
|
|
74
|
+
rubygems_version: 2.2.2
|
|
74
75
|
signing_key:
|
|
75
76
|
specification_version: 3
|
|
76
77
|
summary: This gem contains Ruby routines for parsing org-mode files.
|
|
77
78
|
test_files: []
|
|
78
|
-
has_rdoc:
|
data/History.txt
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
== 0.9.6 / 2014-05-06
|
|
2
|
-
|
|
3
|
-
* Support named results blocks
|
|
4
|
-
|
|
5
|
-
== 0.9.5 / 2014-04-24
|
|
6
|
-
|
|
7
|
-
* Small bugfix to remove warning due to VERSION being repeated
|
|
8
|
-
|
|
9
|
-
== 0.9.4 / 2014-04-18
|
|
10
|
-
|
|
11
|
-
* Track block names within the line properties
|
|
12
|
-
* Add option to skip-syntax-highlighting explicitly
|
|
13
|
-
|
|
14
|
-
== 0.9.3 / 2014-03-25
|
|
15
|
-
|
|
16
|
-
* Fix code blocks prepended comma stripping
|
|
17
|
-
|
|
18
|
-
== 0.9.2 / 2014-03-22
|
|
19
|
-
|
|
20
|
-
* Fix Org mode syntax for escaping html: Syntax actually now is @@html:<text>@@
|
|
21
|
-
|
|
22
|
-
* Fix '#+TITLE:' to render as a h1 headline
|
|
23
|
-
|
|
24
|
-
* Remove rewriting links to '.org' files as '.html'
|
|
25
|
-
|
|
26
|
-
* Implement :exports options for code blocks
|
|
27
|
-
|
|
28
|
-
== 0.9.1 / 2014-02-13
|
|
29
|
-
|
|
30
|
-
* Backport CGI::escapeHTML function from Ruby to have same output among different Ruby versions
|
|
31
|
-
|
|
32
|
-
== 0.9.0 / 2014-02-08
|
|
33
|
-
|
|
34
|
-
* Add explicit enable or disable of include file feature
|
|
35
|
-
* Add lang attribute to src code block to support syntax highlight in Github
|
|
36
|
-
|
|
37
|
-
== 0.8.3 / 2014-02-02
|
|
38
|
-
|
|
39
|
-
* Bugfix: Two backslashes \\ at the end of the line make a line break without breaking paragraph.
|
|
40
|
-
* Bugfix: Fix inline formatting not working for definition lists
|
|
41
|
-
* Add basic markdown exporter
|
|
42
|
-
|
|
43
|
-
== 0.8.2 / 2013-11-09
|
|
44
|
-
|
|
45
|
-
* Manage the #+INCLUDE tag in org files (contribution by pierre-lecocq)
|
|
46
|
-
* #+INCLUDE is disabled by default. Needs either ORG_RUBY_INCLUDE_ROOT or
|
|
47
|
-
ORG_RUBY_ENABLE_INCLUDE_FILES environment variables in order to be enabled.
|
|
48
|
-
* Link abbreviations with #+LINK tag are supported (by pierre-lecocq too, thanks!)
|
|
49
|
-
* Strip prepended commas added by Emacs Org mode to src/example blocks
|
|
50
|
-
|
|
51
|
-
== 0.8.1 / 2013-02-17
|
|
52
|
-
|
|
53
|
-
* Fix for html escaping when code is inline
|
|
54
|
-
|
|
55
|
-
== 0.8.0 / 2013-02-10
|
|
56
|
-
|
|
57
|
-
* A lot of refactoring work and bugfixes contributed by vonavi (many thanks!)
|
|
58
|
-
* Raw HTML is supported with #+html
|
|
59
|
-
* Code indentation for code blocks is fixed now
|
|
60
|
-
* Support for definition lists is improved
|
|
61
|
-
* Bugfix for when including headlines in center and quote blocks.
|
|
62
|
-
* Indentation of HTML output improved
|
|
63
|
-
* Improvements to entities support for Textile and HTML outputs
|
|
64
|
-
|
|
65
|
-
== 0.7.2 / 2012-10-07
|
|
66
|
-
|
|
67
|
-
* Many fixes to the regular expressions used for emphasis, contributed by [[http://github.com/vonavi][vonavi]]
|
|
68
|
-
* Bug fix for when a table starts with a headline, thanks to [[http://github/til][til]]
|
|
69
|
-
* Asterisk can be used for definition lists too
|
|
70
|
-
* Use text lexer as default option for Pygments and Coderay when no language is specified
|
|
71
|
-
|
|
72
|
-
== 0.7.1 / 2012-08-04
|
|
73
|
-
|
|
74
|
-
* Make source code blocks from lisp dialects use Pygments scheme lexer
|
|
75
|
-
* Bugfix: Make Coderay fallback to text lexer when unsupported lang is set
|
|
76
|
-
|
|
77
|
-
== 0.7.0 / 2012-07-08
|
|
78
|
-
|
|
79
|
-
* Highlight source code blocks using Pygments or CodeRay when available
|
|
80
|
-
|
|
81
|
-
== 0.6.4 / 2012-07-08
|
|
82
|
-
|
|
83
|
-
* Fixed lists behavior when code fragments, tables and examples were present
|
|
84
|
-
* Remove code tags with lang class and use instead src-:lang like org-exporter
|
|
85
|
-
* Fixed property drawers to consider properties with hyphens like :noweb-ref:
|
|
86
|
-
|
|
87
|
-
== 0.6.3 / 2012-05-22
|
|
88
|
-
|
|
89
|
-
* Minor enhancement: Correct handling of .org URIs in HTML markup routine (thanks, rayl)
|
|
90
|
-
|
|
91
|
-
== 0.6.1 / 2012-04-14
|
|
92
|
-
|
|
93
|
-
* Added encoding directive to support Ruby 1.9.2
|
|
94
|
-
* Headlines with the COMMENT keyword, and the PROPERTIES drawer are not exported
|
|
95
|
-
* Angle links in org-mode are embedded in anchor tags on html output
|
|
96
|
-
* #+BEGIN/END_SRC lang code blocks are embedded in code tags with class that specifies the coding language
|
|
97
|
-
* Fixed bug in code blocks when a colon was at the beginning
|
|
98
|
-
* More than five dashes create an horizontal rule in html output
|
|
99
|
-
|
|
100
|
-
== 0.6.0 / 2011-09-03
|
|
101
|
-
|
|
102
|
-
* Added support for a "header offset" -- turns one star into an H2, etc. (thanks, niku)
|
|
103
|
-
* The anchor text for a link can now be an image, and will get an img tag (thanks, punchagan)
|
|
104
|
-
* Fixed bug in tables; only the first row is a header even if others have divider lines (thanks, leathekd)
|
|
105
|
-
* Fixed bug in the list regular expression; lists require a space after the item delimiter (thanks, punchagan)
|
|
106
|
-
* Lots from ruediger:
|
|
107
|
-
* subscript / superscript
|
|
108
|
-
* definition lists
|
|
109
|
-
* centered text
|
|
110
|
-
* symbol replacement
|
|
111
|
-
|
|
112
|
-
== 0.5.3 / 2010-02-15
|
|
113
|
-
|
|
114
|
-
* Minor enhancement: Displays inline images
|
|
115
|
-
|
|
116
|
-
== 0.5.2 / 2010-01-05
|
|
117
|
-
|
|
118
|
-
* Refactored to improve layering.
|
|
119
|
-
|
|
120
|
-
== 0.5.1 / 2009-12-30
|
|
121
|
-
|
|
122
|
-
* Minor enhancement: Recognize lines starting with ":" as examples.
|
|
123
|
-
* Minor enhancement: Recognize #+BEGIN_SRC as source blocks
|
|
124
|
-
* Minor enhancement: Add "src" and "example" classes to <pre> blocks.
|
|
125
|
-
|
|
126
|
-
== 0.5.0 / 2009-12-30
|
|
127
|
-
|
|
128
|
-
* Parse (but not necessarily *use*) in-buffer settings. The following
|
|
129
|
-
in-buffer settings *are* used:
|
|
130
|
-
* Understand the #+TITLE: directive.
|
|
131
|
-
* Exporting todo keywords (option todo:t)
|
|
132
|
-
* Numbering headlines (option num:t)
|
|
133
|
-
* Skipping text before the first headline (option skip:t)
|
|
134
|
-
* Skipping tables (option |:nil)
|
|
135
|
-
* Custom todo keywords
|
|
136
|
-
* EXPORT_SELECT_TAGS and EXPORT_EXLUDE_TAGS for controlling parts of
|
|
137
|
-
the tree to export
|
|
138
|
-
* Rewrite "file:(blah).org" links to "http:(blah).html" links. This
|
|
139
|
-
makes the inter-links to other org-mode files work.
|
|
140
|
-
* Uses <th> tags inside table rows that precede table separators.
|
|
141
|
-
* Bugfixes:
|
|
142
|
-
* Headings now have HTML escaped.
|
|
143
|
-
|
|
144
|
-
== 0.4.2 / 2009-12-29
|
|
145
|
-
|
|
146
|
-
* Got rid of the extraneous newline at the start of code blocks.
|
|
147
|
-
* Everything now shows up in code blocks, even org-mode metadata.
|
|
148
|
-
* Fixed bugs:
|
|
149
|
-
* Regressed smart double quotes with HTML escaping. Added a test
|
|
150
|
-
case and fixed the regression.
|
|
151
|
-
|
|
152
|
-
== 0.4.1 / 2009-12-29
|
|
153
|
-
|
|
154
|
-
* HTML is now escaped by default
|
|
155
|
-
* org-mode comments will show up in a code block.
|
|
156
|
-
|
|
157
|
-
== 0.4.0 / 2009-12-28
|
|
158
|
-
|
|
159
|
-
* The first thing output in HTML gets the class "title"
|
|
160
|
-
* HTML output is now indented
|
|
161
|
-
* Proper support for multi-paragraph list items.
|
|
162
|
-
* Fixed bugs:
|
|
163
|
-
* "rake spec" wouldn't work on Linux. Needed "require 'rubygems'".
|
|
164
|
-
|
|
165
|
-
== 0.3.0 / 2009-12-27
|
|
166
|
-
|
|
167
|
-
* Uses rubypants to get better typography (smart quotes, elipses, etc.).
|
|
168
|
-
* Fixed bugs:
|
|
169
|
-
* Tables and lists did not get properly closed at the end of file
|
|
170
|
-
* You couldn't do inline formatting inside table cells
|
|
171
|
-
* Characters in PRE blocks were not HTML escaped.
|
|
172
|
-
|
|
173
|
-
== 0.2.0 / 2009-12-26
|
|
174
|
-
|
|
175
|
-
* Renamed the gem to org-ruby
|
|
176
|
-
* Added +to_html+ for HTML output
|
|
177
|
-
* Now supports the following inline markup:
|
|
178
|
-
* bold
|
|
179
|
-
* italic
|
|
180
|
-
* code
|
|
181
|
-
* verbatim
|
|
182
|
-
* underline
|
|
183
|
-
* strikethrough
|
|
184
|
-
* Continued code cleanup and refactoring
|
|
185
|
-
|
|
186
|
-
== 0.1.0 / 2009-12-23
|
|
187
|
-
|
|
188
|
-
* Added support for block code
|
|
189
|
-
* Added support for list items that wrap in the org source
|
|
190
|
-
* Major code cleanup:
|
|
191
|
-
Added +OutputBuffer+ class that should make the code more maintainable.
|
|
192
|
-
|
|
193
|
-
== 0.0.2 / 2009-12-21
|
|
194
|
-
|
|
195
|
-
* Initial version. Handles tables (but not headers), headlines,
|
|
196
|
-
paragraphs, block quotes, strong & emphasis formatting.
|
data/README.rdoc
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
= OrgRuby
|
|
2
|
-
{<img src="https://secure.travis-ci.org/wallyqs/org-ruby.png?branch=master" alt="Build Status" />}[http://travis-ci.org/wallyqs/org-ruby]
|
|
3
|
-
|
|
4
|
-
An {Org mode}[http://orgmode.org] parser written in Ruby.
|
|
5
|
-
|
|
6
|
-
<em>Originally by Brian Dewey</em>
|
|
7
|
-
|
|
8
|
-
== Installation
|
|
9
|
-
|
|
10
|
-
gem install org-ruby
|
|
11
|
-
|
|
12
|
-
== Usage
|
|
13
|
-
|
|
14
|
-
From Ruby:
|
|
15
|
-
|
|
16
|
-
require 'org-ruby'
|
|
17
|
-
|
|
18
|
-
# Renders HTML
|
|
19
|
-
Orgmode::Parser.new("* Hello world!").to_html
|
|
20
|
-
# => "<h1>Hello world!</h1>\n"
|
|
21
|
-
|
|
22
|
-
# Renders Textile
|
|
23
|
-
Orgmode::Parser.new("* Hello world!").to_textile
|
|
24
|
-
# => "h1. Hello world!\n"
|
|
25
|
-
|
|
26
|
-
# Renders Markdown
|
|
27
|
-
Orgmode::Parser.new("* Hello world!").to_markdown
|
|
28
|
-
# => "# Hello world!\n"
|
|
29
|
-
|
|
30
|
-
The supported output exporters can be also called from the command line:
|
|
31
|
-
|
|
32
|
-
org-ruby --translate html sample.org
|
|
33
|
-
org-ruby --translate textile sample.org
|
|
34
|
-
org-ruby --translate markdown sample.org
|
|
35
|
-
|
|
36
|
-
== Current status
|
|
37
|
-
|
|
38
|
-
Not all of the {Org mode features}[http://orgmode.org/manual/] are implemented yet.
|
|
39
|
-
Currently, the development of the gem is mostly oriented towards
|
|
40
|
-
giving support for exporting Org mode into other formats.
|
|
41
|
-
|
|
42
|
-
Brief list of features supported:
|
|
43
|
-
|
|
44
|
-
* Converts Org mode files to HTML, Textile or Markdown.
|
|
45
|
-
* Supports tables, block quotes, code blocks, and html blocks
|
|
46
|
-
* Supports bold, italic, underline, strikethrough, and code inline formatting.
|
|
47
|
-
* Supports hyperlinks
|
|
48
|
-
* Supports lists
|
|
49
|
-
* Supports footnotes
|
|
50
|
-
* Supports +.org+ views in Rails through Tilt.
|
|
51
|
-
* Code syntax highlight of code blocks using Pygments.rb or Coderay when available
|
|
52
|
-
|
|
53
|
-
== Contributing
|
|
54
|
-
|
|
55
|
-
* If you see a feature missing, please create an issue so that the maintainer considers its implementation
|
|
56
|
-
* Also, PRs are always welcome! Before submitting make sure to check what breaks by running <code>rake spec</code>
|
|
57
|
-
|
|
58
|
-
== Projects using it
|
|
59
|
-
|
|
60
|
-
* Used at {github/markup}[https://github.com/github/markup] for rendering +.org+ files
|
|
61
|
-
* The {Gollum}[https://github.com/gollum/gollum] project uses it too
|
|
62
|
-
* Can be used with Jekyll for building a site: {example here}[https://github.com/wallyqs/yet-another-jekyll-org-template]
|
|
63
|
-
|
|
64
|
-
== License
|
|
65
|
-
|
|
66
|
-
(The MIT License)
|
|
67
|
-
|
|
68
|
-
Copyright (c) 2009 Brian Dewey
|
|
69
|
-
|
|
70
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
71
|
-
a copy of this software and associated documentation files (the
|
|
72
|
-
'Software'), to deal in the Software without restriction, including
|
|
73
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
74
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
75
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
76
|
-
the following conditions:
|
|
77
|
-
|
|
78
|
-
The above copyright notice and this permission notice shall be
|
|
79
|
-
included in all copies or substantial portions of the Software.
|
|
80
|
-
|
|
81
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
82
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
83
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
84
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
85
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
86
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
87
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|