asciidoctor 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of asciidoctor might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +107 -1
- data/LICENSE.adoc +1 -1
- data/README.adoc +155 -230
- data/Rakefile +2 -1
- data/bin/asciidoctor +5 -1
- data/data/stylesheets/asciidoctor-default.css +37 -29
- data/data/stylesheets/coderay-asciidoctor.css +3 -3
- data/features/text_formatting.feature +2 -0
- data/lib/asciidoctor.rb +46 -21
- data/lib/asciidoctor/abstract_block.rb +14 -8
- data/lib/asciidoctor/abstract_node.rb +77 -24
- data/lib/asciidoctor/attribute_list.rb +1 -1
- data/lib/asciidoctor/block.rb +2 -3
- data/lib/asciidoctor/cli/options.rb +14 -15
- data/lib/asciidoctor/converter/docbook45.rb +8 -8
- data/lib/asciidoctor/converter/docbook5.rb +25 -17
- data/lib/asciidoctor/converter/factory.rb +6 -1
- data/lib/asciidoctor/converter/html5.rb +159 -117
- data/lib/asciidoctor/converter/manpage.rb +671 -0
- data/lib/asciidoctor/converter/template.rb +24 -17
- data/lib/asciidoctor/document.rb +89 -47
- data/lib/asciidoctor/extensions.rb +22 -21
- data/lib/asciidoctor/helpers.rb +73 -16
- data/lib/asciidoctor/list.rb +26 -5
- data/lib/asciidoctor/parser.rb +179 -122
- data/lib/asciidoctor/path_resolver.rb +6 -10
- data/lib/asciidoctor/reader.rb +37 -34
- data/lib/asciidoctor/stylesheets.rb +16 -10
- data/lib/asciidoctor/substitutors.rb +98 -21
- data/lib/asciidoctor/table.rb +21 -17
- data/lib/asciidoctor/timings.rb +3 -3
- data/lib/asciidoctor/version.rb +1 -1
- data/man/asciidoctor.1 +155 -89
- data/man/asciidoctor.adoc +19 -11
- data/test/attributes_test.rb +86 -0
- data/test/blocks_test.rb +203 -15
- data/test/converter_test.rb +15 -2
- data/test/document_test.rb +290 -36
- data/test/extensions_test.rb +22 -3
- data/test/fixtures/circle.svg +8 -0
- data/test/fixtures/subs-docinfo.html +2 -0
- data/test/fixtures/subs.adoc +7 -0
- data/test/invoker_test.rb +25 -0
- data/test/links_test.rb +17 -0
- data/test/lists_test.rb +173 -0
- data/test/options_test.rb +2 -2
- data/test/paragraphs_test.rb +2 -2
- data/test/parser_test.rb +56 -13
- data/test/reader_test.rb +35 -3
- data/test/sections_test.rb +59 -0
- data/test/substitutions_test.rb +53 -14
- data/test/tables_test.rb +158 -2
- data/test/test_helper.rb +7 -2
- metadata +22 -11
- data/benchmark/benchmark.rb +0 -129
- data/benchmark/sample-data/mdbasics.adoc +0 -334
- data/lib/asciidoctor/opal_ext.rb +0 -26
- data/lib/asciidoctor/opal_ext/comparable.rb +0 -38
- data/lib/asciidoctor/opal_ext/dir.rb +0 -13
- data/lib/asciidoctor/opal_ext/error.rb +0 -2
- data/lib/asciidoctor/opal_ext/file.rb +0 -145
data/lib/asciidoctor/opal_ext.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
%x(
|
2
|
-
var value;
|
3
|
-
if (typeof module !== 'undefined' && module.exports) {
|
4
|
-
value = 'node';
|
5
|
-
}
|
6
|
-
else if (typeof XMLHttpRequest !== 'undefined') {
|
7
|
-
// or we can check for document
|
8
|
-
//else if (typeof document !== 'undefined' && document.nodeType) {
|
9
|
-
value = 'browser';
|
10
|
-
}
|
11
|
-
else if (typeof Java !== 'undefined' && Java.type) {
|
12
|
-
value = 'java-nashorn';
|
13
|
-
}
|
14
|
-
else if (typeof java !== 'undefined') {
|
15
|
-
value = 'java-rhino';
|
16
|
-
}
|
17
|
-
else {
|
18
|
-
// standalone is likely SpiderMonkey
|
19
|
-
value = 'standalone';
|
20
|
-
}
|
21
|
-
)
|
22
|
-
JAVASCRIPT_PLATFORM = %x(value)
|
23
|
-
require 'asciidoctor/opal_ext/comparable'
|
24
|
-
require 'asciidoctor/opal_ext/dir'
|
25
|
-
require 'asciidoctor/opal_ext/error'
|
26
|
-
require 'asciidoctor/opal_ext/file'
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# workaround for an infinite loop in Opal 0.6.2 when comparing numbers
|
2
|
-
module Comparable
|
3
|
-
def == other
|
4
|
-
return true if equal? other
|
5
|
-
return false unless cmp = (self <=> other)
|
6
|
-
return `cmp == 0`
|
7
|
-
rescue StandardError
|
8
|
-
false
|
9
|
-
end
|
10
|
-
|
11
|
-
def > other
|
12
|
-
unless cmp = (self <=> other)
|
13
|
-
raise ArgumentError, "comparison of #{self.class} with #{other.class} failed"
|
14
|
-
end
|
15
|
-
`cmp > 0`
|
16
|
-
end
|
17
|
-
|
18
|
-
def >= other
|
19
|
-
unless cmp = (self <=> other)
|
20
|
-
raise ArgumentError, "comparison of #{self.class} with #{other.class} failed"
|
21
|
-
end
|
22
|
-
`cmp >= 0`
|
23
|
-
end
|
24
|
-
|
25
|
-
def < other
|
26
|
-
unless cmp = (self <=> other)
|
27
|
-
raise ArgumentError, "comparison of #{self.class} with #{other.class} failed"
|
28
|
-
end
|
29
|
-
`cmp < 0`
|
30
|
-
end
|
31
|
-
|
32
|
-
def <= other
|
33
|
-
unless cmp = (self <=> other)
|
34
|
-
raise ArgumentError, "comparison of #{self.class} with #{other.class} failed"
|
35
|
-
end
|
36
|
-
`cmp <= 0`
|
37
|
-
end
|
38
|
-
end
|
@@ -1,145 +0,0 @@
|
|
1
|
-
class Kernel
|
2
|
-
# basic implementation of open, enough to work
|
3
|
-
# with reading files over XmlHttpRequest
|
4
|
-
def open(path, *rest)
|
5
|
-
file = File.new(path, *rest)
|
6
|
-
if block_given?
|
7
|
-
yield file
|
8
|
-
else
|
9
|
-
file
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class File
|
15
|
-
SEPARATOR = '/'
|
16
|
-
ALT_SEPARATOR = nil
|
17
|
-
|
18
|
-
attr_reader :eof
|
19
|
-
attr_reader :lineno
|
20
|
-
attr_reader :path
|
21
|
-
|
22
|
-
def initialize(path, mode = 'r')
|
23
|
-
@path = path
|
24
|
-
@contents = nil
|
25
|
-
@eof = false
|
26
|
-
@lineno = 0
|
27
|
-
end
|
28
|
-
|
29
|
-
def read
|
30
|
-
if @eof
|
31
|
-
''
|
32
|
-
else
|
33
|
-
res = File.read(@path)
|
34
|
-
@eof = true
|
35
|
-
@lineno = res.size
|
36
|
-
res
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def each_line(separator = $/, &block)
|
41
|
-
if @eof
|
42
|
-
return block_given? ? self : [].to_enum
|
43
|
-
end
|
44
|
-
|
45
|
-
if block_given?
|
46
|
-
lines = File.read(@path)
|
47
|
-
%x(
|
48
|
-
self.eof = false;
|
49
|
-
self.lineno = 0;
|
50
|
-
var chomped = #{lines.chomp},
|
51
|
-
trailing = lines.length != chomped.length,
|
52
|
-
splitted = chomped.split(separator);
|
53
|
-
|
54
|
-
for (var i = 0, length = splitted.length; i < length; i++) {
|
55
|
-
self.lineno += 1;
|
56
|
-
if (i < length - 1 || trailing) {
|
57
|
-
#{yield `splitted[i] + separator`};
|
58
|
-
}
|
59
|
-
else {
|
60
|
-
#{yield `splitted[i]`};
|
61
|
-
}
|
62
|
-
}
|
63
|
-
self.eof = true;
|
64
|
-
)
|
65
|
-
self
|
66
|
-
else
|
67
|
-
read.each_line
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def self.expand_path(path)
|
72
|
-
path
|
73
|
-
end
|
74
|
-
|
75
|
-
def self.join(*paths)
|
76
|
-
paths * SEPARATOR
|
77
|
-
end
|
78
|
-
|
79
|
-
def self.basename(path)
|
80
|
-
(offset = path.rindex SEPARATOR) ? path[(offset + 1)..-1] : path
|
81
|
-
end
|
82
|
-
|
83
|
-
def self.dirname(path)
|
84
|
-
(offset = path.rindex SEPARATOR) ? path[0..(offset - 1)] : '.'
|
85
|
-
end
|
86
|
-
|
87
|
-
def self.extname(path)
|
88
|
-
return '' if path.nil_or_empty?
|
89
|
-
last_dot_idx = path[1..-1].rindex('.')
|
90
|
-
last_dot_idx.nil? ? '' : path[(last_dot_idx + 1)..-1]
|
91
|
-
end
|
92
|
-
|
93
|
-
# TODO use XMLHttpRequest HEAD request unless in local file mode
|
94
|
-
def self.file?(path)
|
95
|
-
true
|
96
|
-
end
|
97
|
-
|
98
|
-
def self.read(path)
|
99
|
-
case JAVASCRIPT_PLATFORM
|
100
|
-
when 'node'
|
101
|
-
%x(return require('fs').readFileSync(path, 'utf8');)
|
102
|
-
when 'java-nashorn'
|
103
|
-
%x(
|
104
|
-
var Paths = Java.type('java.nio.file.Paths');
|
105
|
-
var Files = Java.type('java.nio.file.Files');
|
106
|
-
var lines = Files.readAllLines(Paths.get(path), Java.type('java.nio.charset.StandardCharsets').UTF_8);
|
107
|
-
var data = [];
|
108
|
-
lines.forEach(function(line) { data.push(line); });
|
109
|
-
return data.join("\n");
|
110
|
-
)
|
111
|
-
#when 'java-rhino'
|
112
|
-
when 'browser'
|
113
|
-
%x(
|
114
|
-
var data = '';
|
115
|
-
var status = -1;
|
116
|
-
try {
|
117
|
-
var xhr = new XMLHttpRequest();
|
118
|
-
xhr.open('GET', path, false);
|
119
|
-
xhr.addEventListener('load', function() {
|
120
|
-
status = this.status;
|
121
|
-
// status is 0 for local file mode (i.e., file://)
|
122
|
-
if (status == 0 || status == 200) {
|
123
|
-
data = this.responseText;
|
124
|
-
}
|
125
|
-
});
|
126
|
-
xhr.overrideMimeType('text/plain');
|
127
|
-
xhr.send();
|
128
|
-
}
|
129
|
-
catch (e) {
|
130
|
-
status = 0;
|
131
|
-
}
|
132
|
-
// assume that no data in local file mode means it doesn't exist
|
133
|
-
if (status == 404 || (status == 0 && data == '')) {
|
134
|
-
throw #{IOError.new `'No such file or directory: ' + path`};
|
135
|
-
}
|
136
|
-
return data;
|
137
|
-
)
|
138
|
-
# NOTE we're assuming standalone is SpiderMonkey
|
139
|
-
when 'standalone'
|
140
|
-
%x(return read(path);)
|
141
|
-
else
|
142
|
-
''
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|