org-ruby 0.9.12 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b108b7dfb32d9349c8db4a682cf3fce9fd1d6a34
4
- data.tar.gz: 68e543a03733225f7f52d6926357dfe900efb514
2
+ SHA256:
3
+ metadata.gz: 44fcdd4424ed21e279e00aa90e6f5b12f9b328137e19421d15e08dfb1a8b4bba
4
+ data.tar.gz: 134e3c2d9785c25da86c1085987b9b54ec861e6e3f94db3d9e7232618f0c483f
5
5
  SHA512:
6
- metadata.gz: 9b488291798de175e1b2f27961cd47080674e192ad374de93100f332728d630300539389d1409f629da93a4d0d939fd7640a1d8af277bef7e9331e8c1a1fa9e6
7
- data.tar.gz: 82291ac7147f88d4672804bd1b0dee0ab394afa9a87ae67ba82d89a799cebf94bf2cb57f39aefe9ff57c87e4150eb4413b562947ce1b753ecba26d6ed53f0e97
6
+ metadata.gz: 53fdc3e9be14d71ad68b85ef4f81a58ec168b93dc71f924106ced76762a28c2f6f084f4e51ba51e09d84dbfd1632fd542dfeaadfa1ba178c3ce6ef727e646d6d
7
+ data.tar.gz: 1dfc76204e15dc8d02524c02fd24396f90c46e34a320d1fcff43e918d904008ef77044ad59ca7d8c2ddfcd5a3520412a57afa635d1988ffc78d72ceb08456026
data/History.org CHANGED
@@ -2,6 +2,32 @@
2
2
  #+title: Changelog
3
3
  #+startup: showeverything
4
4
 
5
+ * 0.10.1 / 2026-10-09
6
+
7
+ - Escape custom TODO keywords containing regexp special characters
8
+ (by [[https://github.com/mockra][@mockra]])
9
+
10
+ * 0.10.0 / 2026-10-09
11
+
12
+ - Requires Ruby >= 3.1 (tested on Ruby 3.1 through 4.0)
13
+ - Upgrade =rubypants= dependency to =~> 0.7=
14
+ - Add =logger= as a runtime dependency (no longer a default gem as of Ruby 4.0)
15
+ - Replace =File.exists?= (removed in Ruby 3.2) with =File.exist?=
16
+ - Support =file+emacs= and =file+sys= links
17
+ - Handle continued numbered lists
18
+ - Recognize =js2= source blocks as JavaScript and =ipython= source blocks as Python
19
+ - Support relative links to svg/svgz files as inline images
20
+ - Change emphasis border regexp to match org.el
21
+ - Improve footnote HTML export: better anchoring between references and
22
+ definitions, no HTML escaping of footnote content, fix missing closing
23
+ paragraph tag
24
+ - Require =pathname= explicitly and default properties hash to empty
25
+ - Replace Travis CI with GitHub Actions
26
+
27
+ * 0.9.12 / 2014-12-22
28
+
29
+ - Remove duplicated hash keys
30
+
5
31
  * 0.9.10 / 2014-12-09
6
32
 
7
33
  - Add option to disable Rubypants
data/README.org CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  * OrgRuby
4
4
 
5
- [[https://secure.travis-ci.org/wallyqs/org-ruby.png?branch=master]]
5
+ [[https://github.com/wallyqs/org-ruby/actions/workflows/ci.yml][https://github.com/wallyqs/org-ruby/actions/workflows/ci.yml/badge.svg]]
6
6
 
7
7
  An [[http://orgmode.org][Org-mode]] parser written in Ruby.
8
8
 
@@ -97,7 +97,7 @@ module Orgmode
97
97
  words = @headline_text.split
98
98
  if words.length > 0 && words[0] =~ re then
99
99
  @keyword = words[0]
100
- @headline_text.sub!(Regexp.new("^#{@keyword}\s*"), "")
100
+ @headline_text.sub!(Regexp.new("^#{Regexp.escape(@keyword)}\s*"), "")
101
101
  end
102
102
  end
103
103
  end # class Headline
@@ -59,9 +59,9 @@ module Orgmode
59
59
  # Output buffer is entering a new mode. Use this opportunity to
60
60
  # write out one of the block tags in the HtmlBlockTag constant to
61
61
  # put this information in the HTML stream.
62
- def push_mode(mode, indent)
63
- super(mode, indent)
64
-
62
+ def push_mode(mode, indent, properties={})
63
+ @logger.debug "Properties: #{properties}"
64
+ super(mode, indent, properties)
65
65
  if HtmlBlockTag[mode]
66
66
  unless ((mode_is_table?(mode) and skip_tables?) or
67
67
  (mode == :src and !@options[:skip_syntax_highlight] and defined? Pygments))
@@ -77,12 +77,17 @@ module Orgmode
77
77
  when @options[:decorate_title]
78
78
  " class=\"title\""
79
79
  end
80
-
81
80
  add_paragraph unless @new_paragraph == :start
82
81
  @new_paragraph = true
83
82
 
84
83
  @logger.debug "#{mode}: <#{HtmlBlockTag[mode]}#{css_class}>"
85
- @output << "<#{HtmlBlockTag[mode]}#{css_class}>"
84
+ # Check to see if we need to restart numbering from a
85
+ # previous interrupted li
86
+ if mode_is_ol?(mode) && properties.key?(HtmlBlockTag[:list_item])
87
+ @output << "<#{HtmlBlockTag[mode]} start=#{properties[HtmlBlockTag[:list_item]]}#{css_class}>"
88
+ else
89
+ @output << "<#{HtmlBlockTag[mode]}#{css_class}>"
90
+ end
86
91
  # Entering a new mode obliterates the title decoration
87
92
  @options[:decorate_title] = nil
88
93
  end
@@ -202,15 +207,18 @@ module Orgmode
202
207
  end
203
208
 
204
209
  def output_footnotes!
210
+ # Only footnotes defined in the footnote (i.e., [fn:0:this is the footnote definition]) will be automatically
211
+ # added to a separate Footnotes section at the end of the document. All footnotes that are defined separately
212
+ # from their references will be rendered where they appear in the original Org document.
205
213
  return false unless @options[:export_footnotes] and not @footnotes.empty?
206
214
 
207
215
  @output << "\n<div id=\"footnotes\">\n<h2 class=\"footnotes\">Footnotes:</h2>\n<div id=\"text-footnotes\">\n"
208
-
209
- @footnotes.each do |name, defi|
216
+ @footnotes.each do |name, (defi, content)|
210
217
  @buffer = defi
211
- @output << "<p class=\"footnote\"><sup><a class=\"footnum\" name=\"fn.#{name}\" href=\"#fnr.#{name}\">#{name}</a></sup>" \
218
+ @output << "<div class=\"footdef\"><sup><a id=\"fn.#{name}\" href=\"#fnr.#{name}\">#{name}</a></sup>" \
219
+ << "<p class=\"footpara\">" \
212
220
  << inline_formatting(@buffer) \
213
- << "</p>\n"
221
+ << "</p></div>\n"
214
222
  end
215
223
 
216
224
  @output << "</div>\n</div>"
@@ -235,6 +243,10 @@ module Orgmode
235
243
  mode == :table_separator or mode == :table_header)
236
244
  end
237
245
 
246
+ def mode_is_ol?(mode)
247
+ mode == :ordered_list
248
+ end
249
+
238
250
  # Escapes any HTML content in string
239
251
  def escape_string! str
240
252
  str.gsub!(/&/, "&amp;")
@@ -299,7 +311,7 @@ module Orgmode
299
311
  [link, defi].compact.each do |text|
300
312
  # We don't support search links right now. Get rid of it.
301
313
  text.sub!(/\A(file:[^\s]+)::[^\s]*?\Z/, "\\1")
302
- text.sub!(/\Afile:(?=[^\s]+\Z)/, "")
314
+ text.sub!(/\Afile(|\+emacs|\+sys):(?=[^\s]+\Z)/, "")
303
315
  end
304
316
 
305
317
  # We don't add a description for images in links, because its
@@ -331,10 +343,14 @@ module Orgmode
331
343
  end
332
344
 
333
345
  if @options[:export_footnotes] then
346
+ @re_help.rewrite_footnote_definition str do |name, content|
347
+ quote_tags("<sup><a id=\"fn.#{name}\" class=\"footnum\" href=\"#fnr.#{name}\">") +
348
+ name + quote_tags("</a></sup> ") + content
349
+ end
350
+
334
351
  @re_help.rewrite_footnote str do |name, defi|
335
- # TODO escape name for url?
336
352
  @footnotes[name] = defi if defi
337
- quote_tags("<sup><a class=\"footref\" name=\"fnr.#{name}\" href=\"#fn.#{name}\">") +
353
+ quote_tags("<sup><a id=\"fnr.#{name}\" class=\"footref\" href=\"#fn.#{name}\">") +
338
354
  name + quote_tags("</a></sup>")
339
355
  end
340
356
  end
@@ -353,6 +369,10 @@ module Orgmode
353
369
  case lang
354
370
  when 'emacs-lisp', 'common-lisp', 'lisp'
355
371
  'scheme'
372
+ when 'ipython'
373
+ 'python'
374
+ when 'js2'
375
+ 'javascript'
356
376
  when ''
357
377
  'text'
358
378
  else
data/lib/org-ruby/line.rb CHANGED
@@ -36,6 +36,7 @@ module Orgmode
36
36
  @properties = { }
37
37
  determine_paragraph_type
38
38
  determine_major_mode
39
+ extract_properties
39
40
  @indent = $&.length unless blank?
40
41
  end
41
42
 
@@ -115,8 +116,25 @@ module Orgmode
115
116
  check_assignment_or_regexp(:ordered_list, OrderedListRegexp)
116
117
  end
117
118
 
119
+ ContinuedOrderedListRegexp = /^\[@(\d+)\]\s+/
120
+
118
121
  def strip_ordered_list_tag
119
- @line.sub(OrderedListRegexp, "")
122
+ line = @line.sub(OrderedListRegexp, "")
123
+ if line =~ ContinuedOrderedListRegexp
124
+ line = line.sub(ContinuedOrderedListRegexp, "")
125
+ end
126
+ return line
127
+ end
128
+
129
+ def extract_properties
130
+ if @line =~ OrderedListRegexp
131
+ line_without_number = @line.sub(OrderedListRegexp, "")
132
+ if line_without_number =~ ContinuedOrderedListRegexp
133
+ # Extract the start of the ordered list and store it in
134
+ # properties
135
+ @properties["li"] = line_without_number.match(ContinuedOrderedListRegexp)[1]
136
+ end
137
+ end
120
138
  end
121
139
 
122
140
  HorizontalRuleRegexp = /^\s*-{5,}\s*$/
@@ -15,8 +15,8 @@ module Orgmode
15
15
  end
16
16
  end
17
17
 
18
- def push_mode(mode, indent)
19
- super(mode, indent)
18
+ def push_mode(mode, indent, properties={})
19
+ super(mode, indent, properties)
20
20
  end
21
21
 
22
22
  def pop_mode(mode = nil)
@@ -46,7 +46,8 @@ module Orgmode
46
46
  @mode_stack.last
47
47
  end
48
48
 
49
- def push_mode(mode, indent)
49
+
50
+ def push_mode(mode, indent, properties={})
50
51
  @mode_stack.push(mode)
51
52
  @list_indent_stack.push(indent)
52
53
  end
@@ -136,7 +137,7 @@ module Orgmode
136
137
  end
137
138
 
138
139
  def do_custom_markup
139
- if File.exists? @options[:markup_file]
140
+ if File.exist? @options[:markup_file]
140
141
  load_custom_markup
141
142
  if @custom_blocktags.empty?
142
143
  no_valid_markup_found
@@ -234,10 +235,11 @@ module Orgmode
234
235
  mode_is_block? current_mode)
235
236
  # Opens the major mode of line if it exists
236
237
  if @list_indent_stack.last != line.indent or mode_is_block? current_mode
237
- push_mode(line.major_mode, line.indent) if line.major_mode
238
+ push_mode(line.major_mode, line.indent, line.properties) if line.major_mode
238
239
  end
239
240
  # Opens tag that precedes text immediately
240
- push_mode(line.paragraph_type, line.indent) unless line.end_block?
241
+ push_mode(line.paragraph_type, line.indent,
242
+ line.properties) unless line.end_block?
241
243
  end
242
244
  end
243
245
  end
@@ -129,7 +129,7 @@ module Orgmode
129
129
 
130
130
  # Check include file availability and permissions
131
131
  def check_include_file(file_path)
132
- can_be_included = File.exists? file_path
132
+ can_be_included = File.exist? file_path
133
133
 
134
134
  if not ENV['ORG_RUBY_INCLUDE_ROOT'].nil?
135
135
  # Ensure we have full paths
@@ -46,7 +46,7 @@ module Orgmode
46
46
  # Set up the emphasis regular expression.
47
47
  @pre_emphasis = ' \t\(\'"\{'
48
48
  @post_emphasis = '- \t\.,:!\?;\'"\)\}\\\\'
49
- @border_forbidden = '\s,"\''
49
+ @border_forbidden = ' \t\r\n'
50
50
  @body_regexp = '.*?'
51
51
  @max_newlines = 1
52
52
  @body_regexp = "#{@body_regexp}" +
@@ -58,7 +58,8 @@ module Orgmode
58
58
  build_org_emphasis_regexp
59
59
  build_org_link_regexp
60
60
  @org_subp_regexp = /([_^])\{(.*?)\}/
61
- @org_footnote_regexp = /\[fn:(.+?)(:(.*?))?\]/
61
+ @org_footnote_regexp = /\[fn:(.+?)(:(.*))?\]/
62
+ @org_footnote_def_regexp = /^\[fn:(.+?)(:(.*))?\]( (.+))?/
62
63
  end
63
64
 
64
65
  # Finds all emphasis matches in a string.
@@ -124,6 +125,12 @@ module Orgmode
124
125
  end
125
126
  end
126
127
 
128
+ def rewrite_footnote_definition str
129
+ str.gsub! @org_footnote_def_regexp do |match|
130
+ yield $1, $5
131
+ end
132
+ end
133
+
127
134
  # = Summary
128
135
  #
129
136
  # Rewrite org-mode links in a string to markup suitable to the
@@ -185,7 +192,7 @@ module Orgmode
185
192
  ([^\]\[]+) # This is the friendly text
186
193
  \])?\]/x
187
194
  @org_angle_link_text_regexp = /<(\w+:[^\]\s<>]+)>/
188
- @org_image_file_regexp = /\.(gif|jpe?g|p(?:bm|gm|n[gm]|pm)|svg|tiff?|x[bp]m)/i
195
+ @org_image_file_regexp = /\.(gif|jpe?g|p(?:bm|gm|n[gm]|pm)|svgz?|tiff?|x[bp]m)/i
189
196
  end
190
197
  end # class Emphasis
191
198
  end # module Orgmode
@@ -11,8 +11,8 @@ module Orgmode
11
11
  @footnotes = []
12
12
  end
13
13
 
14
- def push_mode(mode, indent)
15
- super(mode, indent)
14
+ def push_mode(mode, indent, properties={})
15
+ super(mode, indent, properties)
16
16
  @output << "bc. " if mode_is_code? mode
17
17
  if mode == :center or mode == :quote
18
18
  @add_paragraph = false
@@ -1,3 +1,3 @@
1
1
  module OrgRuby
2
- VERSION = '0.9.12'
2
+ VERSION = '0.10.1'
3
3
  end
data/lib/org-ruby.rb CHANGED
@@ -1,5 +1,3 @@
1
- $:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
2
-
3
1
  # internal requires
4
2
  require 'org-ruby/version'
5
3
  require 'org-ruby/parser'
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: org-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.12
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Dewey
8
8
  - Waldemar Quevedo
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-12-22 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rubypants
@@ -17,14 +16,28 @@ dependencies:
17
16
  requirements:
18
17
  - - "~>"
19
18
  - !ruby/object:Gem::Version
20
- version: '0.2'
19
+ version: '0.7'
21
20
  type: :runtime
22
21
  prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
23
  requirements:
25
24
  - - "~>"
26
25
  - !ruby/object:Gem::Version
27
- version: '0.2'
26
+ version: '0.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: logger
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
28
41
  description: An Org mode parser written in Ruby.
29
42
  email: waldemar.quevedo@gmail.com
30
43
  executables:
@@ -54,8 +67,8 @@ files:
54
67
  homepage: https://github.com/wallyqs/org-ruby
55
68
  licenses:
56
69
  - MIT
57
- metadata: {}
58
- post_install_message:
70
+ metadata:
71
+ source_code_uri: https://github.com/wallyqs/org-ruby
59
72
  rdoc_options: []
60
73
  require_paths:
61
74
  - lib
@@ -63,16 +76,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
63
76
  requirements:
64
77
  - - ">="
65
78
  - !ruby/object:Gem::Version
66
- version: '0'
79
+ version: '3.1'
67
80
  required_rubygems_version: !ruby/object:Gem::Requirement
68
81
  requirements:
69
82
  - - ">="
70
83
  - !ruby/object:Gem::Version
71
84
  version: '0'
72
85
  requirements: []
73
- rubyforge_project: org-ruby
74
- rubygems_version: 2.2.2
75
- signing_key:
76
- specification_version: 3
86
+ rubygems_version: 4.0.17
87
+ specification_version: 4
77
88
  summary: This gem contains Ruby routines for parsing org-mode files.
78
89
  test_files: []