org-ruby 0.6.3 → 0.6.4
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 +6 -0
- data/bin/org-ruby +11 -5
- data/lib/org-ruby.rb +21 -23
- data/lib/org-ruby/headline.rb +0 -2
- data/lib/org-ruby/html_output_buffer.rb +60 -19
- data/lib/org-ruby/line.rb +9 -9
- data/lib/org-ruby/output_buffer.rb +9 -9
- data/lib/org-ruby/parser.rb +4 -1
- data/lib/org-ruby/regexp_helper.rb +3 -3
- metadata +66 -153
- data/.bnsignore +0 -18
- data/.gitignore +0 -2
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -36
- data/Rakefile +0 -26
- data/TAGS +0 -133
- data/announcement.txt +0 -19
- data/org-ruby.gemspec +0 -37
- data/spec/data/freeform-example.org +0 -113
- data/spec/data/freeform.org +0 -111
- data/spec/data/hyp-planning.org +0 -335
- data/spec/data/remember.org +0 -53
- data/spec/headline_spec.rb +0 -65
- data/spec/html_examples/advanced-code.html +0 -81
- data/spec/html_examples/advanced-code.org +0 -106
- data/spec/html_examples/advanced-lists.html +0 -31
- data/spec/html_examples/advanced-lists.org +0 -31
- data/spec/html_examples/block_code.html +0 -28
- data/spec/html_examples/block_code.org +0 -35
- data/spec/html_examples/blockcomment.html +0 -3
- data/spec/html_examples/blockcomment.org +0 -15
- data/spec/html_examples/blockquote.html +0 -7
- data/spec/html_examples/blockquote.org +0 -13
- data/spec/html_examples/center.html +0 -6
- data/spec/html_examples/center.org +0 -7
- data/spec/html_examples/code-comment.html +0 -18
- data/spec/html_examples/code-comment.org +0 -22
- data/spec/html_examples/comment-trees.html +0 -4
- data/spec/html_examples/comment-trees.org +0 -13
- data/spec/html_examples/custom-seq-todo.html +0 -15
- data/spec/html_examples/custom-seq-todo.org +0 -24
- data/spec/html_examples/custom-todo.html +0 -15
- data/spec/html_examples/custom-todo.org +0 -24
- data/spec/html_examples/custom-typ-todo.html +0 -15
- data/spec/html_examples/custom-typ-todo.org +0 -24
- data/spec/html_examples/deflist.html +0 -6
- data/spec/html_examples/deflist.org +0 -6
- data/spec/html_examples/entities.html +0 -4
- data/spec/html_examples/entities.org +0 -11
- data/spec/html_examples/escape-pre.html +0 -6
- data/spec/html_examples/escape-pre.org +0 -6
- data/spec/html_examples/export-exclude-only.html +0 -13
- data/spec/html_examples/export-exclude-only.org +0 -81
- data/spec/html_examples/export-keywords.html +0 -4
- data/spec/html_examples/export-keywords.org +0 -18
- data/spec/html_examples/export-tags.html +0 -8
- data/spec/html_examples/export-tags.org +0 -82
- data/spec/html_examples/export-title.html +0 -2
- data/spec/html_examples/export-title.org +0 -4
- data/spec/html_examples/footnotes.html +0 -10
- data/spec/html_examples/footnotes.org +0 -7
- data/spec/html_examples/horizontal_rule.html +0 -4
- data/spec/html_examples/horizontal_rule.org +0 -5
- data/spec/html_examples/html-literal.html +0 -2
- data/spec/html_examples/html-literal.org +0 -6
- data/spec/html_examples/inline-formatting.html +0 -25
- data/spec/html_examples/inline-formatting.org +0 -43
- data/spec/html_examples/inline-images.html +0 -10
- data/spec/html_examples/inline-images.org +0 -15
- data/spec/html_examples/link-features.html +0 -20
- data/spec/html_examples/link-features.org +0 -35
- data/spec/html_examples/lists.html +0 -23
- data/spec/html_examples/lists.org +0 -47
- data/spec/html_examples/metadata-comment.html +0 -27
- data/spec/html_examples/metadata-comment.org +0 -30
- data/spec/html_examples/only-list.html +0 -5
- data/spec/html_examples/only-list.org +0 -3
- data/spec/html_examples/only-table.html +0 -6
- data/spec/html_examples/only-table.org +0 -5
- data/spec/html_examples/skip-header.html +0 -3
- data/spec/html_examples/skip-header.org +0 -28
- data/spec/html_examples/skip-table.html +0 -4
- data/spec/html_examples/skip-table.org +0 -19
- data/spec/html_examples/subsupscript-nil.html +0 -3
- data/spec/html_examples/subsupscript-nil.org +0 -6
- data/spec/html_examples/subsupscript.html +0 -3
- data/spec/html_examples/subsupscript.org +0 -5
- data/spec/html_examples/tables.html +0 -35
- data/spec/html_examples/tables.org +0 -50
- data/spec/html_examples/text.html +0 -2
- data/spec/html_examples/text.org +0 -16
- data/spec/line_spec.rb +0 -162
- data/spec/output_buffer_spec.rb +0 -19
- data/spec/parser_spec.rb +0 -158
- data/spec/regexp_helper_spec.rb +0 -57
- data/spec/spec_helper.rb +0 -20
- data/spec/textile_examples/block_code.org +0 -35
- data/spec/textile_examples/block_code.textile +0 -29
- data/spec/textile_examples/blockquote.org +0 -13
- data/spec/textile_examples/blockquote.textile +0 -11
- data/spec/textile_examples/center.org +0 -7
- data/spec/textile_examples/center.textile +0 -6
- data/spec/textile_examples/footnotes.org +0 -7
- data/spec/textile_examples/footnotes.textile +0 -8
- data/spec/textile_examples/keywords.org +0 -13
- data/spec/textile_examples/keywords.textile +0 -11
- data/spec/textile_examples/links.org +0 -11
- data/spec/textile_examples/links.textile +0 -10
- data/spec/textile_examples/lists.org +0 -36
- data/spec/textile_examples/lists.textile +0 -20
- data/spec/textile_examples/single-space-plain-list.org +0 -13
- data/spec/textile_examples/single-space-plain-list.textile +0 -10
- data/spec/textile_examples/tables.org +0 -50
- data/spec/textile_examples/tables.textile +0 -40
- data/spec/textile_output_buffer_spec.rb +0 -21
- data/tasks/test_case.rake +0 -49
- data/util/gen-special-replace.el +0 -37
data/History.txt
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
== 0.6.4 / 2012-07-08
|
|
2
|
+
|
|
3
|
+
* Fixed lists behavior when code fragments, tables and examples were present
|
|
4
|
+
* Remove code tags with lang class and use instead src-:lang like org-exporter
|
|
5
|
+
* Fixed property drawers to consider properties with hyphens like :noweb-ref:
|
|
6
|
+
|
|
1
7
|
== 0.6.3 / 2012-05-22
|
|
2
8
|
|
|
3
9
|
* Minor enhancement: Correct handling of .org URIs in HTML markup routine (thanks, rayl)
|
data/bin/org-ruby
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require File.expand_path(
|
|
4
|
-
File.join(File.dirname(__FILE__), %w[.. lib org-ruby]))
|
|
2
|
+
require 'org-ruby'
|
|
5
3
|
require 'optparse'
|
|
6
4
|
|
|
7
|
-
# Put your code here
|
|
8
|
-
|
|
9
5
|
options = {}
|
|
10
6
|
options_parser = OptionParser.new do |opts|
|
|
11
7
|
options[:help] = false
|
|
@@ -25,10 +21,20 @@ options_parser = OptionParser.new do |opts|
|
|
|
25
21
|
"Translate the ORG file to the specified format.") do |v|
|
|
26
22
|
options[:format] = v
|
|
27
23
|
end
|
|
24
|
+
|
|
25
|
+
opts.on("-v", "--version", "Print version") do |v|
|
|
26
|
+
options[:version] = true
|
|
27
|
+
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
begin
|
|
31
31
|
options_parser.parse!
|
|
32
|
+
|
|
33
|
+
if options[:version]
|
|
34
|
+
puts OrgRuby::VERSION
|
|
35
|
+
exit
|
|
36
|
+
end
|
|
37
|
+
|
|
32
38
|
if (ARGV.length == 0) then
|
|
33
39
|
puts options_parser
|
|
34
40
|
else
|
data/lib/org-ruby.rb
CHANGED
|
@@ -1,9 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
$:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
|
|
2
|
+
|
|
3
|
+
# internal requires
|
|
4
|
+
require 'org-ruby/parser'
|
|
5
|
+
require 'org-ruby/regexp_helper'
|
|
6
|
+
require 'org-ruby/line'
|
|
7
|
+
require 'org-ruby/headline'
|
|
8
|
+
require 'org-ruby/output_buffer'
|
|
9
|
+
|
|
10
|
+
# HTML exporter
|
|
11
|
+
require 'org-ruby/html_output_buffer'
|
|
12
|
+
require 'org-ruby/html_symbol_replace'
|
|
13
|
+
|
|
14
|
+
# Textile exporter
|
|
15
|
+
require 'org-ruby/textile_output_buffer'
|
|
16
|
+
require 'org-ruby/textile_symbol_replace'
|
|
17
|
+
|
|
18
|
+
# Tilt support
|
|
19
|
+
require 'org-ruby/tilt'
|
|
2
20
|
|
|
3
21
|
module OrgRuby
|
|
4
22
|
|
|
5
23
|
# :stopdoc:
|
|
6
|
-
VERSION = '0.6.
|
|
24
|
+
VERSION = '0.6.4'
|
|
7
25
|
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
|
|
8
26
|
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
|
|
9
27
|
# :startdoc:
|
|
@@ -14,22 +32,6 @@ module OrgRuby
|
|
|
14
32
|
VERSION
|
|
15
33
|
end
|
|
16
34
|
|
|
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
35
|
# Utility method used to require all files ending in .rb that lie in the
|
|
34
36
|
# directory below this file that has the same name as the filename passed
|
|
35
37
|
# in. Optionally, a specific _directory_ name can be passed in such that
|
|
@@ -43,8 +45,4 @@ module OrgRuby
|
|
|
43
45
|
Dir.glob(search_me).sort.each {|rb| require rb}
|
|
44
46
|
end
|
|
45
47
|
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
OrgRuby.require_all_libs_relative_to(__FILE__)
|
|
49
|
-
|
|
50
|
-
end # unless defined?
|
|
48
|
+
end
|
data/lib/org-ruby/headline.rb
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
require OrgRuby.libpath(*%w[org-ruby html_symbol_replace])
|
|
2
|
-
require OrgRuby.libpath(*%w[org-ruby output_buffer])
|
|
3
|
-
|
|
4
1
|
module Orgmode
|
|
5
2
|
|
|
6
3
|
class HtmlOutputBuffer < OutputBuffer
|
|
@@ -44,6 +41,7 @@ module Orgmode
|
|
|
44
41
|
end
|
|
45
42
|
@options = opts
|
|
46
43
|
@footnotes = {}
|
|
44
|
+
@unclosed_tags = []
|
|
47
45
|
@logger.debug "HTML export options: #{@options.inspect}"
|
|
48
46
|
end
|
|
49
47
|
|
|
@@ -54,16 +52,12 @@ module Orgmode
|
|
|
54
52
|
if ModeTag[mode] then
|
|
55
53
|
output_indentation
|
|
56
54
|
css_class = ""
|
|
57
|
-
css_class = " class=\"src\"" if mode == :src
|
|
55
|
+
css_class = " class=\"src\"" if mode == :src and @block_lang.empty?
|
|
56
|
+
css_class = " class=\"src src-#{@block_lang}\"" if mode == :src and not @block_lang.empty?
|
|
58
57
|
css_class = " class=\"example\"" if (mode == :example || mode == :inline_example)
|
|
59
58
|
css_class = " style=\"text-align: center\"" if mode == :center
|
|
60
|
-
@logger.debug "#{mode}: <#{ModeTag[mode]}#{css_class}>\n"
|
|
59
|
+
@logger.debug "#{mode}: <#{ModeTag[mode]}#{css_class}>\n"
|
|
61
60
|
@output << "<#{ModeTag[mode]}#{css_class}>\n" unless mode == :table and skip_tables?
|
|
62
|
-
# Special case to add code tags to src blogs and specify language
|
|
63
|
-
if mode == :src
|
|
64
|
-
@logger.debug "<code class=\"#{@block_lang}\">\n"
|
|
65
|
-
@output << "<code class=\"#{@block_lang}\">\n"
|
|
66
|
-
end
|
|
67
61
|
# Entering a new mode obliterates the title decoration
|
|
68
62
|
@title_decoration = ""
|
|
69
63
|
end
|
|
@@ -76,12 +70,19 @@ module Orgmode
|
|
|
76
70
|
m = super(mode)
|
|
77
71
|
if ModeTag[m] then
|
|
78
72
|
output_indentation
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
# Need to close the floating li elements before closing the list
|
|
74
|
+
if (m == :unordered_list or
|
|
75
|
+
m == :ordered_list or
|
|
76
|
+
m == :definition_list) and
|
|
77
|
+
(not @unclosed_tags.empty?)
|
|
78
|
+
close_floating_li_tags
|
|
82
79
|
end
|
|
80
|
+
|
|
83
81
|
@logger.debug "</#{ModeTag[m]}>\n"
|
|
84
82
|
@output << "</#{ModeTag[m]}>\n" unless mode == :table and skip_tables?
|
|
83
|
+
|
|
84
|
+
# In case it was a sublist, close it here
|
|
85
|
+
close_last_li_tag_maybe
|
|
85
86
|
end
|
|
86
87
|
end
|
|
87
88
|
|
|
@@ -113,6 +114,11 @@ module Orgmode
|
|
|
113
114
|
unless buffer_mode_is_table? and skip_tables?
|
|
114
115
|
@logger.debug "FLUSH ==========> #{@buffer_mode}"
|
|
115
116
|
output_indentation
|
|
117
|
+
if ((@buffered_lines[0].plain_list?) and
|
|
118
|
+
(@unclosed_tags.count == @list_indent_stack.count))
|
|
119
|
+
@output << @unclosed_tags.pop
|
|
120
|
+
output_indentation
|
|
121
|
+
end
|
|
116
122
|
@output << "<#{HtmlBlockTag[@output_type]}#{@title_decoration}>"
|
|
117
123
|
if (@buffered_lines[0].kind_of?(Headline)) then
|
|
118
124
|
headline = @buffered_lines[0]
|
|
@@ -127,8 +133,19 @@ module Orgmode
|
|
|
127
133
|
output << "<span class=\"todo-keyword #{keyword}\">#{keyword} </span>"
|
|
128
134
|
end
|
|
129
135
|
end
|
|
130
|
-
@output << inline_formatting(@buffer)
|
|
131
|
-
|
|
136
|
+
@output << inline_formatting(@buffer)
|
|
137
|
+
|
|
138
|
+
# Only close the list when it is the last element from that list,
|
|
139
|
+
# or when starting another list
|
|
140
|
+
if (@output_type == :unordered_list or
|
|
141
|
+
@output_type == :ordered_list or
|
|
142
|
+
@output_type == :definition_list) and
|
|
143
|
+
(not @list_indent_stack.empty?)
|
|
144
|
+
@unclosed_tags.push("</#{HtmlBlockTag[@output_type]}>\n")
|
|
145
|
+
@output << "\n"
|
|
146
|
+
else
|
|
147
|
+
@output << "</#{HtmlBlockTag[@output_type]}>\n"
|
|
148
|
+
end
|
|
132
149
|
@title_decoration = ""
|
|
133
150
|
else
|
|
134
151
|
@logger.debug "SKIP ==========> #{@buffer_mode}"
|
|
@@ -214,12 +231,12 @@ module Orgmode
|
|
|
214
231
|
|
|
215
232
|
"file:#{$1}"
|
|
216
233
|
end
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
unless link.match(/:\/\/[^\/]*.org$/)
|
|
220
|
-
link = link.sub(/\.org$/i, ".html")
|
|
234
|
+
if link.match(/^file:.*\.org$/)
|
|
235
|
+
link = link.sub(/\.org$/i, ".html")
|
|
221
236
|
end
|
|
222
237
|
|
|
238
|
+
link = link.sub(/^file:/i, "") # will default to HTTP
|
|
239
|
+
|
|
223
240
|
text = text.gsub(/([^\]]*\.(jpg|jpeg|gif|png))/xi) do |img_link|
|
|
224
241
|
"<img src=\"#{img_link}\" />"
|
|
225
242
|
end
|
|
@@ -245,5 +262,29 @@ module Orgmode
|
|
|
245
262
|
Orgmode.special_symbols_to_html(str)
|
|
246
263
|
str
|
|
247
264
|
end
|
|
265
|
+
|
|
266
|
+
def close_floating_li_tags
|
|
267
|
+
unless @final_list_node
|
|
268
|
+
unless @unclosed_tags.empty?
|
|
269
|
+
@output << " " << @unclosed_tags.pop
|
|
270
|
+
output_indentation
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
@final_list_node = false
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
def close_last_li_tag_maybe
|
|
278
|
+
if (@list_indent_stack.count < @unclosed_tags.count) and not
|
|
279
|
+
(@list_indent_stack.empty? and @unclosed_tags.empty?)
|
|
280
|
+
output_indentation
|
|
281
|
+
@output << @unclosed_tags.pop
|
|
282
|
+
if (@list_indent_stack.count == @unclosed_tags.count) and not
|
|
283
|
+
(@list_indent_stack.empty? and @unclosed_tags.empty?)
|
|
284
|
+
@final_list_node = true
|
|
285
|
+
pop_mode
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
end
|
|
248
289
|
end # class HtmlOutputBuffer
|
|
249
290
|
end # module Orgmode
|
data/lib/org-ruby/line.rb
CHANGED
|
@@ -55,7 +55,7 @@ module Orgmode
|
|
|
55
55
|
check_assignment_or_regexp(:property_drawer, PropertyDrawerRegexp)
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
PropertyDrawerItemRegexp = /^\s*:(
|
|
58
|
+
PropertyDrawerItemRegexp = /^\s*:([0-9A-Za-z_\-]+):\s*(.*)$/i
|
|
59
59
|
|
|
60
60
|
def property_drawer_item?
|
|
61
61
|
@line =~ PropertyDrawerItemRegexp
|
|
@@ -94,12 +94,6 @@ module Orgmode
|
|
|
94
94
|
check_assignment_or_regexp(:definition_list, DefinitionListRegexp)
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
HorizontalRuleRegexp = /^\s*-{5,}\s*$/
|
|
98
|
-
|
|
99
|
-
def horizontal_rule?
|
|
100
|
-
check_assignment_or_regexp(:horizontal_rule, HorizontalRuleRegexp)
|
|
101
|
-
end
|
|
102
|
-
|
|
103
97
|
OrderedListRegexp = /^\s*\d+(\.|\))\s+/
|
|
104
98
|
|
|
105
99
|
def ordered_list?
|
|
@@ -110,6 +104,12 @@ module Orgmode
|
|
|
110
104
|
@line.sub(OrderedListRegexp, "")
|
|
111
105
|
end
|
|
112
106
|
|
|
107
|
+
HorizontalRuleRegexp = /^\s*-{5,}\s*$/
|
|
108
|
+
|
|
109
|
+
def horizontal_rule?
|
|
110
|
+
check_assignment_or_regexp(:horizontal_rule, HorizontalRuleRegexp)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
113
|
# Extracts meaningful text and excludes org-mode markup,
|
|
114
114
|
# like identifiers for lists or headings.
|
|
115
115
|
def output_text
|
|
@@ -137,7 +137,7 @@ module Orgmode
|
|
|
137
137
|
check_assignment_or_regexp(:table_separator, /^\s*\|[-\|\+]*\s*$/)
|
|
138
138
|
end
|
|
139
139
|
|
|
140
|
-
# Checks if this line is a table header.
|
|
140
|
+
# Checks if this line is a table header.
|
|
141
141
|
def table_header?
|
|
142
142
|
@assigned_paragraph_type == :table_header
|
|
143
143
|
end
|
|
@@ -234,7 +234,7 @@ module Orgmode
|
|
|
234
234
|
# What's tricky is lines can have assigned types, so you need to check
|
|
235
235
|
# the assigned type, if present, or see if the characteristic regexp
|
|
236
236
|
# for the paragraph type matches if not present.
|
|
237
|
-
#
|
|
237
|
+
#
|
|
238
238
|
# call-seq:
|
|
239
239
|
# check_assignment_or_regexp(assignment, regexp) => boolean
|
|
240
240
|
#
|
|
@@ -23,7 +23,7 @@ module Orgmode
|
|
|
23
23
|
# This is the overall output buffer
|
|
24
24
|
attr_reader :output
|
|
25
25
|
|
|
26
|
-
# This is the current type of output being accumulated.
|
|
26
|
+
# This is the current type of output being accumulated.
|
|
27
27
|
attr_accessor :output_type
|
|
28
28
|
|
|
29
29
|
# This stack is used to do proper outline numbering of headlines.
|
|
@@ -83,7 +83,7 @@ module Orgmode
|
|
|
83
83
|
@block_lang = line.block_lang if line.begin_block? and line.code_block_type?
|
|
84
84
|
flush!
|
|
85
85
|
maintain_list_indent_stack(line)
|
|
86
|
-
@output_type = line.paragraph_type
|
|
86
|
+
@output_type = line.paragraph_type
|
|
87
87
|
end
|
|
88
88
|
push_mode(:inline_example) if line.inline_example? and current_mode != :inline_example and not line.property_drawer?
|
|
89
89
|
pop_mode(:inline_example) if current_mode == :inline_example and !line.inline_example?
|
|
@@ -94,7 +94,7 @@ module Orgmode
|
|
|
94
94
|
@buffered_lines.push(line)
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
# Flushes everything currently in the accumulation buffer into the
|
|
97
|
+
# Flushes everything currently in the accumulation buffer into the
|
|
98
98
|
# output buffer. Derived classes must override this to actually move
|
|
99
99
|
# content into the output buffer with the appropriate markup. This
|
|
100
100
|
# method just does common bookkeeping cleanup.
|
|
@@ -142,7 +142,7 @@ module Orgmode
|
|
|
142
142
|
@buffer << str
|
|
143
143
|
end
|
|
144
144
|
|
|
145
|
-
# Gets the current list indent level.
|
|
145
|
+
# Gets the current list indent level.
|
|
146
146
|
def list_indent_level
|
|
147
147
|
@list_indent_stack.length
|
|
148
148
|
end
|
|
@@ -167,7 +167,7 @@ module Orgmode
|
|
|
167
167
|
def maintain_list_indent_stack(line)
|
|
168
168
|
if (line.plain_list?) then
|
|
169
169
|
while (not @list_indent_stack.empty? \
|
|
170
|
-
and (@list_indent_stack.last > line.indent))
|
|
170
|
+
and (@list_indent_stack.last > line.indent))
|
|
171
171
|
@list_indent_stack.pop
|
|
172
172
|
pop_mode
|
|
173
173
|
end
|
|
@@ -180,9 +180,9 @@ module Orgmode
|
|
|
180
180
|
|
|
181
181
|
# Nothing
|
|
182
182
|
|
|
183
|
-
elsif ((line.
|
|
184
|
-
(not @list_indent_stack.empty? and
|
|
185
|
-
|
|
183
|
+
elsif ((not line.plain_list?) and
|
|
184
|
+
(not @list_indent_stack.empty?) and
|
|
185
|
+
(line.indent > @list_indent_stack.last))
|
|
186
186
|
|
|
187
187
|
# Nothing -- output this paragraph inside
|
|
188
188
|
# the list block (ul/ol)
|
|
@@ -212,7 +212,7 @@ module Orgmode
|
|
|
212
212
|
|
|
213
213
|
# Special case: Multiple blank lines get accumulated.
|
|
214
214
|
return true if line.paragraph_type == :blank and @output_type == :blank
|
|
215
|
-
|
|
215
|
+
|
|
216
216
|
# Currently only "paragraphs" get accumulated with previous output.
|
|
217
217
|
return false unless line.paragraph_type == :paragraph
|
|
218
218
|
if ((@output_type == :ordered_list) or
|
data/lib/org-ruby/parser.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
1
|
require 'rubypants'
|
|
3
2
|
|
|
4
3
|
module Orgmode
|
|
@@ -270,6 +269,10 @@ module Orgmode
|
|
|
270
269
|
|
|
271
270
|
output_buffer << line.output_text
|
|
272
271
|
|
|
272
|
+
when :src
|
|
273
|
+
|
|
274
|
+
output_buffer << line.output_text << "\n"
|
|
275
|
+
|
|
273
276
|
else
|
|
274
277
|
|
|
275
278
|
if output_buffer.preserve_whitespace? then
|
|
@@ -3,7 +3,7 @@ require 'logger'
|
|
|
3
3
|
module Orgmode
|
|
4
4
|
|
|
5
5
|
# = Summary
|
|
6
|
-
#
|
|
6
|
+
#
|
|
7
7
|
# This class contains helper routines to deal with the Regexp "black
|
|
8
8
|
# magic" you need to properly parse org-mode files.
|
|
9
9
|
#
|
|
@@ -121,7 +121,7 @@ module Orgmode
|
|
|
121
121
|
# output format.
|
|
122
122
|
#
|
|
123
123
|
# = Usage
|
|
124
|
-
#
|
|
124
|
+
#
|
|
125
125
|
# Give this a block that expect the link and optional friendly
|
|
126
126
|
# text. Return how that link should get formatted.
|
|
127
127
|
#
|
|
@@ -161,7 +161,7 @@ module Orgmode
|
|
|
161
161
|
|
|
162
162
|
def build_org_emphasis_regexp
|
|
163
163
|
@org_emphasis_regexp = Regexp.new("([#{@pre_emphasis}]|^)\n" +
|
|
164
|
-
"( [#{@markers}] )\n" +
|
|
164
|
+
"( [#{@markers}] )\n" +
|
|
165
165
|
"( [^#{@border_forbidden}] | " +
|
|
166
166
|
" [^#{@border_forbidden}]#{@body_regexp}[^#{@border_forbidden}] )\n" +
|
|
167
167
|
"\\2\n" +
|
metadata
CHANGED
|
@@ -1,66 +1,71 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: org-ruby
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 15
|
|
5
5
|
prerelease:
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 6
|
|
9
|
+
- 4
|
|
10
|
+
version: 0.6.4
|
|
6
11
|
platform: ruby
|
|
7
|
-
authors:
|
|
12
|
+
authors:
|
|
8
13
|
- Brian Dewey
|
|
9
14
|
autorequire:
|
|
10
15
|
bindir: bin
|
|
11
16
|
cert_chain: []
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
|
|
18
|
+
date: 2012-07-08 00:00:00 Z
|
|
19
|
+
dependencies:
|
|
20
|
+
- !ruby/object:Gem::Dependency
|
|
15
21
|
name: rubypants
|
|
16
|
-
|
|
22
|
+
prerelease: false
|
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
17
24
|
none: false
|
|
18
|
-
requirements:
|
|
19
|
-
- -
|
|
20
|
-
- !ruby/object:Gem::Version
|
|
25
|
+
requirements:
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
hash: 23
|
|
29
|
+
segments:
|
|
30
|
+
- 0
|
|
31
|
+
- 2
|
|
32
|
+
- 0
|
|
21
33
|
version: 0.2.0
|
|
22
34
|
type: :runtime
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- !ruby/object:Gem::Dependency
|
|
35
|
+
version_requirements: *id001
|
|
36
|
+
- !ruby/object:Gem::Dependency
|
|
26
37
|
name: bones
|
|
27
|
-
|
|
38
|
+
prerelease: false
|
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
28
40
|
none: false
|
|
29
|
-
requirements:
|
|
30
|
-
- -
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
41
|
+
requirements:
|
|
42
|
+
- - ">="
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
hash: 39
|
|
45
|
+
segments:
|
|
46
|
+
- 3
|
|
47
|
+
- 8
|
|
48
|
+
- 0
|
|
32
49
|
version: 3.8.0
|
|
33
50
|
type: :development
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
HTML or textile. Currently, you cannot do much to customize the
|
|
41
|
-
|
|
42
|
-
conversion. The supplied textile conversion is optimized for
|
|
43
|
-
|
|
44
|
-
extracting "content" from the orgfile as opposed to "metadata." '
|
|
51
|
+
version_requirements: *id002
|
|
52
|
+
description: "This gem contains Ruby routines for parsing org-mode files.The most\n\
|
|
53
|
+
significant thing this library does today is convert org-mode files to\n\
|
|
54
|
+
HTML or textile. Currently, you cannot do much to customize the\n\
|
|
55
|
+
conversion. The supplied textile conversion is optimized for\n\
|
|
56
|
+
extracting \"content\" from the orgfile as opposed to \"metadata.\" "
|
|
45
57
|
email: bdewey@gmail.com
|
|
46
|
-
executables:
|
|
58
|
+
executables:
|
|
47
59
|
- org-ruby
|
|
48
60
|
extensions: []
|
|
49
|
-
|
|
61
|
+
|
|
62
|
+
extra_rdoc_files:
|
|
50
63
|
- History.txt
|
|
51
64
|
- README.rdoc
|
|
52
|
-
- announcement.txt
|
|
53
65
|
- bin/org-ruby
|
|
54
|
-
files:
|
|
55
|
-
- .bnsignore
|
|
56
|
-
- .gitignore
|
|
57
|
-
- Gemfile
|
|
58
|
-
- Gemfile.lock
|
|
66
|
+
files:
|
|
59
67
|
- History.txt
|
|
60
68
|
- README.rdoc
|
|
61
|
-
- Rakefile
|
|
62
|
-
- TAGS
|
|
63
|
-
- announcement.txt
|
|
64
69
|
- bin/org-ruby
|
|
65
70
|
- lib/org-ruby.rb
|
|
66
71
|
- lib/org-ruby/headline.rb
|
|
@@ -73,132 +78,40 @@ files:
|
|
|
73
78
|
- lib/org-ruby/textile_output_buffer.rb
|
|
74
79
|
- lib/org-ruby/textile_symbol_replace.rb
|
|
75
80
|
- lib/org-ruby/tilt.rb
|
|
76
|
-
- org-ruby.gemspec
|
|
77
|
-
- spec/data/freeform-example.org
|
|
78
|
-
- spec/data/freeform.org
|
|
79
|
-
- spec/data/hyp-planning.org
|
|
80
|
-
- spec/data/remember.org
|
|
81
|
-
- spec/headline_spec.rb
|
|
82
|
-
- spec/html_examples/advanced-code.html
|
|
83
|
-
- spec/html_examples/advanced-code.org
|
|
84
|
-
- spec/html_examples/advanced-lists.html
|
|
85
|
-
- spec/html_examples/advanced-lists.org
|
|
86
|
-
- spec/html_examples/block_code.html
|
|
87
|
-
- spec/html_examples/block_code.org
|
|
88
|
-
- spec/html_examples/blockcomment.html
|
|
89
|
-
- spec/html_examples/blockcomment.org
|
|
90
|
-
- spec/html_examples/blockquote.html
|
|
91
|
-
- spec/html_examples/blockquote.org
|
|
92
|
-
- spec/html_examples/center.html
|
|
93
|
-
- spec/html_examples/center.org
|
|
94
|
-
- spec/html_examples/code-comment.html
|
|
95
|
-
- spec/html_examples/code-comment.org
|
|
96
|
-
- spec/html_examples/comment-trees.html
|
|
97
|
-
- spec/html_examples/comment-trees.org
|
|
98
|
-
- spec/html_examples/custom-seq-todo.html
|
|
99
|
-
- spec/html_examples/custom-seq-todo.org
|
|
100
|
-
- spec/html_examples/custom-todo.html
|
|
101
|
-
- spec/html_examples/custom-todo.org
|
|
102
|
-
- spec/html_examples/custom-typ-todo.html
|
|
103
|
-
- spec/html_examples/custom-typ-todo.org
|
|
104
|
-
- spec/html_examples/deflist.html
|
|
105
|
-
- spec/html_examples/deflist.org
|
|
106
|
-
- spec/html_examples/entities.html
|
|
107
|
-
- spec/html_examples/entities.org
|
|
108
|
-
- spec/html_examples/escape-pre.html
|
|
109
|
-
- spec/html_examples/escape-pre.org
|
|
110
|
-
- spec/html_examples/export-exclude-only.html
|
|
111
|
-
- spec/html_examples/export-exclude-only.org
|
|
112
|
-
- spec/html_examples/export-keywords.html
|
|
113
|
-
- spec/html_examples/export-keywords.org
|
|
114
|
-
- spec/html_examples/export-tags.html
|
|
115
|
-
- spec/html_examples/export-tags.org
|
|
116
|
-
- spec/html_examples/export-title.html
|
|
117
|
-
- spec/html_examples/export-title.org
|
|
118
|
-
- spec/html_examples/footnotes.html
|
|
119
|
-
- spec/html_examples/footnotes.org
|
|
120
|
-
- spec/html_examples/horizontal_rule.html
|
|
121
|
-
- spec/html_examples/horizontal_rule.org
|
|
122
|
-
- spec/html_examples/html-literal.html
|
|
123
|
-
- spec/html_examples/html-literal.org
|
|
124
|
-
- spec/html_examples/inline-formatting.html
|
|
125
|
-
- spec/html_examples/inline-formatting.org
|
|
126
|
-
- spec/html_examples/inline-images.html
|
|
127
|
-
- spec/html_examples/inline-images.org
|
|
128
|
-
- spec/html_examples/link-features.html
|
|
129
|
-
- spec/html_examples/link-features.org
|
|
130
|
-
- spec/html_examples/lists.html
|
|
131
|
-
- spec/html_examples/lists.org
|
|
132
|
-
- spec/html_examples/metadata-comment.html
|
|
133
|
-
- spec/html_examples/metadata-comment.org
|
|
134
|
-
- spec/html_examples/only-list.html
|
|
135
|
-
- spec/html_examples/only-list.org
|
|
136
|
-
- spec/html_examples/only-table.html
|
|
137
|
-
- spec/html_examples/only-table.org
|
|
138
|
-
- spec/html_examples/skip-header.html
|
|
139
|
-
- spec/html_examples/skip-header.org
|
|
140
|
-
- spec/html_examples/skip-table.html
|
|
141
|
-
- spec/html_examples/skip-table.org
|
|
142
|
-
- spec/html_examples/subsupscript-nil.html
|
|
143
|
-
- spec/html_examples/subsupscript-nil.org
|
|
144
|
-
- spec/html_examples/subsupscript.html
|
|
145
|
-
- spec/html_examples/subsupscript.org
|
|
146
|
-
- spec/html_examples/tables.html
|
|
147
|
-
- spec/html_examples/tables.org
|
|
148
|
-
- spec/html_examples/text.html
|
|
149
|
-
- spec/html_examples/text.org
|
|
150
|
-
- spec/line_spec.rb
|
|
151
|
-
- spec/output_buffer_spec.rb
|
|
152
|
-
- spec/parser_spec.rb
|
|
153
|
-
- spec/regexp_helper_spec.rb
|
|
154
|
-
- spec/spec_helper.rb
|
|
155
|
-
- spec/textile_examples/block_code.org
|
|
156
|
-
- spec/textile_examples/block_code.textile
|
|
157
|
-
- spec/textile_examples/blockquote.org
|
|
158
|
-
- spec/textile_examples/blockquote.textile
|
|
159
|
-
- spec/textile_examples/center.org
|
|
160
|
-
- spec/textile_examples/center.textile
|
|
161
|
-
- spec/textile_examples/footnotes.org
|
|
162
|
-
- spec/textile_examples/footnotes.textile
|
|
163
|
-
- spec/textile_examples/keywords.org
|
|
164
|
-
- spec/textile_examples/keywords.textile
|
|
165
|
-
- spec/textile_examples/links.org
|
|
166
|
-
- spec/textile_examples/links.textile
|
|
167
|
-
- spec/textile_examples/lists.org
|
|
168
|
-
- spec/textile_examples/lists.textile
|
|
169
|
-
- spec/textile_examples/single-space-plain-list.org
|
|
170
|
-
- spec/textile_examples/single-space-plain-list.textile
|
|
171
|
-
- spec/textile_examples/tables.org
|
|
172
|
-
- spec/textile_examples/tables.textile
|
|
173
|
-
- spec/textile_output_buffer_spec.rb
|
|
174
|
-
- tasks/test_case.rake
|
|
175
81
|
- test/test_orgmode_parser.rb
|
|
176
|
-
- util/gen-special-replace.el
|
|
177
82
|
homepage: http://github.com/bdewey/org-ruby
|
|
178
83
|
licenses: []
|
|
84
|
+
|
|
179
85
|
post_install_message:
|
|
180
|
-
rdoc_options:
|
|
86
|
+
rdoc_options:
|
|
181
87
|
- --main
|
|
182
88
|
- README.rdoc
|
|
183
|
-
require_paths:
|
|
89
|
+
require_paths:
|
|
184
90
|
- lib
|
|
185
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
186
92
|
none: false
|
|
187
|
-
requirements:
|
|
188
|
-
- -
|
|
189
|
-
- !ruby/object:Gem::Version
|
|
190
|
-
|
|
191
|
-
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
hash: 3
|
|
97
|
+
segments:
|
|
98
|
+
- 0
|
|
99
|
+
version: "0"
|
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
101
|
none: false
|
|
193
|
-
requirements:
|
|
194
|
-
- -
|
|
195
|
-
- !ruby/object:Gem::Version
|
|
196
|
-
|
|
102
|
+
requirements:
|
|
103
|
+
- - ">="
|
|
104
|
+
- !ruby/object:Gem::Version
|
|
105
|
+
hash: 3
|
|
106
|
+
segments:
|
|
107
|
+
- 0
|
|
108
|
+
version: "0"
|
|
197
109
|
requirements: []
|
|
110
|
+
|
|
198
111
|
rubyforge_project: org-ruby
|
|
199
112
|
rubygems_version: 1.8.10
|
|
200
113
|
signing_key:
|
|
201
114
|
specification_version: 3
|
|
202
115
|
summary: This gem contains Ruby routines for parsing org-mode files.
|
|
203
|
-
test_files:
|
|
116
|
+
test_files:
|
|
204
117
|
- test/test_orgmode_parser.rb
|