org-ruby 0.9.12 → 0.10.0
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 +5 -5
- data/History.org +21 -0
- data/README.org +1 -1
- data/lib/org-ruby/html_output_buffer.rb +32 -12
- data/lib/org-ruby/line.rb +19 -1
- data/lib/org-ruby/markdown_output_buffer.rb +2 -2
- data/lib/org-ruby/output_buffer.rb +6 -4
- data/lib/org-ruby/parser.rb +1 -1
- data/lib/org-ruby/regexp_helper.rb +10 -3
- data/lib/org-ruby/textile_output_buffer.rb +2 -2
- data/lib/org-ruby/version.rb +1 -1
- data/lib/org-ruby.rb +0 -2
- metadata +23 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 2366a61c4e31f967d754ec1e0abd147ab7e6fca2b969b98eb3c2ce86998a69ff
|
|
4
|
+
data.tar.gz: 0c49853d25187871b5f0b211ae3289f54af61e8b58f1f0f2478d73a0e9cf9834
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1db1ebf0d0f9906cd75ded86ffef5b275a9ebfb4574df653181d1dad1c279da21152511d94391cc34856170208371f0ce74f871c1a2211e8cae2ca8c10fc3061
|
|
7
|
+
data.tar.gz: 341dfbbb33467952fdfdebc0cd53f113d568dbb80d4eb8cadf63c459e965f851324298a8920813f302e047f691784eb20bb46d91340e395d97b928b9426abb7e
|
data/History.org
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
#+title: Changelog
|
|
3
3
|
#+startup: showeverything
|
|
4
4
|
|
|
5
|
+
* 0.10.0 / 2026-10-09
|
|
6
|
+
|
|
7
|
+
- Requires Ruby >= 3.1 (tested on Ruby 3.1 through 4.0)
|
|
8
|
+
- Upgrade =rubypants= dependency to =~> 0.7=
|
|
9
|
+
- Add =logger= as a runtime dependency (no longer a default gem as of Ruby 4.0)
|
|
10
|
+
- Replace =File.exists?= (removed in Ruby 3.2) with =File.exist?=
|
|
11
|
+
- Support =file+emacs= and =file+sys= links
|
|
12
|
+
- Handle continued numbered lists
|
|
13
|
+
- Recognize =js2= source blocks as JavaScript and =ipython= source blocks as Python
|
|
14
|
+
- Support relative links to svg/svgz files as inline images
|
|
15
|
+
- Change emphasis border regexp to match org.el
|
|
16
|
+
- Improve footnote HTML export: better anchoring between references and
|
|
17
|
+
definitions, no HTML escaping of footnote content, fix missing closing
|
|
18
|
+
paragraph tag
|
|
19
|
+
- Require =pathname= explicitly and default properties hash to empty
|
|
20
|
+
- Replace Travis CI with GitHub Actions
|
|
21
|
+
|
|
22
|
+
* 0.9.12 / 2014-12-22
|
|
23
|
+
|
|
24
|
+
- Remove duplicated hash keys
|
|
25
|
+
|
|
5
26
|
* 0.9.10 / 2014-12-09
|
|
6
27
|
|
|
7
28
|
- Add option to disable Rubypants
|
data/README.org
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
* OrgRuby
|
|
4
4
|
|
|
5
|
-
[[https://
|
|
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
|
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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 << "<
|
|
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!(/&/, "&")
|
|
@@ -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
|
|
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*$/
|
|
@@ -46,7 +46,8 @@ module Orgmode
|
|
|
46
46
|
@mode_stack.last
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
|
|
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.
|
|
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
|
|
241
|
+
push_mode(line.paragraph_type, line.indent,
|
|
242
|
+
line.properties) unless line.end_block?
|
|
241
243
|
end
|
|
242
244
|
end
|
|
243
245
|
end
|
data/lib/org-ruby/parser.rb
CHANGED
|
@@ -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.
|
|
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 = '\
|
|
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)|
|
|
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
|
data/lib/org-ruby/version.rb
CHANGED
data/lib/org-ruby.rb
CHANGED
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.
|
|
4
|
+
version: 0.10.0
|
|
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:
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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: '
|
|
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
|
-
|
|
74
|
-
|
|
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: []
|