org-ruby 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/org-ruby/line.rb CHANGED
@@ -66,13 +66,19 @@ module Orgmode
66
66
  @line =~ PropertyDrawerItemRegexp
67
67
  end
68
68
 
69
+ def property_drawer_item
70
+ @line =~ PropertyDrawerItemRegexp
71
+
72
+ [$1, $2]
73
+ end
74
+
69
75
  # Tests if a line contains metadata instead of actual content.
70
76
  def metadata?
71
77
  check_assignment_or_regexp(:metadata, /^\s*(CLOCK|DEADLINE|START|CLOSED|SCHEDULED):/)
72
78
  end
73
79
 
74
80
  def nonprinting?
75
- comment? || metadata? || begin_block? || end_block?
81
+ comment? || metadata? || begin_block? || end_block? || include_file?
76
82
  end
77
83
 
78
84
  def blank?
@@ -218,6 +224,30 @@ module Orgmode
218
224
  end
219
225
  end
220
226
 
227
+ LinkAbbrevRegexp = /^\s*#\+LINK:\s*(\w+)\s+(.+)$/i
228
+
229
+ def link_abbrev?
230
+ @line =~ LinkAbbrevRegexp
231
+ end
232
+
233
+ def link_abbrev_data
234
+ [$1, $2] if @line =~ LinkAbbrevRegexp
235
+ end
236
+
237
+ IncludeFileRegexp = /^\s*#\+INCLUDE:\s*"([^"]+)"(\s+([^\s]+)\s+(.*))?$/i
238
+
239
+ def include_file?
240
+ @line =~ IncludeFileRegexp
241
+ end
242
+
243
+ def include_file_path
244
+ File.expand_path $1 if @line =~ IncludeFileRegexp
245
+ end
246
+
247
+ def include_file_options
248
+ [$3, $4] if @line =~ IncludeFileRegexp and !$2.nil?
249
+ end
250
+
221
251
  # Determines the paragraph type of the current line.
222
252
  def determine_paragraph_type
223
253
  @paragraph_type = \
@@ -46,8 +46,9 @@ module Orgmode
46
46
  @mode_stack.last
47
47
  end
48
48
 
49
- def push_mode(mode)
49
+ def push_mode(mode, indent)
50
50
  @mode_stack.push(mode)
51
+ @list_indent_stack.push(indent)
51
52
  end
52
53
 
53
54
  def pop_mode(mode = nil)
@@ -200,6 +201,10 @@ module Orgmode
200
201
  end
201
202
  end
202
203
 
204
+ def add_line_attributes headline
205
+ # Implemented by specific output buffers
206
+ end
207
+
203
208
  def output_footnotes!
204
209
  return false
205
210
  end
@@ -96,11 +96,56 @@ module Orgmode
96
96
  @header_lines = []
97
97
  @in_buffer_settings = { }
98
98
  @options = { }
99
+ @link_abbrevs = { }
100
+
101
+ parse_lines @lines, offset
102
+ end
103
+
104
+ # Check include file availability and permissions
105
+ def check_include_file(file_path)
106
+ can_be_included = File.exists? file_path
107
+
108
+ if not ENV['ORG_RUBY_INCLUDE_ROOT'].nil?
109
+ # Ensure we have full paths
110
+ root_path = File.expand_path ENV['ORG_RUBY_INCLUDE_ROOT']
111
+ file_path = File.expand_path file_path
112
+
113
+ # Check if file is in the defined root path and really exists
114
+ if file_path.slice(0, root_path.length) != root_path
115
+ can_be_included = false
116
+ end
117
+ end
118
+
119
+ can_be_included
120
+ end
121
+
122
+ # Parse lines
123
+ def parse_lines(lines, offset)
99
124
  mode = :normal
100
125
  previous_line = nil
101
126
  table_header_set = false
102
- @lines.each do |text|
127
+ lines.each do |text|
103
128
  line = Line.new text, self
129
+
130
+ # Disable file include feature by default since it would be dangerous in some environments
131
+ # It can be activated either by setting a ORG_RUBY_ENABLE_INCLUDE_FILES environment variable
132
+ # or by setting a root path for included file via the ORG_RUBY_INCLUDE_ROOT environment variable
133
+ if ENV['ORG_RUBY_ENABLE_INCLUDE_FILES'] == 'true' \
134
+ or not ENV['ORG_RUBY_INCLUDE_ROOT'].nil?
135
+ if line.include_file? and not line.include_file_path.nil?
136
+ next if not check_include_file line.include_file_path
137
+ include_data = get_include_data line
138
+ include_lines = Orgmode::Parser.new(include_data).lines
139
+ parse_lines include_lines, offset
140
+ end
141
+ end
142
+
143
+ # Store link abbreviations
144
+ if line.link_abbrev?
145
+ link_abbrev_data = line.link_abbrev_data
146
+ @link_abbrevs[link_abbrev_data[0]] = link_abbrev_data[1]
147
+ end
148
+
104
149
  mode = :normal if line.end_block? and mode == line.paragraph_type
105
150
  mode = :normal if line.property_drawer_end_block? and mode == :property_drawer
106
151
 
@@ -130,7 +175,11 @@ module Orgmode
130
175
  end
131
176
 
132
177
  mode = line.paragraph_type if line.begin_block?
133
- mode = :property_drawer if line.property_drawer_begin_block?
178
+ mode = :property_drawer if previous_line and previous_line.property_drawer_begin_block?
179
+ end
180
+
181
+ if mode == :property_drawer and @current_headline
182
+ @current_headline.property_drawer[line.property_drawer_item.first] = line.property_drawer_item.last
134
183
  end
135
184
 
136
185
  unless mode == :comment
@@ -142,9 +191,52 @@ module Orgmode
142
191
  end
143
192
 
144
193
  previous_line = line
145
- end # @lines.each
194
+ end # lines.each
146
195
  end # initialize
147
196
 
197
+ # Get include data, when #+INCLUDE tag is used
198
+ # @link http://orgmode.org/manual/Include-files.html
199
+ def get_include_data(line)
200
+ return IO.read(line.include_file_path) if line.include_file_options.nil?
201
+
202
+ case line.include_file_options[0]
203
+ when ':lines'
204
+ # Get options
205
+ include_file_lines = line.include_file_options[1].gsub('"', '').split('-')
206
+ include_file_lines[0] = include_file_lines[0].empty? ? 1 : include_file_lines[0].to_i
207
+ include_file_lines[1] = include_file_lines[1].to_i if !include_file_lines[1].nil?
208
+
209
+ # Extract request lines. Note that the second index is excluded, according to the doc
210
+ line_index = 1
211
+ include_data = []
212
+ File.open(line.include_file_path, "r") do |fd|
213
+ while line_data = fd.gets
214
+ if (line_index >= include_file_lines[0] and (include_file_lines[1].nil? or line_index < include_file_lines[1]))
215
+ include_data << line_data.chomp
216
+ end
217
+ line_index += 1
218
+ end
219
+ end
220
+
221
+ when 'src', 'example', 'quote'
222
+ # Prepare tags
223
+ begin_tag = '#+BEGIN_%s' % [line.include_file_options[0].upcase]
224
+ if line.include_file_options[0] == 'src' and !line.include_file_options[1].nil?
225
+ begin_tag += ' ' + line.include_file_options[1]
226
+ end
227
+ end_tag = '#+END_%s' % [line.include_file_options[0].upcase]
228
+
229
+ # Get lines. Will be transformed into an array at processing
230
+ include_data = "%s\n%s\n%s" % [begin_tag, IO.read(line.include_file_path), end_tag]
231
+
232
+ else
233
+ include_data = []
234
+ end
235
+ # @todo: support ":minlevel"
236
+
237
+ include_data
238
+ end
239
+
148
240
  # Creates a new parser from the data in a given file
149
241
  def self.load(fname)
150
242
  lines = IO.readlines(fname)
@@ -171,7 +263,8 @@ module Orgmode
171
263
  :export_heading_number => export_heading_number?,
172
264
  :export_todo => export_todo?,
173
265
  :use_sub_superscripts => use_sub_superscripts?,
174
- :export_footnotes => export_footnotes?
266
+ :export_footnotes => export_footnotes?,
267
+ :link_abbrevs => @link_abbrevs
175
268
  }
176
269
  export_options[:skip_tables] = true if not export_tables?
177
270
  output = ""
@@ -12,8 +12,7 @@ module Orgmode
12
12
  end
13
13
 
14
14
  def push_mode(mode, indent)
15
- @list_indent_stack.push(indent)
16
- super(mode)
15
+ super(mode, indent)
17
16
  @output << "bc. " if mode_is_code? mode
18
17
  if mode == :center or mode == :quote
19
18
  @add_paragraph = false
@@ -3,351 +3,351 @@
3
3
 
4
4
  module Orgmode
5
5
  TextileEntities = {
6
- "Agrave" => "À",
7
- "agrave" => "à",
8
- "Aacute" => "Á",
9
- "aacute" => "á",
10
- "Acirc" => "Â",
11
- "acirc" => "â",
12
- "Atilde" => "Ã",
13
- "atilde" => "ã",
14
- "Auml" => "Ä",
15
- "auml" => "ä",
16
- "Aring" => "Å",
17
- "AA" => "Å",
18
- "aring" => "å",
19
- "AElig" => "Æ",
20
- "aelig" => "æ",
21
- "Ccedil" => "Ç",
22
- "ccedil" => "ç",
23
- "Egrave" => "È",
24
- "egrave" => "è",
25
- "Eacute" => "É",
26
- "eacute" => "é",
27
- "Ecirc" => "Ê",
28
- "ecirc" => "ê",
29
- "Euml" => "Ë",
30
- "euml" => "ë",
31
- "Igrave" => "Ì",
32
- "igrave" => "ì",
33
- "Iacute" => "Í",
34
- "iacute" => "í",
35
- "Icirc" => "Î",
36
- "icirc" => "î",
37
- "Iuml" => "Ï",
38
- "iuml" => "ï",
39
- "Ntilde" => "Ñ",
40
- "ntilde" => "ñ",
41
- "Ograve" => "Ò",
42
- "ograve" => "ò",
43
- "Oacute" => "Ó",
44
- "oacute" => "ó",
45
- "Ocirc" => "Ô",
46
- "ocirc" => "ô",
47
- "Otilde" => "Õ",
48
- "otilde" => "õ",
49
- "Ouml" => "Ö",
50
- "ouml" => "ö",
51
- "Oslash" => "Ø",
52
- "oslash" => "ø",
53
- "OElig" => "Œ",
54
- "oelig" => "œ",
55
- "Scaron" => "Š",
56
- "scaron" => "š",
57
- "szlig" => "ß",
58
- "Ugrave" => "Ù",
59
- "ugrave" => "ù",
60
- "Uacute" => "Ú",
61
- "uacute" => "ú",
62
- "Ucirc" => "Û",
63
- "ucirc" => "û",
64
- "Uuml" => "Ü",
65
- "uuml" => "ü",
66
- "Yacute" => "Ý",
67
- "yacute" => "ý",
68
- "Yuml" => "Ÿ",
69
- "yuml" => "ÿ",
70
- "fnof" => "ƒ",
71
- "real" => "ℜ",
72
- "image" => "ℑ",
73
- "weierp" => "℘",
74
- "Alpha" => "Α",
75
- "alpha" => "α",
76
- "Beta" => "Β",
77
- "beta" => "β",
78
- "Gamma" => "Γ",
79
- "gamma" => "γ",
80
- "Delta" => "Δ",
81
- "delta" => "δ",
82
- "Epsilon" => "Ε",
83
- "epsilon" => "ε",
84
- "varepsilon" => "ε",
85
- "Zeta" => "Ζ",
86
- "zeta" => "ζ",
87
- "Eta" => "Η",
88
- "eta" => "η",
89
- "Theta" => "Θ",
90
- "theta" => "θ",
91
- "thetasym" => "ϑ",
92
- "vartheta" => "ϑ",
93
- "Iota" => "Ι",
94
- "iota" => "ι",
95
- "Kappa" => "Κ",
96
- "kappa" => "κ",
97
- "Lambda" => "Λ",
98
- "lambda" => "λ",
99
- "Mu" => "Μ",
100
- "mu" => "μ",
101
- "nu" => "ν",
102
- "Nu" => "Ν",
103
- "Xi" => "Ξ",
104
- "xi" => "ξ",
105
- "Omicron" => "Ο",
106
- "omicron" => "ο",
107
- "Pi" => "Π",
108
- "pi" => "π",
109
- "Rho" => "Ρ",
110
- "rho" => "ρ",
111
- "Sigma" => "Σ",
112
- "sigma" => "σ",
113
- "sigmaf" => "ς",
114
- "varsigma" => "ς",
115
- "Tau" => "Τ",
116
- "Upsilon" => "Υ",
117
- "upsih" => "ϒ",
118
- "upsilon" => "υ",
119
- "Phi" => "Φ",
120
- "phi" => "φ",
121
- "Chi" => "Χ",
122
- "chi" => "χ",
123
- "acutex" => "𝑥́",
124
- "Psi" => "Ψ",
125
- "psi" => "ψ",
126
- "tau" => "τ",
127
- "Omega" => "Ω",
128
- "omega" => "ω",
129
- "piv" => "ϖ",
130
- "partial" => "∂",
131
- "alefsym" => "ℵ",
132
- "ETH" => "Ð",
133
- "eth" => "ð",
134
- "THORN" => "Þ",
135
- "thorn" => "þ",
136
- "dots" => "…",
137
- "hellip" => "…",
138
- "middot" => "·",
139
- "iexcl" => "¡",
140
- "iquest" => "¿",
141
- "shy" => "",
142
- "ndash" => "–",
143
- "mdash" => "—",
144
- "quot" => "\"",
145
- "acute" => "´",
146
- "ldquo" => "“",
147
- "rdquo" => "”",
148
- "bdquo" => "„",
149
- "lsquo" => "‘",
150
- "rsquo" => "’",
151
- "sbquo" => "‚",
152
- "laquo" => "«",
153
- "raquo" => "»",
154
- "lsaquo" => "‹",
155
- "rsaquo" => "›",
156
- "circ" => "ˆ",
157
- "vert" => "|",
158
- "brvbar" => "¦",
159
- "sect" => "§",
160
- "amp" => "&",
161
- "lt" => "<",
162
- "gt" => ">",
163
- "tilde" => "~",
164
- "slash" => "/",
165
- "plus" => "+",
166
- "under" => "_",
167
- "equal" => "=",
168
- "asciicirc" => "^",
169
- "dagger" => "†",
170
- "Dagger" => "‡",
171
- "nbsp" => " ",
172
- "ensp" => " ",
173
- "emsp" => " ",
174
- "thinsp" => " ",
175
- "curren" => "¤",
176
- "cent" => "¢",
177
- "pound" => "£",
178
- "yen" => "¥",
179
- "euro" => "€",
180
- "EUR" => "€",
181
- "EURdig" => "€",
182
- "EURhv" => "€",
183
- "EURcr" => "€",
184
- "EURtm" => "€",
185
- "copy" => "©",
186
- "reg" => "®",
187
- "trade" => "™",
188
- "minus" => "−",
189
- "pm" => "±",
190
- "plusmn" => "±",
191
- "times" => "×",
192
- "frasl" => "⁄",
193
- "div" => "÷",
194
- "frac12" => "½",
195
- "frac14" => "¼",
196
- "frac34" => "¾",
197
- "permil" => "‰",
198
- "sup1" => "¹",
199
- "sup2" => "²",
200
- "sup3" => "³",
201
- "radic" => "√",
202
- "sum" => "∑",
203
- "prod" => "∏",
204
- "micro" => "µ",
205
- "macr" => "¯",
206
- "deg" => "°",
207
- "prime" => "′",
208
- "Prime" => "″",
209
- "infin" => "∞",
210
- "infty" => "∞",
211
- "prop" => "∝",
212
- "proptp" => "∝",
213
- "not" => "¬",
214
- "neg" => "¬",
215
- "land" => "∧",
216
- "wedge" => "∧",
217
- "lor" => "∨",
218
- "vee" => "∨",
219
- "cap" => "∩",
220
- "cup" => "∪",
221
- "int" => "∫",
222
- "there4" => "∴",
223
- "sim" => "∼",
224
- "cong" => "≅",
225
- "simeq" => "≅",
226
- "asymp" => "≈",
227
- "approx" => "≈",
228
- "ne" => "≠",
229
- "neq" => "≠",
230
- "equiv" => "≡",
231
- "le" => "≤",
232
- "ge" => "≥",
233
- "sub" => "⊂",
234
- "subset" => "⊂",
235
- "sup" => "⊃",
236
- "supset" => "⊃",
237
- "nsub" => "⊄",
238
- "sube" => "⊆",
239
- "nsup" => "⊅",
240
- "supe" => "⊇",
241
- "forall" => "∀",
242
- "exist" => "∃",
243
- "exists" => "∃",
244
- "empty" => "∅",
245
- "emptyset" => "∅",
246
- "isin" => "∈",
247
- "in" => "∈",
248
- "notin" => "∉",
249
- "ni" => "∋",
250
- "nabla" => "∇",
251
- "ang" => "∠",
252
- "angle" => "∠",
253
- "perp" => "⊥",
254
- "sdot" => "⋅",
255
- "cdot" => "⋅",
256
- "lceil" => "⌈",
257
- "rceil" => "⌉",
258
- "lfloor" => "⌊",
259
- "rfloor" => "⌋",
260
- "lang" => "⟨",
261
- "rang" => "⟩",
262
- "larr" => "←",
263
- "leftarrow" => "←",
264
- "gets" => "←",
265
- "lArr" => "⇐",
266
- "Leftarrow" => "⇐",
267
- "uarr" => "↑",
268
- "uparrow" => "↑",
269
- "uArr" => "⇑",
270
- "Uparrow" => "⇑",
271
- "rarr" => "→",
272
- "to" => "→",
273
- "rightarrow" => "→",
274
- "rArr" => "⇒",
275
- "Rightarrow" => "⇒",
276
- "darr" => "↓",
277
- "downarrow" => "↓",
278
- "dArr" => "⇓",
279
- "Downarrow" => "⇓",
280
- "harr" => "↔",
6
+ "Agrave" => "À",
7
+ "agrave" => "à",
8
+ "Aacute" => "Á",
9
+ "aacute" => "á",
10
+ "Acirc" => "Â",
11
+ "acirc" => "â",
12
+ "Atilde" => "Ã",
13
+ "atilde" => "ã",
14
+ "Auml" => "Ä",
15
+ "auml" => "ä",
16
+ "Aring" => "Å",
17
+ "AA" => "Å",
18
+ "aring" => "å",
19
+ "AElig" => "Æ",
20
+ "aelig" => "æ",
21
+ "Ccedil" => "Ç",
22
+ "ccedil" => "ç",
23
+ "Egrave" => "È",
24
+ "egrave" => "è",
25
+ "Eacute" => "É",
26
+ "eacute" => "é",
27
+ "Ecirc" => "Ê",
28
+ "ecirc" => "ê",
29
+ "Euml" => "Ë",
30
+ "euml" => "ë",
31
+ "Igrave" => "Ì",
32
+ "igrave" => "ì",
33
+ "Iacute" => "Í",
34
+ "iacute" => "í",
35
+ "Icirc" => "Î",
36
+ "icirc" => "î",
37
+ "Iuml" => "Ï",
38
+ "iuml" => "ï",
39
+ "Ntilde" => "Ñ",
40
+ "ntilde" => "ñ",
41
+ "Ograve" => "Ò",
42
+ "ograve" => "ò",
43
+ "Oacute" => "Ó",
44
+ "oacute" => "ó",
45
+ "Ocirc" => "Ô",
46
+ "ocirc" => "ô",
47
+ "Otilde" => "Õ",
48
+ "otilde" => "õ",
49
+ "Ouml" => "Ö",
50
+ "ouml" => "ö",
51
+ "Oslash" => "Ø",
52
+ "oslash" => "ø",
53
+ "OElig" => "Œ",
54
+ "oelig" => "œ",
55
+ "Scaron" => "Š",
56
+ "scaron" => "š",
57
+ "szlig" => "ß",
58
+ "Ugrave" => "Ù",
59
+ "ugrave" => "ù",
60
+ "Uacute" => "Ú",
61
+ "uacute" => "ú",
62
+ "Ucirc" => "Û",
63
+ "ucirc" => "û",
64
+ "Uuml" => "Ü",
65
+ "uuml" => "ü",
66
+ "Yacute" => "Ý",
67
+ "yacute" => "ý",
68
+ "Yuml" => "Ÿ",
69
+ "yuml" => "ÿ",
70
+ "fnof" => "ƒ",
71
+ "real" => "ℜ",
72
+ "image" => "ℑ",
73
+ "weierp" => "℘",
74
+ "Alpha" => "Α",
75
+ "alpha" => "α",
76
+ "Beta" => "Β",
77
+ "beta" => "β",
78
+ "Gamma" => "Γ",
79
+ "gamma" => "γ",
80
+ "Delta" => "Δ",
81
+ "delta" => "δ",
82
+ "Epsilon" => "Ε",
83
+ "epsilon" => "ε",
84
+ "varepsilon" => "ε",
85
+ "Zeta" => "Ζ",
86
+ "zeta" => "ζ",
87
+ "Eta" => "Η",
88
+ "eta" => "η",
89
+ "Theta" => "Θ",
90
+ "theta" => "θ",
91
+ "thetasym" => "ϑ",
92
+ "vartheta" => "ϑ",
93
+ "Iota" => "Ι",
94
+ "iota" => "ι",
95
+ "Kappa" => "Κ",
96
+ "kappa" => "κ",
97
+ "Lambda" => "Λ",
98
+ "lambda" => "λ",
99
+ "Mu" => "Μ",
100
+ "mu" => "μ",
101
+ "nu" => "ν",
102
+ "Nu" => "Ν",
103
+ "Xi" => "Ξ",
104
+ "xi" => "ξ",
105
+ "Omicron" => "Ο",
106
+ "omicron" => "ο",
107
+ "Pi" => "Π",
108
+ "pi" => "π",
109
+ "Rho" => "Ρ",
110
+ "rho" => "ρ",
111
+ "Sigma" => "Σ",
112
+ "sigma" => "σ",
113
+ "sigmaf" => "ς",
114
+ "varsigma" => "ς",
115
+ "Tau" => "Τ",
116
+ "Upsilon" => "Υ",
117
+ "upsih" => "ϒ",
118
+ "upsilon" => "υ",
119
+ "Phi" => "Φ",
120
+ "phi" => "φ",
121
+ "Chi" => "Χ",
122
+ "chi" => "χ",
123
+ "acutex" => "𝑥́",
124
+ "Psi" => "Ψ",
125
+ "psi" => "ψ",
126
+ "tau" => "τ",
127
+ "Omega" => "Ω",
128
+ "omega" => "ω",
129
+ "piv" => "ϖ",
130
+ "partial" => "∂",
131
+ "alefsym" => "ℵ",
132
+ "ETH" => "Ð",
133
+ "eth" => "ð",
134
+ "THORN" => "Þ",
135
+ "thorn" => "þ",
136
+ "dots" => "…",
137
+ "hellip" => "…",
138
+ "middot" => "·",
139
+ "iexcl" => "¡",
140
+ "iquest" => "¿",
141
+ "shy" => "",
142
+ "ndash" => "–",
143
+ "mdash" => "—",
144
+ "quot" => "\"",
145
+ "acute" => "´",
146
+ "ldquo" => "“",
147
+ "rdquo" => "”",
148
+ "bdquo" => "„",
149
+ "lsquo" => "‘",
150
+ "rsquo" => "’",
151
+ "sbquo" => "‚",
152
+ "laquo" => "«",
153
+ "raquo" => "»",
154
+ "lsaquo" => "‹",
155
+ "rsaquo" => "›",
156
+ "circ" => "ˆ",
157
+ "vert" => "|",
158
+ "brvbar" => "¦",
159
+ "sect" => "§",
160
+ "amp" => "&",
161
+ "lt" => "<",
162
+ "gt" => ">",
163
+ "tilde" => "~",
164
+ "slash" => "/",
165
+ "plus" => "+",
166
+ "under" => "_",
167
+ "equal" => "=",
168
+ "asciicirc" => "^",
169
+ "dagger" => "†",
170
+ "Dagger" => "‡",
171
+ "nbsp" => " ",
172
+ "ensp" => " ",
173
+ "emsp" => " ",
174
+ "thinsp" => " ",
175
+ "curren" => "¤",
176
+ "cent" => "¢",
177
+ "pound" => "£",
178
+ "yen" => "¥",
179
+ "euro" => "€",
180
+ "EUR" => "€",
181
+ "EURdig" => "€",
182
+ "EURhv" => "€",
183
+ "EURcr" => "€",
184
+ "EURtm" => "€",
185
+ "copy" => "©",
186
+ "reg" => "®",
187
+ "trade" => "™",
188
+ "minus" => "−",
189
+ "pm" => "±",
190
+ "plusmn" => "±",
191
+ "times" => "×",
192
+ "frasl" => "⁄",
193
+ "div" => "÷",
194
+ "frac12" => "½",
195
+ "frac14" => "¼",
196
+ "frac34" => "¾",
197
+ "permil" => "‰",
198
+ "sup1" => "¹",
199
+ "sup2" => "²",
200
+ "sup3" => "³",
201
+ "radic" => "√",
202
+ "sum" => "∑",
203
+ "prod" => "∏",
204
+ "micro" => "µ",
205
+ "macr" => "¯",
206
+ "deg" => "°",
207
+ "prime" => "′",
208
+ "Prime" => "″",
209
+ "infin" => "∞",
210
+ "infty" => "∞",
211
+ "prop" => "∝",
212
+ "proptp" => "∝",
213
+ "not" => "¬",
214
+ "neg" => "¬",
215
+ "land" => "∧",
216
+ "wedge" => "∧",
217
+ "lor" => "∨",
218
+ "vee" => "∨",
219
+ "cap" => "∩",
220
+ "cup" => "∪",
221
+ "int" => "∫",
222
+ "there4" => "∴",
223
+ "sim" => "∼",
224
+ "cong" => "≅",
225
+ "simeq" => "≅",
226
+ "asymp" => "≈",
227
+ "approx" => "≈",
228
+ "ne" => "≠",
229
+ "neq" => "≠",
230
+ "equiv" => "≡",
231
+ "le" => "≤",
232
+ "ge" => "≥",
233
+ "sub" => "⊂",
234
+ "subset" => "⊂",
235
+ "sup" => "⊃",
236
+ "supset" => "⊃",
237
+ "nsub" => "⊄",
238
+ "sube" => "⊆",
239
+ "nsup" => "⊅",
240
+ "supe" => "⊇",
241
+ "forall" => "∀",
242
+ "exist" => "∃",
243
+ "exists" => "∃",
244
+ "empty" => "∅",
245
+ "emptyset" => "∅",
246
+ "isin" => "∈",
247
+ "in" => "∈",
248
+ "notin" => "∉",
249
+ "ni" => "∋",
250
+ "nabla" => "∇",
251
+ "ang" => "∠",
252
+ "angle" => "∠",
253
+ "perp" => "⊥",
254
+ "sdot" => "⋅",
255
+ "cdot" => "⋅",
256
+ "lceil" => "⌈",
257
+ "rceil" => "⌉",
258
+ "lfloor" => "⌊",
259
+ "rfloor" => "⌋",
260
+ "lang" => "⟨",
261
+ "rang" => "⟩",
262
+ "larr" => "←",
263
+ "leftarrow" => "←",
264
+ "gets" => "←",
265
+ "lArr" => "⇐",
266
+ "Leftarrow" => "⇐",
267
+ "uarr" => "↑",
268
+ "uparrow" => "↑",
269
+ "uArr" => "⇑",
270
+ "Uparrow" => "⇑",
271
+ "rarr" => "→",
272
+ "to" => "→",
273
+ "rightarrow" => "→",
274
+ "rArr" => "⇒",
275
+ "Rightarrow" => "⇒",
276
+ "darr" => "↓",
277
+ "downarrow" => "↓",
278
+ "dArr" => "⇓",
279
+ "Downarrow" => "⇓",
280
+ "harr" => "↔",
281
281
  "leftrightarrow" => "↔",
282
- "hArr" => "⇔",
282
+ "hArr" => "⇔",
283
283
  "Leftrightarrow" => "⇔",
284
- "crarr" => "↵",
285
- "hookleftarrow" => "↵",
286
- "arccos" => "arccos",
287
- "arcsin" => "arcsin",
288
- "arctan" => "arctan",
289
- "arg" => "arg",
290
- "cos" => "cos",
291
- "cosh" => "cosh",
292
- "cot" => "cot",
293
- "coth" => "coth",
294
- "csc" => "csc",
295
- "deg" => "deg",
296
- "det" => "det",
297
- "dim" => "dim",
298
- "exp" => "exp",
299
- "gcd" => "gcd",
300
- "hom" => "hom",
301
- "inf" => "inf",
302
- "ker" => "ker",
303
- "lg" => "lg",
304
- "lim" => "lim",
305
- "liminf" => "liminf",
306
- "limsup" => "limsup",
307
- "ln" => "ln",
308
- "log" => "log",
309
- "max" => "max",
310
- "min" => "min",
311
- "Pr" => "Pr",
312
- "sec" => "sec",
313
- "sin" => "sin",
314
- "sinh" => "sinh",
315
- "sup" => "sup",
316
- "tan" => "tan",
317
- "tanh" => "tanh",
318
- "bull" => "•",
319
- "bullet" => "•",
320
- "star" => "⋆",
321
- "lowast" => "∗",
322
- "ast" => "*",
323
- "odot" => "ʘ",
324
- "oplus" => "⊕",
325
- "otimes" => "⊗",
326
- "checkmark" => "✓",
327
- "para" => "¶",
328
- "ordf" => "ª",
329
- "ordm" => "º",
330
- "cedil" => "¸",
331
- "oline" => "‾",
332
- "uml" => "¨",
333
- "zwnj" => "‌",
334
- "zwj" => "‍",
335
- "lrm" => "‎",
336
- "rlm" => "‏",
337
- "smile" => "⌣",
338
- "smiley" => "☺",
339
- "blacksmile" => "☻",
340
- "sad" => "☹",
341
- "clubs" => "♣",
342
- "clubsuit" => "♣",
343
- "spades" => "♠",
344
- "spadesuit" => "♠",
345
- "hearts" => "♥",
346
- "heartsuit" => "♥",
347
- "diams" => "♦",
348
- "diamondsuit" => "♦",
349
- "Diamond" => "⋄",
350
- "loz" => "◊"
284
+ "crarr" => "↵",
285
+ "hookleftarrow" => "↵",
286
+ "arccos" => "arccos",
287
+ "arcsin" => "arcsin",
288
+ "arctan" => "arctan",
289
+ "arg" => "arg",
290
+ "cos" => "cos",
291
+ "cosh" => "cosh",
292
+ "cot" => "cot",
293
+ "coth" => "coth",
294
+ "csc" => "csc",
295
+ "deg" => "deg",
296
+ "det" => "det",
297
+ "dim" => "dim",
298
+ "exp" => "exp",
299
+ "gcd" => "gcd",
300
+ "hom" => "hom",
301
+ "inf" => "inf",
302
+ "ker" => "ker",
303
+ "lg" => "lg",
304
+ "lim" => "lim",
305
+ "liminf" => "liminf",
306
+ "limsup" => "limsup",
307
+ "ln" => "ln",
308
+ "log" => "log",
309
+ "max" => "max",
310
+ "min" => "min",
311
+ "Pr" => "Pr",
312
+ "sec" => "sec",
313
+ "sin" => "sin",
314
+ "sinh" => "sinh",
315
+ "sup" => "sup",
316
+ "tan" => "tan",
317
+ "tanh" => "tanh",
318
+ "bull" => "•",
319
+ "bullet" => "•",
320
+ "star" => "⋆",
321
+ "lowast" => "∗",
322
+ "ast" => "*",
323
+ "odot" => "ʘ",
324
+ "oplus" => "⊕",
325
+ "otimes" => "⊗",
326
+ "checkmark" => "✓",
327
+ "para" => "¶",
328
+ "ordf" => "ª",
329
+ "ordm" => "º",
330
+ "cedil" => "¸",
331
+ "oline" => "‾",
332
+ "uml" => "¨",
333
+ "zwnj" => "‌",
334
+ "zwj" => "‍",
335
+ "lrm" => "‎",
336
+ "rlm" => "‏",
337
+ "smile" => "⌣",
338
+ "smiley" => "☺",
339
+ "blacksmile" => "☻",
340
+ "sad" => "☹",
341
+ "clubs" => "♣",
342
+ "clubsuit" => "♣",
343
+ "spades" => "♠",
344
+ "spadesuit" => "♠",
345
+ "hearts" => "♥",
346
+ "heartsuit" => "♥",
347
+ "diams" => "♦",
348
+ "diamondsuit" => "♦",
349
+ "Diamond" => "⋄",
350
+ "loz" => "◊"
351
351
  }
352
352
  @org_entities_regexp = /\\(there4|sup[123]|frac[13][24]|[a-zA-Z]+)($|\{\}|[^a-zA-Z])/
353
353