org-ruby 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- 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/lib/org-ruby/headline.rb
CHANGED
@@ -1,120 +1,102 @@
|
|
1
|
-
require OrgRuby.libpath(*%w[org-ruby line])
|
2
|
-
|
3
|
-
module Orgmode
|
4
|
-
|
5
|
-
# Represents a headline in an orgmode file.
|
6
|
-
class Headline < Line
|
7
|
-
|
8
|
-
# This is the "level" of the headline
|
9
|
-
attr_reader :level
|
10
|
-
|
11
|
-
# This is the headline text -- the part of the headline minus the leading
|
12
|
-
# asterisks, the keywords, and the tags.
|
13
|
-
attr_reader :headline_text
|
14
|
-
|
15
|
-
# This contains the lines that "belong" to the headline.
|
16
|
-
attr_reader :body_lines
|
17
|
-
|
18
|
-
# These are the headline tags
|
19
|
-
attr_reader :tags
|
20
|
-
|
21
|
-
# Optional keyword found at the beginning of the headline.
|
22
|
-
attr_reader :keyword
|
23
|
-
|
24
|
-
# Valid states for partial export.
|
25
|
-
# exclude:: The entire subtree from this heading should be excluded.
|
26
|
-
# headline_only:: The headline should be exported, but not the body.
|
27
|
-
# all:: Everything should be exported, headline/body/children.
|
28
|
-
ValidExportStates = [:exclude, :headline_only, :all]
|
29
|
-
|
30
|
-
# The export state of this headline. See +ValidExportStates+.
|
31
|
-
attr_accessor :export_state
|
32
|
-
|
33
|
-
# This is the regex that matches a line
|
34
|
-
LineRegexp = /^\*+\s+/
|
35
|
-
|
36
|
-
# This matches the tags on a headline
|
37
|
-
TagsRegexp = /\s*:[\w:]*:\s*$/
|
38
|
-
|
39
|
-
# Special keywords allowed at the start of a line.
|
40
|
-
Keywords = %w[TODO DONE]
|
41
|
-
|
42
|
-
KeywordsRegexp = Regexp.new("^(#{Keywords.join('|')})\$")
|
43
|
-
|
44
|
-
def initialize(line, parser = nil)
|
45
|
-
super(line, parser)
|
46
|
-
@body_lines = []
|
47
|
-
@
|
48
|
-
@
|
49
|
-
|
50
|
-
|
51
|
-
@
|
52
|
-
|
53
|
-
|
54
|
-
@tags
|
55
|
-
@
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
#
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
output
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
def escape(str)
|
104
|
-
str = str.gsub(/&/, "&")
|
105
|
-
str = str.gsub(/</, "<")
|
106
|
-
str = str.gsub(/>/, ">")
|
107
|
-
str
|
108
|
-
end
|
109
|
-
|
110
|
-
def parse_keywords
|
111
|
-
re = @parser.custom_keyword_regexp if @parser
|
112
|
-
re ||= KeywordsRegexp
|
113
|
-
words = @headline_text.split
|
114
|
-
if words.length > 0 && words[0] =~ re then
|
115
|
-
@keyword = words[0]
|
116
|
-
@headline_text.sub!(Regexp.new("^#{@keyword}\s*"), "")
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end # class Headline
|
120
|
-
end # class Orgmode
|
1
|
+
require OrgRuby.libpath(*%w[org-ruby line])
|
2
|
+
|
3
|
+
module Orgmode
|
4
|
+
|
5
|
+
# Represents a headline in an orgmode file.
|
6
|
+
class Headline < Line
|
7
|
+
|
8
|
+
# This is the "level" of the headline
|
9
|
+
attr_reader :level
|
10
|
+
|
11
|
+
# This is the headline text -- the part of the headline minus the leading
|
12
|
+
# asterisks, the keywords, and the tags.
|
13
|
+
attr_reader :headline_text
|
14
|
+
|
15
|
+
# This contains the lines that "belong" to the headline.
|
16
|
+
attr_reader :body_lines
|
17
|
+
|
18
|
+
# These are the headline tags
|
19
|
+
attr_reader :tags
|
20
|
+
|
21
|
+
# Optional keyword found at the beginning of the headline.
|
22
|
+
attr_reader :keyword
|
23
|
+
|
24
|
+
# Valid states for partial export.
|
25
|
+
# exclude:: The entire subtree from this heading should be excluded.
|
26
|
+
# headline_only:: The headline should be exported, but not the body.
|
27
|
+
# all:: Everything should be exported, headline/body/children.
|
28
|
+
ValidExportStates = [:exclude, :headline_only, :all]
|
29
|
+
|
30
|
+
# The export state of this headline. See +ValidExportStates+.
|
31
|
+
attr_accessor :export_state
|
32
|
+
|
33
|
+
# This is the regex that matches a line
|
34
|
+
LineRegexp = /^\*+\s+/
|
35
|
+
|
36
|
+
# This matches the tags on a headline
|
37
|
+
TagsRegexp = /\s*:[\w:]*:\s*$/
|
38
|
+
|
39
|
+
# Special keywords allowed at the start of a line.
|
40
|
+
Keywords = %w[TODO DONE]
|
41
|
+
|
42
|
+
KeywordsRegexp = Regexp.new("^(#{Keywords.join('|')})\$")
|
43
|
+
|
44
|
+
def initialize(line, parser = nil)
|
45
|
+
super(line, parser)
|
46
|
+
@body_lines = []
|
47
|
+
@body_lines << self # Make @body_lines contain the headline?
|
48
|
+
@tags = []
|
49
|
+
@export_state = :exclude
|
50
|
+
if (@line =~ LineRegexp) then
|
51
|
+
@level = $&.strip.length
|
52
|
+
@headline_text = $'.strip
|
53
|
+
if (@headline_text =~ TagsRegexp) then
|
54
|
+
@tags = $&.split(/:/) # split tag text on semicolon
|
55
|
+
@tags.delete_at(0) # the first item will be empty; discard
|
56
|
+
@headline_text.gsub!(TagsRegexp, "") # Removes the tags from the headline
|
57
|
+
end
|
58
|
+
@keyword = nil
|
59
|
+
parse_keywords
|
60
|
+
else
|
61
|
+
raise "'#{line}' is not a valid headline"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Override Line.output_text. For a heading, @headline_text
|
66
|
+
# is what we should output.
|
67
|
+
def output_text
|
68
|
+
return @headline_text
|
69
|
+
end
|
70
|
+
|
71
|
+
# Determines if a line is an orgmode "headline":
|
72
|
+
# A headline begins with one or more asterisks.
|
73
|
+
def self.headline?(line)
|
74
|
+
line =~ LineRegexp
|
75
|
+
end
|
76
|
+
|
77
|
+
# Overrides Line.paragraph_type.
|
78
|
+
def paragraph_type
|
79
|
+
:"heading#{@level}"
|
80
|
+
end
|
81
|
+
|
82
|
+
# Converts this headline and its body to textile.
|
83
|
+
def to_textile
|
84
|
+
output = "h#{@level}. #{@headline_text}\n"
|
85
|
+
output << Line.to_textile(@body_lines[1..-1])
|
86
|
+
output
|
87
|
+
end
|
88
|
+
|
89
|
+
######################################################################
|
90
|
+
private
|
91
|
+
|
92
|
+
def parse_keywords
|
93
|
+
re = @parser.custom_keyword_regexp if @parser
|
94
|
+
re ||= KeywordsRegexp
|
95
|
+
words = @headline_text.split
|
96
|
+
if words.length > 0 && words[0] =~ re then
|
97
|
+
@keyword = words[0]
|
98
|
+
@headline_text.sub!(Regexp.new("^#{@keyword}\s*"), "")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end # class Headline
|
102
|
+
end # class Orgmode
|
@@ -1,156 +1,174 @@
|
|
1
|
-
require OrgRuby.libpath(*%w[org-ruby output_buffer])
|
2
|
-
|
3
|
-
module Orgmode
|
4
|
-
|
5
|
-
class HtmlOutputBuffer < OutputBuffer
|
6
|
-
|
7
|
-
HtmlBlockTag = {
|
8
|
-
:paragraph => "p",
|
9
|
-
:ordered_list => "li",
|
10
|
-
:unordered_list => "li",
|
11
|
-
:table_row => "tr",
|
12
|
-
:table_header => "tr"
|
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
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
end
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
1
|
+
require OrgRuby.libpath(*%w[org-ruby output_buffer])
|
2
|
+
|
3
|
+
module Orgmode
|
4
|
+
|
5
|
+
class HtmlOutputBuffer < OutputBuffer
|
6
|
+
|
7
|
+
HtmlBlockTag = {
|
8
|
+
:paragraph => "p",
|
9
|
+
:ordered_list => "li",
|
10
|
+
:unordered_list => "li",
|
11
|
+
:table_row => "tr",
|
12
|
+
:table_header => "tr",
|
13
|
+
:heading1 => "h1",
|
14
|
+
:heading2 => "h2",
|
15
|
+
:heading3 => "h3",
|
16
|
+
:heading4 => "h4",
|
17
|
+
:heading5 => "h5",
|
18
|
+
:heading6 => "h6"
|
19
|
+
}
|
20
|
+
|
21
|
+
ModeTag = {
|
22
|
+
:unordered_list => "ul",
|
23
|
+
:ordered_list => "ol",
|
24
|
+
:table => "table",
|
25
|
+
:blockquote => "blockquote",
|
26
|
+
:example => "pre",
|
27
|
+
:src => "pre",
|
28
|
+
:inline_example => "pre"
|
29
|
+
}
|
30
|
+
|
31
|
+
attr_reader :options
|
32
|
+
|
33
|
+
def initialize(output, opts = {})
|
34
|
+
super(output)
|
35
|
+
if opts[:decorate_title] then
|
36
|
+
@title_decoration = " class=\"title\""
|
37
|
+
else
|
38
|
+
@title_decoration = ""
|
39
|
+
end
|
40
|
+
@options = opts
|
41
|
+
@logger.debug "HTML export options: #{@options.inspect}"
|
42
|
+
end
|
43
|
+
|
44
|
+
# Output buffer is entering a new mode. Use this opportunity to
|
45
|
+
# write out one of the block tags in the ModeTag constant to put
|
46
|
+
# this information in the HTML stream.
|
47
|
+
def push_mode(mode)
|
48
|
+
if ModeTag[mode] then
|
49
|
+
output_indentation
|
50
|
+
css_class = ""
|
51
|
+
css_class = " class=\"src\"" if mode == :src
|
52
|
+
css_class = " class=\"example\"" if (mode == :example || mode == :inline_example)
|
53
|
+
@logger.debug "#{mode}: <#{ModeTag[mode]}#{css_class}>\n"
|
54
|
+
@output << "<#{ModeTag[mode]}#{css_class}>\n" unless mode == :table and skip_tables?
|
55
|
+
# Entering a new mode obliterates the title decoration
|
56
|
+
@title_decoration = ""
|
57
|
+
end
|
58
|
+
super(mode)
|
59
|
+
end
|
60
|
+
|
61
|
+
# We are leaving a mode. Close any tags that were opened when
|
62
|
+
# entering this mode.
|
63
|
+
def pop_mode(mode = nil)
|
64
|
+
m = super(mode)
|
65
|
+
if ModeTag[m] then
|
66
|
+
output_indentation
|
67
|
+
@logger.debug "</#{ModeTag[m]}>\n"
|
68
|
+
@output << "</#{ModeTag[m]}>\n" unless mode == :table and skip_tables?
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def flush!
|
73
|
+
escape_buffer!
|
74
|
+
if mode_is_code(@buffer_mode) then
|
75
|
+
# Whitespace is significant in :code mode. Always output the buffer
|
76
|
+
# and do not do any additional translation.
|
77
|
+
@logger.debug "FLUSH CODE ==========> #{@buffer.inspect}"
|
78
|
+
@output << @buffer << "\n"
|
79
|
+
else
|
80
|
+
if (@buffer.length > 0) then
|
81
|
+
unless buffer_mode_is_table? and skip_tables?
|
82
|
+
@logger.debug "FLUSH ==========> #{@buffer_mode}"
|
83
|
+
output_indentation
|
84
|
+
@output << "<#{HtmlBlockTag[@output_type]}#{@title_decoration}>"
|
85
|
+
if (@buffered_lines[0].kind_of?(Headline)) then
|
86
|
+
headline = @buffered_lines[0]
|
87
|
+
raise "Cannot be more than one headline!" if @buffered_lines.length > 1
|
88
|
+
if @options[:export_heading_number] then
|
89
|
+
level = headline.level
|
90
|
+
heading_number = get_next_headline_number(level)
|
91
|
+
output << "<span class=\"heading-number heading-number-#{level}\">#{heading_number} </span>"
|
92
|
+
end
|
93
|
+
if @options[:export_todo] and headline.keyword then
|
94
|
+
keyword = headline.keyword
|
95
|
+
output << "<span class=\"todo-keyword #{keyword}\">#{keyword} </span>"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
@output << inline_formatting(@buffer)
|
99
|
+
@output << "</#{HtmlBlockTag[@output_type]}>\n"
|
100
|
+
@title_decoration = ""
|
101
|
+
else
|
102
|
+
@logger.debug "SKIP ==========> #{@buffer_mode}"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
clear_accumulation_buffer!
|
107
|
+
end
|
108
|
+
|
109
|
+
######################################################################
|
110
|
+
private
|
111
|
+
|
112
|
+
def skip_tables?
|
113
|
+
@options[:skip_tables]
|
114
|
+
end
|
115
|
+
|
116
|
+
def buffer_mode_is_table?
|
117
|
+
@buffer_mode == :table
|
118
|
+
end
|
119
|
+
|
120
|
+
# Escapes any HTML content in the output accumulation buffer @buffer.
|
121
|
+
def escape_buffer!
|
122
|
+
@buffer.gsub!(/&/, "&")
|
123
|
+
@buffer.gsub!(/</, "<")
|
124
|
+
@buffer.gsub!(/>/, ">")
|
125
|
+
end
|
126
|
+
|
127
|
+
def output_indentation
|
128
|
+
indent = " " * (@mode_stack.length - 1)
|
129
|
+
@output << indent
|
130
|
+
end
|
131
|
+
|
132
|
+
Tags = {
|
133
|
+
"*" => { :open => "<b>", :close => "</b>" },
|
134
|
+
"/" => { :open => "<i>", :close => "</i>" },
|
135
|
+
"_" => { :open => "<span style=\"text-decoration:underline;\">",
|
136
|
+
:close => "</span>" },
|
137
|
+
"=" => { :open => "<code>", :close => "</code>" },
|
138
|
+
"~" => { :open => "<code>", :close => "</code>" },
|
139
|
+
"+" => { :open => "<del>", :close => "</del>" }
|
140
|
+
}
|
141
|
+
|
142
|
+
# Applies inline formatting rules to a string.
|
143
|
+
def inline_formatting(str)
|
144
|
+
str.rstrip!
|
145
|
+
str = @re_help.rewrite_emphasis(str) do |marker, s|
|
146
|
+
"#{Tags[marker][:open]}#{s}#{Tags[marker][:close]}"
|
147
|
+
end
|
148
|
+
str = @re_help.rewrite_links(str) do |link, text|
|
149
|
+
text ||= link
|
150
|
+
link = link.sub(/^file:(.*)::(.*?)$/) do
|
151
|
+
|
152
|
+
# We don't support search links right now. Get rid of it.
|
153
|
+
|
154
|
+
"file:#{$1}"
|
155
|
+
end
|
156
|
+
link = link.sub(/^file:/i, "") # will default to HTTP
|
157
|
+
link = link.sub(/\.org$/i, ".html")
|
158
|
+
"<a href=\"#{link}\">#{text}</a>"
|
159
|
+
end
|
160
|
+
if (@output_type == :table_row) then
|
161
|
+
str.gsub!(/^\|\s*/, "<td>")
|
162
|
+
str.gsub!(/\s*\|$/, "</td>")
|
163
|
+
str.gsub!(/\s*\|\s*/, "</td><td>")
|
164
|
+
end
|
165
|
+
if (@output_type == :table_header) then
|
166
|
+
str.gsub!(/^\|\s*/, "<th>")
|
167
|
+
str.gsub!(/\s*\|$/, "</th>")
|
168
|
+
str.gsub!(/\s*\|\s*/, "</th><th>")
|
169
|
+
end
|
170
|
+
str
|
171
|
+
end
|
172
|
+
|
173
|
+
end # class HtmlOutputBuffer
|
174
|
+
end # module Orgmode
|