org-ruby 0.5.1 → 0.5.2
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.
- data/History.txt +81 -77
- data/README.rdoc +66 -66
- data/Rakefile +28 -28
- data/bin/org-ruby +40 -40
- data/lib/org-ruby.rb +50 -50
- data/lib/org-ruby/headline.rb +102 -120
- data/lib/org-ruby/html_output_buffer.rb +174 -156
- data/lib/org-ruby/line.rb +206 -260
- data/lib/org-ruby/output_buffer.rb +227 -191
- data/lib/org-ruby/parser.rb +320 -272
- data/lib/org-ruby/regexp_helper.rb +156 -156
- data/lib/org-ruby/textile_output_buffer.rb +67 -68
- data/spec/data/freeform-example.org +113 -113
- data/spec/data/freeform.org +111 -111
- data/spec/data/hyp-planning.org +335 -335
- data/spec/data/remember.org +53 -53
- data/spec/headline_spec.rb +55 -55
- data/spec/html_examples/advanced-code.html +36 -36
- data/spec/html_examples/advanced-code.org +53 -53
- data/spec/html_examples/advanced-lists.html +31 -31
- data/spec/html_examples/advanced-lists.org +31 -31
- data/spec/html_examples/block_code.html +28 -28
- data/spec/html_examples/block_code.org +35 -35
- data/spec/html_examples/blockquote.html +7 -7
- data/spec/html_examples/blockquote.org +13 -13
- data/spec/html_examples/code-comment.html +18 -18
- data/spec/html_examples/code-comment.org +22 -22
- data/spec/html_examples/custom-seq-todo.html +15 -15
- data/spec/html_examples/custom-seq-todo.org +24 -24
- data/spec/html_examples/custom-todo.html +15 -15
- data/spec/html_examples/custom-todo.org +24 -24
- data/spec/html_examples/custom-typ-todo.html +15 -15
- data/spec/html_examples/custom-typ-todo.org +24 -24
- data/spec/html_examples/entities.html +4 -4
- data/spec/html_examples/entities.org +11 -11
- data/spec/html_examples/escape-pre.html +6 -6
- data/spec/html_examples/escape-pre.org +6 -6
- data/spec/html_examples/export-exclude-only.html +13 -13
- data/spec/html_examples/export-exclude-only.org +81 -81
- data/spec/html_examples/export-keywords.html +4 -4
- data/spec/html_examples/export-keywords.org +18 -18
- data/spec/html_examples/export-tags.html +8 -8
- data/spec/html_examples/export-tags.org +82 -82
- data/spec/html_examples/export-title.html +2 -2
- data/spec/html_examples/export-title.org +4 -4
- data/spec/html_examples/html-literal.html +2 -2
- data/spec/html_examples/html-literal.org +6 -6
- data/spec/html_examples/inline-formatting.html +10 -10
- data/spec/html_examples/inline-formatting.org +17 -17
- data/spec/html_examples/link-features.html +8 -8
- data/spec/html_examples/link-features.org +19 -19
- data/spec/html_examples/lists.html +19 -19
- data/spec/html_examples/lists.org +36 -36
- data/spec/html_examples/metadata-comment.html +27 -27
- data/spec/html_examples/metadata-comment.org +30 -30
- data/spec/html_examples/only-list.html +5 -5
- data/spec/html_examples/only-list.org +3 -3
- data/spec/html_examples/only-table.html +6 -6
- data/spec/html_examples/only-table.org +5 -5
- data/spec/html_examples/skip-header.html +3 -3
- data/spec/html_examples/skip-header.org +28 -28
- data/spec/html_examples/skip-table.html +4 -4
- data/spec/html_examples/skip-table.org +19 -19
- data/spec/html_examples/tables.html +20 -20
- data/spec/html_examples/tables.org +26 -26
- data/spec/html_examples/text.html +2 -2
- data/spec/html_examples/text.org +16 -16
- data/spec/line_spec.rb +151 -151
- data/spec/output_buffer_spec.rb +19 -0
- data/spec/parser_spec.rb +152 -166
- data/spec/regexp_helper_spec.rb +57 -57
- data/spec/spec_helper.rb +21 -21
- data/spec/textile_examples/block_code.org +35 -35
- data/spec/textile_examples/block_code.textile +29 -29
- data/spec/textile_examples/blockquote.org +13 -13
- data/spec/textile_examples/blockquote.textile +11 -11
- data/spec/textile_examples/keywords.org +13 -13
- data/spec/textile_examples/keywords.textile +11 -11
- data/spec/textile_examples/links.org +11 -11
- data/spec/textile_examples/links.textile +10 -10
- data/spec/textile_examples/lists.org +36 -36
- data/spec/textile_examples/lists.textile +20 -20
- data/spec/textile_examples/single-space-plain-list.org +13 -13
- data/spec/textile_examples/single-space-plain-list.textile +10 -10
- data/spec/textile_examples/tables.org +26 -26
- data/spec/textile_examples/tables.textile +23 -23
- data/spec/textile_output_buffer_spec.rb +21 -21
- data/tasks/test_case.rake +49 -49
- metadata +3 -2
data/History.txt
CHANGED
@@ -1,77 +1,81 @@
|
|
1
|
-
== 0.5.
|
2
|
-
|
3
|
-
*
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
*
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
|
19
|
-
*
|
20
|
-
|
21
|
-
*
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
*
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
*
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
*
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
*
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
*
|
64
|
-
*
|
65
|
-
*
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
*
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
1
|
+
== 0.5.2 / 2010-01-05
|
2
|
+
|
3
|
+
* Refactored to improve layering.
|
4
|
+
|
5
|
+
== 0.5.1 / 2009-12-30
|
6
|
+
|
7
|
+
* Minor enhancement: Recognize lines starting with ":" as examples.
|
8
|
+
* Minor enhancement: Recognize #+BEGIN_SRC as source blocks
|
9
|
+
* Minor enhancement: Add "src" and "example" classes to <pre> blocks.
|
10
|
+
|
11
|
+
== 0.5.0 / 2009-12-30
|
12
|
+
|
13
|
+
* Parse (but not necessarily *use*) in-buffer settings. The following
|
14
|
+
in-buffer settings *are* used:
|
15
|
+
* Understand the #+TITLE: directive.
|
16
|
+
* Exporting todo keywords (option todo:t)
|
17
|
+
* Numbering headlines (option num:t)
|
18
|
+
* Skipping text before the first headline (option skip:t)
|
19
|
+
* Skipping tables (option |:nil)
|
20
|
+
* Custom todo keywords
|
21
|
+
* EXPORT_SELECT_TAGS and EXPORT_EXLUDE_TAGS for controlling parts of
|
22
|
+
the tree to export
|
23
|
+
* Rewrite "file:(blah).org" links to "http:(blah).html" links. This
|
24
|
+
makes the inter-links to other org-mode files work.
|
25
|
+
* Uses <th> tags inside table rows that precede table separators.
|
26
|
+
* Bugfixes:
|
27
|
+
* Headings now have HTML escaped.
|
28
|
+
|
29
|
+
== 0.4.2 / 2009-12-29
|
30
|
+
|
31
|
+
* Got rid of the extraneous newline at the start of code blocks.
|
32
|
+
* Everything now shows up in code blocks, even org-mode metadata.
|
33
|
+
* Fixed bugs:
|
34
|
+
* Regressed smart double quotes with HTML escaping. Added a test
|
35
|
+
case and fixed the regression.
|
36
|
+
|
37
|
+
== 0.4.1 / 2009-12-29
|
38
|
+
|
39
|
+
* HTML is now escaped by default
|
40
|
+
* org-mode comments will show up in a code block.
|
41
|
+
|
42
|
+
== 0.4.0 / 2009-12-28
|
43
|
+
|
44
|
+
* The first thing output in HTML gets the class "title"
|
45
|
+
* HTML output is now indented
|
46
|
+
* Proper support for multi-paragraph list items.
|
47
|
+
* Fixed bugs:
|
48
|
+
* "rake spec" wouldn't work on Linux. Needed "require 'rubygems'".
|
49
|
+
|
50
|
+
== 0.3.0 / 2009-12-27
|
51
|
+
|
52
|
+
* Uses rubypants to get better typography (smart quotes, elipses, etc.).
|
53
|
+
* Fixed bugs:
|
54
|
+
* Tables and lists did not get properly closed at the end of file
|
55
|
+
* You couldn't do inline formatting inside table cells
|
56
|
+
* Characters in PRE blocks were not HTML escaped.
|
57
|
+
|
58
|
+
== 0.2.0 / 2009-12-26
|
59
|
+
|
60
|
+
* Renamed the gem to org-ruby
|
61
|
+
* Added +to_html+ for HTML output
|
62
|
+
* Now supports the following inline markup:
|
63
|
+
* bold
|
64
|
+
* italic
|
65
|
+
* code
|
66
|
+
* verbatim
|
67
|
+
* underline
|
68
|
+
* strikethrough
|
69
|
+
* Continued code cleanup and refactoring
|
70
|
+
|
71
|
+
== 0.1.0 / 2009-12-23
|
72
|
+
|
73
|
+
* Added support for block code
|
74
|
+
* Added support for list items that wrap in the org source
|
75
|
+
* Major code cleanup:
|
76
|
+
Added +OutputBuffer+ class that should make the code more maintainable.
|
77
|
+
|
78
|
+
== 0.0.2 / 2009-12-21
|
79
|
+
|
80
|
+
* Initial version. Handles tables (but not headers), headlines,
|
81
|
+
paragraphs, block quotes, strong & emphasis formatting.
|
data/README.rdoc
CHANGED
@@ -1,66 +1,66 @@
|
|
1
|
-
org-ruby
|
2
|
-
by Brian Dewey
|
3
|
-
http://github.com/bdewey/org-ruby
|
4
|
-
|
5
|
-
== DESCRIPTION:
|
6
|
-
|
7
|
-
This gem contains Ruby routines for parsing org-mode files.The most
|
8
|
-
significant thing this library does today is convert org-mode files to
|
9
|
-
HTML or textile. Currently, you cannot do much to customize the
|
10
|
-
conversion. The supplied textile conversion is optimized for
|
11
|
-
extracting "content" from the orgfile as opposed to "metadata."
|
12
|
-
|
13
|
-
== FEATURES/PROBLEMS:
|
14
|
-
|
15
|
-
* Converts org-mode files to HTML or Textile
|
16
|
-
* Supports tables, block quotes, and block code
|
17
|
-
* Supports bold, italic, underline, strikethrough, and code inline formatting.
|
18
|
-
* Supports hyperlinks that are in double-brackets
|
19
|
-
* Upcoming: Handle export options specified in the org buffer.
|
20
|
-
|
21
|
-
== SYNOPSIS:
|
22
|
-
|
23
|
-
From the command line:
|
24
|
-
|
25
|
-
org-ruby sample.org
|
26
|
-
|
27
|
-
...will output a HTML version of sample.org.
|
28
|
-
|
29
|
-
org-ruby --translate textile sample.org
|
30
|
-
|
31
|
-
...will output a textile version of sample.org.
|
32
|
-
|
33
|
-
From Ruby code:
|
34
|
-
|
35
|
-
Orgmode::Parser.new(data)
|
36
|
-
|
37
|
-
...will construct a new +Parser+ object.
|
38
|
-
|
39
|
-
== INSTALL:
|
40
|
-
|
41
|
-
sudo gem install org-ruby
|
42
|
-
|
43
|
-
== LICENSE:
|
44
|
-
|
45
|
-
(The MIT License)
|
46
|
-
|
47
|
-
Copyright (c) 2009 Brian Dewey
|
48
|
-
|
49
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
50
|
-
a copy of this software and associated documentation files (the
|
51
|
-
'Software'), to deal in the Software without restriction, including
|
52
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
53
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
54
|
-
permit persons to whom the Software is furnished to do so, subject to
|
55
|
-
the following conditions:
|
56
|
-
|
57
|
-
The above copyright notice and this permission notice shall be
|
58
|
-
included in all copies or substantial portions of the Software.
|
59
|
-
|
60
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
61
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
62
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
63
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
64
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
65
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
66
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
org-ruby
|
2
|
+
by Brian Dewey
|
3
|
+
http://github.com/bdewey/org-ruby
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
This gem contains Ruby routines for parsing org-mode files.The most
|
8
|
+
significant thing this library does today is convert org-mode files to
|
9
|
+
HTML or textile. Currently, you cannot do much to customize the
|
10
|
+
conversion. The supplied textile conversion is optimized for
|
11
|
+
extracting "content" from the orgfile as opposed to "metadata."
|
12
|
+
|
13
|
+
== FEATURES/PROBLEMS:
|
14
|
+
|
15
|
+
* Converts org-mode files to HTML or Textile
|
16
|
+
* Supports tables, block quotes, and block code
|
17
|
+
* Supports bold, italic, underline, strikethrough, and code inline formatting.
|
18
|
+
* Supports hyperlinks that are in double-brackets
|
19
|
+
* Upcoming: Handle export options specified in the org buffer.
|
20
|
+
|
21
|
+
== SYNOPSIS:
|
22
|
+
|
23
|
+
From the command line:
|
24
|
+
|
25
|
+
org-ruby sample.org
|
26
|
+
|
27
|
+
...will output a HTML version of sample.org.
|
28
|
+
|
29
|
+
org-ruby --translate textile sample.org
|
30
|
+
|
31
|
+
...will output a textile version of sample.org.
|
32
|
+
|
33
|
+
From Ruby code:
|
34
|
+
|
35
|
+
Orgmode::Parser.new(data)
|
36
|
+
|
37
|
+
...will construct a new +Parser+ object.
|
38
|
+
|
39
|
+
== INSTALL:
|
40
|
+
|
41
|
+
sudo gem install org-ruby
|
42
|
+
|
43
|
+
== LICENSE:
|
44
|
+
|
45
|
+
(The MIT License)
|
46
|
+
|
47
|
+
Copyright (c) 2009 Brian Dewey
|
48
|
+
|
49
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
50
|
+
a copy of this software and associated documentation files (the
|
51
|
+
'Software'), to deal in the Software without restriction, including
|
52
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
53
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
54
|
+
permit persons to whom the Software is furnished to do so, subject to
|
55
|
+
the following conditions:
|
56
|
+
|
57
|
+
The above copyright notice and this permission notice shall be
|
58
|
+
included in all copies or substantial portions of the Software.
|
59
|
+
|
60
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
61
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
62
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
63
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
64
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
65
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
66
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
|
2
|
-
begin
|
3
|
-
require 'bones'
|
4
|
-
rescue LoadError
|
5
|
-
abort '### Please install the "bones" gem ###'
|
6
|
-
end
|
7
|
-
|
8
|
-
ensure_in_path 'lib'
|
9
|
-
require 'org-ruby'
|
10
|
-
|
11
|
-
task :default => 'test:run'
|
12
|
-
task 'gem:release' => 'test:run'
|
13
|
-
|
14
|
-
Bones {
|
15
|
-
readme_file 'README.rdoc'
|
16
|
-
name 'org-ruby'
|
17
|
-
authors 'Brian Dewey'
|
18
|
-
email 'bdewey@gmail.com'
|
19
|
-
url 'http://github.com/bdewey/org-ruby'
|
20
|
-
version OrgRuby::VERSION
|
21
|
-
colorize false # Windows consoles won't colorize
|
22
|
-
gem.need_tar false # Can't TAR from Windows
|
23
|
-
depend_on 'rubypants'
|
24
|
-
spec.opts ['-D', '--color']
|
25
|
-
}
|
26
|
-
|
27
|
-
|
28
|
-
# EOF
|
1
|
+
|
2
|
+
begin
|
3
|
+
require 'bones'
|
4
|
+
rescue LoadError
|
5
|
+
abort '### Please install the "bones" gem ###'
|
6
|
+
end
|
7
|
+
|
8
|
+
ensure_in_path 'lib'
|
9
|
+
require 'org-ruby'
|
10
|
+
|
11
|
+
task :default => 'test:run'
|
12
|
+
task 'gem:release' => 'test:run'
|
13
|
+
|
14
|
+
Bones {
|
15
|
+
readme_file 'README.rdoc'
|
16
|
+
name 'org-ruby'
|
17
|
+
authors 'Brian Dewey'
|
18
|
+
email 'bdewey@gmail.com'
|
19
|
+
url 'http://github.com/bdewey/org-ruby'
|
20
|
+
version OrgRuby::VERSION
|
21
|
+
colorize false # Windows consoles won't colorize
|
22
|
+
gem.need_tar false # Can't TAR from Windows
|
23
|
+
depend_on 'rubypants'
|
24
|
+
spec.opts ['-D', '--color']
|
25
|
+
}
|
26
|
+
|
27
|
+
|
28
|
+
# EOF
|
data/bin/org-ruby
CHANGED
@@ -1,40 +1,40 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require File.expand_path(
|
4
|
-
File.join(File.dirname(__FILE__), %w[.. lib org-ruby]))
|
5
|
-
require 'optparse'
|
6
|
-
|
7
|
-
# Put your code here
|
8
|
-
|
9
|
-
options = {}
|
10
|
-
options_parser = OptionParser.new do |opts|
|
11
|
-
options[:help] = false
|
12
|
-
options[:format] = :html
|
13
|
-
|
14
|
-
opts.banner = "Usage: org-ruby <file> [options]"
|
15
|
-
|
16
|
-
opts.on("-h", "--help", "Show this message") do |v|
|
17
|
-
options[:help] = true
|
18
|
-
end
|
19
|
-
|
20
|
-
opts.on("-t", "--translate FORMAT", [:html, :textile],
|
21
|
-
"Translate the ORG file to the specified format.") do |v|
|
22
|
-
options[:format] = v
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
begin
|
27
|
-
options_parser.parse!
|
28
|
-
if (ARGV.length == 0) then
|
29
|
-
puts options_parser
|
30
|
-
else
|
31
|
-
data = IO.read(ARGV[0])
|
32
|
-
p = Orgmode::Parser.new(data)
|
33
|
-
puts p.to_html if options[:format] == :html
|
34
|
-
puts p.to_textile if options[:format] == :textile
|
35
|
-
end
|
36
|
-
rescue OptionParser::ParseError
|
37
|
-
puts options_parser
|
38
|
-
end
|
39
|
-
|
40
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require File.expand_path(
|
4
|
+
File.join(File.dirname(__FILE__), %w[.. lib org-ruby]))
|
5
|
+
require 'optparse'
|
6
|
+
|
7
|
+
# Put your code here
|
8
|
+
|
9
|
+
options = {}
|
10
|
+
options_parser = OptionParser.new do |opts|
|
11
|
+
options[:help] = false
|
12
|
+
options[:format] = :html
|
13
|
+
|
14
|
+
opts.banner = "Usage: org-ruby <file> [options]"
|
15
|
+
|
16
|
+
opts.on("-h", "--help", "Show this message") do |v|
|
17
|
+
options[:help] = true
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on("-t", "--translate FORMAT", [:html, :textile],
|
21
|
+
"Translate the ORG file to the specified format.") do |v|
|
22
|
+
options[:format] = v
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
begin
|
27
|
+
options_parser.parse!
|
28
|
+
if (ARGV.length == 0) then
|
29
|
+
puts options_parser
|
30
|
+
else
|
31
|
+
data = IO.read(ARGV[0])
|
32
|
+
p = Orgmode::Parser.new(data)
|
33
|
+
puts p.to_html if options[:format] == :html
|
34
|
+
puts p.to_textile if options[:format] == :textile
|
35
|
+
end
|
36
|
+
rescue OptionParser::ParseError
|
37
|
+
puts options_parser
|
38
|
+
end
|
39
|
+
|
40
|
+
|
data/lib/org-ruby.rb
CHANGED
@@ -1,50 +1,50 @@
|
|
1
|
-
unless defined? ::OrgRuby
|
2
|
-
|
3
|
-
module OrgRuby
|
4
|
-
|
5
|
-
# :stopdoc:
|
6
|
-
VERSION = '0.5.
|
7
|
-
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
|
8
|
-
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
|
9
|
-
# :startdoc:
|
10
|
-
|
11
|
-
# Returns the version string for the library.
|
12
|
-
#
|
13
|
-
def self.version
|
14
|
-
VERSION
|
15
|
-
end
|
16
|
-
|
17
|
-
# Returns the library path for the module. If any arguments are given,
|
18
|
-
# they will be joined to the end of the libray path using
|
19
|
-
# <tt>File.join</tt>.
|
20
|
-
#
|
21
|
-
def self.libpath( *args )
|
22
|
-
args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
|
23
|
-
end
|
24
|
-
|
25
|
-
# Returns the lpath for the module. If any arguments are given,
|
26
|
-
# they will be joined to the end of the path using
|
27
|
-
# <tt>File.join</tt>.
|
28
|
-
#
|
29
|
-
def self.path( *args )
|
30
|
-
args.empty? ? PATH : ::File.join(PATH, args.flatten)
|
31
|
-
end
|
32
|
-
|
33
|
-
# Utility method used to require all files ending in .rb that lie in the
|
34
|
-
# directory below this file that has the same name as the filename passed
|
35
|
-
# in. Optionally, a specific _directory_ name can be passed in such that
|
36
|
-
# the _filename_ does not have to be equivalent to the directory.
|
37
|
-
#
|
38
|
-
def self.require_all_libs_relative_to( fname, dir = nil )
|
39
|
-
dir ||= ::File.basename(fname, '.*')
|
40
|
-
search_me = ::File.expand_path(
|
41
|
-
::File.join(::File.dirname(fname), dir, '**', '*.rb'))
|
42
|
-
|
43
|
-
Dir.glob(search_me).sort.each {|rb| require rb}
|
44
|
-
end
|
45
|
-
|
46
|
-
end # module OrgmodeParser
|
47
|
-
|
48
|
-
OrgRuby.require_all_libs_relative_to(__FILE__)
|
49
|
-
|
50
|
-
end # unless defined?
|
1
|
+
unless defined? ::OrgRuby
|
2
|
+
|
3
|
+
module OrgRuby
|
4
|
+
|
5
|
+
# :stopdoc:
|
6
|
+
VERSION = '0.5.2'
|
7
|
+
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
|
8
|
+
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
|
9
|
+
# :startdoc:
|
10
|
+
|
11
|
+
# Returns the version string for the library.
|
12
|
+
#
|
13
|
+
def self.version
|
14
|
+
VERSION
|
15
|
+
end
|
16
|
+
|
17
|
+
# Returns the library path for the module. If any arguments are given,
|
18
|
+
# they will be joined to the end of the libray path using
|
19
|
+
# <tt>File.join</tt>.
|
20
|
+
#
|
21
|
+
def self.libpath( *args )
|
22
|
+
args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Returns the lpath for the module. If any arguments are given,
|
26
|
+
# they will be joined to the end of the path using
|
27
|
+
# <tt>File.join</tt>.
|
28
|
+
#
|
29
|
+
def self.path( *args )
|
30
|
+
args.empty? ? PATH : ::File.join(PATH, args.flatten)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Utility method used to require all files ending in .rb that lie in the
|
34
|
+
# directory below this file that has the same name as the filename passed
|
35
|
+
# in. Optionally, a specific _directory_ name can be passed in such that
|
36
|
+
# the _filename_ does not have to be equivalent to the directory.
|
37
|
+
#
|
38
|
+
def self.require_all_libs_relative_to( fname, dir = nil )
|
39
|
+
dir ||= ::File.basename(fname, '.*')
|
40
|
+
search_me = ::File.expand_path(
|
41
|
+
::File.join(::File.dirname(fname), dir, '**', '*.rb'))
|
42
|
+
|
43
|
+
Dir.glob(search_me).sort.each {|rb| require rb}
|
44
|
+
end
|
45
|
+
|
46
|
+
end # module OrgmodeParser
|
47
|
+
|
48
|
+
OrgRuby.require_all_libs_relative_to(__FILE__)
|
49
|
+
|
50
|
+
end # unless defined?
|