asciidoctor 1.5.0 → 1.5.1
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/README.adoc +3 -3
- data/data/stylesheets/asciidoctor-default.css +1 -1
- data/lib/asciidoctor.rb +1 -1
- data/lib/asciidoctor/abstract_node.rb +6 -8
- data/lib/asciidoctor/cli/options.rb +3 -3
- data/lib/asciidoctor/converter/docbook45.rb +4 -0
- data/lib/asciidoctor/converter/docbook5.rb +19 -3
- data/lib/asciidoctor/converter/html5.rb +1 -0
- data/lib/asciidoctor/opal_ext/file.rb +27 -20
- data/lib/asciidoctor/reader.rb +10 -8
- data/lib/asciidoctor/substitutors.rb +12 -5
- data/lib/asciidoctor/version.rb +1 -1
- data/man/asciidoctor.1 +2 -2
- data/man/asciidoctor.adoc +2 -2
- data/test/blocks_test.rb +20 -0
- data/test/document_test.rb +13 -1
- data/test/fixtures/include-file.xml +5 -0
- data/test/options_test.rb +5 -0
- data/test/reader_test.rb +13 -0
- data/test/substitutions_test.rb +14 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a473039ade836811c48e7fee1ac92e81aaf93a17
|
4
|
+
data.tar.gz: 7139cce18ff72d70e11424a7a4ab846173d93789
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d096aea49af4c010647980e99d8219d25ad3b904bb746e62b3debe42891912f1b4b50426627b777487b058cd45208a6fc61e18c4ba75200a3cc3d1a53b670d9
|
7
|
+
data.tar.gz: 329764ebeb51caaff10af1021fa4316c0590e6dbf45273011d6065846be1430daaea28b93518aea21ede0fd860706150f03b796389488f80b315d394ae4a8d7a
|
data/README.adoc
CHANGED
@@ -55,7 +55,7 @@ Asciidoctor is open source, {uri-repo}[hosted on GitHub] and released under the
|
|
55
55
|
====
|
56
56
|
You can run Asciidoctor on the JVM using JRuby.
|
57
57
|
To invoke the Asciidoctor API directly from Java and other JVM languages, use {uri-asciidoctorj}[AsciidoctorJ].
|
58
|
-
There are plugins available, based on AsciidoctorJ, that integrate the Asciidoctor processor into Apache Maven,
|
58
|
+
There are plugins available, based on AsciidoctorJ, that integrate the Asciidoctor processor into Apache Maven, Gradle or Javadoc builds.
|
59
59
|
|
60
60
|
Asciidoctor also runs in JavaScript.
|
61
61
|
We use http://opalrb.org[Opal] to transcompile the Ruby source to JavaScript to produce {uri-asciidoctorjs}[Asciidoctor.js], a fully-functional version of Asciidoctor that works in any JavaScript environment, such as a web browser or Node.js.
|
@@ -63,7 +63,7 @@ Asciidoctor.js is used to power the AsciiDoc preview extensions for Chrome, Atom
|
|
63
63
|
====
|
64
64
|
|
65
65
|
ifdef::env-github[]
|
66
|
-
*Project health:* image:https://travis-ci.org/asciidoctor/asciidoctor.
|
66
|
+
*Project health:* image:http://img.shields.io/travis/asciidoctor/asciidoctor/master.svg[Build Status, link="https://travis-ci.org/asciidoctor/asciidoctor"] image:http://img.shields.io/coveralls/asciidoctor/asciidoctor/master.svg["Coverage Status", link="https://coveralls.io/r/asciidoctor/asciidoctor"]
|
67
67
|
endif::env-github[]
|
68
68
|
|
69
69
|
== The Big Picture
|
@@ -382,7 +382,7 @@ Improvements::
|
|
382
382
|
* use glyphs for checkboxes when not using font icons (#878)
|
383
383
|
* prefer source-language attribute over language attribute for defining default source language (#888)
|
384
384
|
* pass document as first argument to process method on Preprocessor
|
385
|
-
* don't parse link attributes when linkattrs is set unless text contains equal sign
|
385
|
+
* don't parse link attributes when linkattrs is set unless text contains equal sign
|
386
386
|
* detect bare links, mark with bare class; don't repeat URL of bare link in print styles
|
387
387
|
* allow Treeprocessor#process method to replace tree (#1035)
|
388
388
|
* add AbstractNode#find_by method to locate nodes in tree (#862)
|
@@ -370,7 +370,7 @@ p{margin-bottom:1.25rem}
|
|
370
370
|
*{-webkit-box-shadow:none!important;box-shadow:none!important;text-shadow:none!important}
|
371
371
|
a{color:inherit!important;text-decoration:underline!important}
|
372
372
|
a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important}
|
373
|
-
a[href^="http:"]:not(.bare):after,a[href^="https:"]:not(.bare):after
|
373
|
+
a[href^="http:"]:not(.bare):after,a[href^="https:"]:not(.bare):after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em}
|
374
374
|
abbr[title]:after{content:" (" attr(title) ")"}
|
375
375
|
pre,blockquote,tr,img{page-break-inside:avoid}
|
376
376
|
thead{display:table-header-group}
|
data/lib/asciidoctor.rb
CHANGED
@@ -1182,7 +1182,7 @@ module Asciidoctor
|
|
1182
1182
|
[:mark, :unconstrained, /\\?(?:\[([^\]]+?)\])?##(#{CC_ALL}+?)##/m],
|
1183
1183
|
|
1184
1184
|
# #mark# (referred to in AsciiDoc Python as unquoted)
|
1185
|
-
[:mark, :constrained, /(^|[^#{CC_WORD}
|
1185
|
+
[:mark, :constrained, /(^|[^#{CC_WORD}&;:}])(?:\[([^\]]+?)\])?#(\S|\S#{CC_ALL}*?\S)#(?!#{CG_WORD})/m],
|
1186
1186
|
|
1187
1187
|
# ^superscript^
|
1188
1188
|
[:superscript, :unconstrained, /\\?(?:\[([^\]]+?)\])?\^(\S+?)\^/],
|
@@ -27,19 +27,17 @@ class AbstractNode
|
|
27
27
|
def initialize parent, context, opts = {}
|
28
28
|
# document is a special case, should refer to itself
|
29
29
|
if context == :document
|
30
|
-
@parent = nil
|
31
30
|
@document = parent
|
32
31
|
else
|
33
|
-
if
|
32
|
+
if parent
|
33
|
+
@parent = parent
|
34
34
|
@document = parent.document
|
35
|
-
else
|
36
|
-
@document = nil
|
37
35
|
end
|
38
36
|
end
|
39
37
|
@context = context
|
40
38
|
@node_name = context.to_s
|
41
39
|
# QUESTION are we correct in duplicating the attributes (seems to be just as fast)
|
42
|
-
@attributes = opts.key?
|
40
|
+
@attributes = (opts.key? :attributes) ? opts[:attributes].dup : {}
|
43
41
|
@passthroughs = {}
|
44
42
|
end
|
45
43
|
|
@@ -189,10 +187,10 @@ class AbstractNode
|
|
189
187
|
|
190
188
|
# Public: A convenience method that checks if the role attribute is specified
|
191
189
|
def role?(expect = nil)
|
192
|
-
if expect
|
193
|
-
@attributes.has_key?('role') || @document.attributes.has_key?('role')
|
194
|
-
else
|
190
|
+
if expect
|
195
191
|
expect == (@attributes['role'] || @document.attributes['role'])
|
192
|
+
else
|
193
|
+
@attributes.has_key?('role') || @document.attributes.has_key?('role')
|
196
194
|
end
|
197
195
|
end
|
198
196
|
|
@@ -58,10 +58,10 @@ Example: asciidoctor -b html5 source.asciidoc
|
|
58
58
|
'provided for compatibility with the asciidoc command') do
|
59
59
|
self[:safe] = SafeMode::SAFE
|
60
60
|
end
|
61
|
-
opts.on('-S', '--safe-mode SAFE_MODE',
|
62
|
-
|
61
|
+
opts.on('-S', '--safe-mode SAFE_MODE', (safe_mode_names = SafeMode.constants.map(&:to_s).map(&:downcase)),
|
62
|
+
%(set safe mode level explicitly: [#{safe_mode_names * ', '}] (default: unsafe)),
|
63
63
|
'disables potentially dangerous macros in source files, such as include::[]') do |safe_mode|
|
64
|
-
self[:safe] = SafeMode.const_get
|
64
|
+
self[:safe] = SafeMode.const_get safe_mode.upcase
|
65
65
|
end
|
66
66
|
opts.on('-s', '--no-header-footer', 'suppress output of header and footer (default: false)') do
|
67
67
|
self[:header_footer] = false
|
@@ -10,9 +10,21 @@ module Asciidoctor
|
|
10
10
|
if (doctype_line = doctype_declaration root_tag_name)
|
11
11
|
result << doctype_line
|
12
12
|
end
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
if node.attr? 'toc'
|
14
|
+
if node.attr? 'toclevels'
|
15
|
+
result << %(<?asciidoc-toc maxdepth="#{node.attr 'toclevels'}"?>)
|
16
|
+
else
|
17
|
+
result << '<?asciidoc-toc?>'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
if node.attr? 'sectnums'
|
21
|
+
if node.attr? 'sectnumlevels'
|
22
|
+
result << %(<?asciidoc-numbered maxdepth="#{node.attr 'sectnumlevels'}"?>)
|
23
|
+
else
|
24
|
+
result << '<?asciidoc-numbered?>'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
lang_attribute = (node.attr? 'nolang') ? nil : %( #{lang_attribute_name}="#{node.attr 'lang', 'en'}")
|
16
28
|
result << %(<#{root_tag_name}#{document_ns_attributes node}#{lang_attribute}>)
|
17
29
|
result << (document_info_element node, root_tag_name)
|
18
30
|
result << node.content if node.blocks?
|
@@ -663,6 +675,10 @@ module Asciidoctor
|
|
663
675
|
' xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"'
|
664
676
|
end
|
665
677
|
|
678
|
+
def lang_attribute_name
|
679
|
+
'xml:lang'
|
680
|
+
end
|
681
|
+
|
666
682
|
def document_title_tags title
|
667
683
|
if title.subtitle?
|
668
684
|
%(<title>#{title.main}</title>
|
@@ -946,6 +946,7 @@ Your browser does not support the video tag.
|
|
946
946
|
refid = (node.attr 'refid') || target
|
947
947
|
# NOTE we lookup text in converter because DocBook doesn't need this logic
|
948
948
|
text = node.text || (node.document.references[:ids][refid] || %([#{refid}]))
|
949
|
+
# FIXME shouldn't target be refid? logic seems confused here
|
949
950
|
%(<a href="#{target}">#{text}</a>)
|
950
951
|
when :ref
|
951
952
|
%(<a id="#{target}"></a>)
|
@@ -98,26 +98,33 @@ class File
|
|
98
98
|
def self.read(path)
|
99
99
|
%x{
|
100
100
|
var data = ''
|
101
|
-
|
102
|
-
|
103
|
-
var
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
101
|
+
if (typeof module !== 'undefined' && module.exports) {
|
102
|
+
// Running under Node.js
|
103
|
+
var fs = require("fs");
|
104
|
+
data = fs.readFileSync(path, "utf8");
|
105
|
+
} else {
|
106
|
+
// Running under the browser
|
107
|
+
var status = -1;
|
108
|
+
try {
|
109
|
+
var xhr = new XMLHttpRequest();
|
110
|
+
xhr.open('GET', path, false);
|
111
|
+
xhr.addEventListener('load', function() {
|
112
|
+
status = this.status;
|
113
|
+
// status is 0 for local file mode (i.e., file://)
|
114
|
+
if (status == 0 || status == 200) {
|
115
|
+
data = this.responseText;
|
116
|
+
}
|
117
|
+
});
|
118
|
+
xhr.overrideMimeType('text/plain');
|
119
|
+
xhr.send();
|
120
|
+
}
|
121
|
+
catch (e) {
|
122
|
+
status = 0;
|
123
|
+
}
|
124
|
+
// assume that no data in local file mode means it doesn't exist
|
125
|
+
if (status == 404 || (status == 0 && data == '')) {
|
126
|
+
throw #{IOError.new `'No such file or directory: ' + path`};
|
127
|
+
}
|
121
128
|
}
|
122
129
|
}
|
123
130
|
`data`
|
data/lib/asciidoctor/reader.rb
CHANGED
@@ -894,8 +894,8 @@ class PreprocessorReader < Reader
|
|
894
894
|
tags = attributes['tags'].split(DataDelimiterRx).uniq.to_set
|
895
895
|
end
|
896
896
|
end
|
897
|
-
if
|
898
|
-
|
897
|
+
if inc_lines
|
898
|
+
unless inc_lines.empty?
|
899
899
|
selected = []
|
900
900
|
inc_line_offset = 0
|
901
901
|
inc_lineno = 0
|
@@ -926,8 +926,8 @@ class PreprocessorReader < Reader
|
|
926
926
|
# FIXME not accounting for skipped lines in reader line numbering
|
927
927
|
push_include selected, include_file, path, inc_line_offset, attributes
|
928
928
|
end
|
929
|
-
elsif
|
930
|
-
|
929
|
+
elsif tags
|
930
|
+
unless tags.empty?
|
931
931
|
selected = []
|
932
932
|
inc_line_offset = 0
|
933
933
|
inc_lineno = 0
|
@@ -940,21 +940,23 @@ class PreprocessorReader < Reader
|
|
940
940
|
# must force encoding here since we're performing String operations on line
|
941
941
|
l.force_encoding(::Encoding::UTF_8) if FORCE_ENCODING
|
942
942
|
l = l.rstrip
|
943
|
+
# tagged lines in XML may end with '-->'
|
944
|
+
tl = l.chomp('-->').rstrip
|
943
945
|
if active_tag
|
944
|
-
if
|
946
|
+
if tl.end_with?(%(end::#{active_tag}[]))
|
945
947
|
active_tag = nil
|
946
948
|
else
|
947
|
-
selected.push l unless
|
949
|
+
selected.push l unless tl.end_with?('[]') && TagDirectiveRx =~ tl
|
948
950
|
inc_line_offset = inc_lineno if inc_line_offset == 0
|
949
951
|
end
|
950
952
|
else
|
951
953
|
tags.each do |tag|
|
952
|
-
if
|
954
|
+
if tl.end_with?(%(tag::#{tag}[]))
|
953
955
|
active_tag = tag
|
954
956
|
tags_found << tag
|
955
957
|
break
|
956
958
|
end
|
957
|
-
end
|
959
|
+
end if tl.end_with?('[]') && TagDirectiveRx =~ tl
|
958
960
|
end
|
959
961
|
end
|
960
962
|
end
|
@@ -956,7 +956,7 @@ module Substitutors
|
|
956
956
|
if m[1] == 'footnote'
|
957
957
|
id = nil
|
958
958
|
# REVIEW it's a dirty job, but somebody's gotta do it
|
959
|
-
text = restore_passthroughs(sub_inline_xrefs(sub_inline_anchors(normalize_string m[2], true)))
|
959
|
+
text = restore_passthroughs(sub_inline_xrefs(sub_inline_anchors(normalize_string m[2], true)), false)
|
960
960
|
index = @document.counter('footnote-number')
|
961
961
|
@document.register(:footnotes, Document::Footnote.new(index, id, text))
|
962
962
|
type = nil
|
@@ -978,7 +978,7 @@ module Substitutors
|
|
978
978
|
type = :xref
|
979
979
|
else
|
980
980
|
# REVIEW it's a dirty job, but somebody's gotta do it
|
981
|
-
text = restore_passthroughs(sub_inline_xrefs(sub_inline_anchors(normalize_string text, true)))
|
981
|
+
text = restore_passthroughs(sub_inline_xrefs(sub_inline_anchors(normalize_string text, true)), false)
|
982
982
|
index = @document.counter('footnote-number')
|
983
983
|
@document.register(:footnotes, Document::Footnote.new(index, id, text))
|
984
984
|
type = :ref
|
@@ -1446,6 +1446,7 @@ module Substitutors
|
|
1446
1446
|
# TODO we could add the line numbers in ourselves instead of having to strip out the junk
|
1447
1447
|
# FIXME move these regular expressions into constants
|
1448
1448
|
if (opts[:linenos] = @document.attributes['pygments-linenums-mode'] || 'table') == 'table'
|
1449
|
+
linenums_mode = :table
|
1449
1450
|
# NOTE these subs clean out HTML that messes up our styles
|
1450
1451
|
result = lexer.highlight(source, :options => opts).
|
1451
1452
|
sub(/<div class="pyhl">(.*)<\/div>/m, '\1').
|
@@ -1481,9 +1482,15 @@ module Substitutors
|
|
1481
1482
|
lineno = lineno + 1
|
1482
1483
|
if (conums = callout_marks.delete(lineno))
|
1483
1484
|
tail = nil
|
1484
|
-
if callout_on_last && callout_marks.empty?
|
1485
|
-
|
1486
|
-
|
1485
|
+
if callout_on_last && callout_marks.empty?
|
1486
|
+
# QUESTION when does this happen?
|
1487
|
+
if (pos = line.index '</pre>')
|
1488
|
+
tail = line[pos..-1]
|
1489
|
+
line = %(#{line[0...pos].chomp ' '} )
|
1490
|
+
else
|
1491
|
+
# Give conum on final line breathing room if trailing space in source is dropped
|
1492
|
+
line = %(#{line.chomp ' '} )
|
1493
|
+
end
|
1487
1494
|
end
|
1488
1495
|
if conums.size == 1
|
1489
1496
|
%(#{line}#{Inline.new(self, :callout, conums[0], :id => @document.callouts.read_next_id).convert }#{tail})
|
data/lib/asciidoctor/version.rb
CHANGED
data/man/asciidoctor.1
CHANGED
@@ -147,7 +147,7 @@ Failure (syntax or usage error; configuration error; document processing failure
|
|
147
147
|
.RE
|
148
148
|
.SH "BUGS"
|
149
149
|
.sp
|
150
|
-
See the \fBAsciidoctor\fR issue tracker: <\fBhttps://github\&.com/asciidoctor/asciidoctor/issues?
|
150
|
+
See the \fBAsciidoctor\fR issue tracker: <\fBhttps://github\&.com/asciidoctor/asciidoctor/issues?q=is%3Aopen\fR>
|
151
151
|
.SH "AUTHORS"
|
152
152
|
.sp
|
153
153
|
\fBAsciidoctor\fR was written by Dan Allen, Ryan Waldron, Jason Porter, Nick Hengeveld and other contributors\&.
|
@@ -161,7 +161,7 @@ Project web site: <\fBhttp://asciidoctor\&.org\fR>
|
|
161
161
|
.sp
|
162
162
|
GitHub organization: <\fBhttps://github\&.com/asciidoctor\fR>
|
163
163
|
.sp
|
164
|
-
|
164
|
+
Discussion list / forum: <\fBhttp://discuss\&.asciidoctor\&.org\fR>
|
165
165
|
.SH "COPYING"
|
166
166
|
.sp
|
167
167
|
Copyright (C) 2012\-2014 Dan Allen, Ryan Waldron and the Asciidoctor Project\&. Free use of this software is granted under the terms of the MIT License\&.
|
data/man/asciidoctor.adoc
CHANGED
@@ -158,7 +158,7 @@ subsequent directories override ones previously discovered.
|
|
158
158
|
|
159
159
|
== BUGS
|
160
160
|
|
161
|
-
See the *Asciidoctor* issue tracker: <**https://github.com/asciidoctor/asciidoctor/issues?
|
161
|
+
See the *Asciidoctor* issue tracker: <**https://github.com/asciidoctor/asciidoctor/issues?q=is%3Aopen**>
|
162
162
|
|
163
163
|
|
164
164
|
== AUTHORS
|
@@ -178,7 +178,7 @@ Project web site: <**http://asciidoctor.org**>
|
|
178
178
|
|
179
179
|
GitHub organization: <**https://github.com/asciidoctor**>
|
180
180
|
|
181
|
-
|
181
|
+
Discussion list / forum: <**http://discuss.asciidoctor.org**>
|
182
182
|
|
183
183
|
|
184
184
|
== COPYING
|
data/test/blocks_test.rb
CHANGED
@@ -1651,6 +1651,26 @@ image::#{image_uri}[Dot]
|
|
1651
1651
|
assert_xpath %(/*[@class="imageblock"]//img[@src="#{image_uri}"][@alt="Dot"]), output, 1
|
1652
1652
|
end
|
1653
1653
|
|
1654
|
+
test 'can handle embedded data uri images' do
|
1655
|
+
input = <<-EOS
|
1656
|
+
image::data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=[Dot]
|
1657
|
+
EOS
|
1658
|
+
|
1659
|
+
output = render_embedded_string input
|
1660
|
+
assert_xpath '//img[@src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="][@alt="Dot"]', output, 1
|
1661
|
+
end
|
1662
|
+
|
1663
|
+
test 'can handle embedded data uri images when data-uri attribute is set' do
|
1664
|
+
input = <<-EOS
|
1665
|
+
:data-uri:
|
1666
|
+
|
1667
|
+
image::data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=[Dot]
|
1668
|
+
EOS
|
1669
|
+
|
1670
|
+
output = render_embedded_string input
|
1671
|
+
assert_xpath '//img[@src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="][@alt="Dot"]', output, 1
|
1672
|
+
end
|
1673
|
+
|
1654
1674
|
# this test will cause a warning to be printed to the console (until we have a message facility)
|
1655
1675
|
test 'cleans reference to ancestor directories in imagesdir before reading image if safe mode level is at least SAFE' do
|
1656
1676
|
input = <<-EOS
|
data/test/document_test.rb
CHANGED
@@ -78,9 +78,21 @@ context 'Document' do
|
|
78
78
|
end
|
79
79
|
|
80
80
|
test 'toc and sectnums should be enabled by default for DocBook backend' do
|
81
|
-
doc =
|
81
|
+
doc = document_from_string 'content', :backend => 'docbook', :parse => true
|
82
82
|
assert doc.attr?('toc')
|
83
83
|
assert doc.attr?('sectnums')
|
84
|
+
result = doc.convert
|
85
|
+
assert_match('<?asciidoc-toc?>', result)
|
86
|
+
assert_match('<?asciidoc-numbered?>', result)
|
87
|
+
end
|
88
|
+
|
89
|
+
test 'maxdepth attribute should be set on asciidoc-toc and asciidoc-numbered processing instructions in DocBook backend' do
|
90
|
+
doc = document_from_string 'content', :backend => 'docbook', :parse => true, :attributes => {'toclevels' => '1', 'sectnumlevels' => '1' }
|
91
|
+
assert doc.attr?('toc')
|
92
|
+
assert doc.attr?('sectnums')
|
93
|
+
result = doc.convert
|
94
|
+
assert_match('<?asciidoc-toc maxdepth="1"?>', result)
|
95
|
+
assert_match('<?asciidoc-numbered maxdepth="1"?>', result)
|
84
96
|
end
|
85
97
|
|
86
98
|
test 'should be able to disable toc and sectnums in document header for DocBook backend' do
|
data/test/options_test.rb
CHANGED
@@ -76,6 +76,11 @@ context 'Options' do
|
|
76
76
|
assert_equal 'value=value', options[:attributes]['name']
|
77
77
|
end
|
78
78
|
|
79
|
+
test 'should allow safe mode to be specified' do
|
80
|
+
options = Asciidoctor::Cli::Options.parse!(%w(-S safe /dev/null))
|
81
|
+
assert_equal Asciidoctor::SafeMode::SAFE, options[:safe]
|
82
|
+
end
|
83
|
+
|
79
84
|
test 'should allow any backend to be specified' do
|
80
85
|
options = Asciidoctor::Cli::Options.parse!(%w(-b my_custom_backend test/fixtures/sample.asciidoc))
|
81
86
|
|
data/test/reader_test.rb
CHANGED
@@ -708,6 +708,19 @@ include::fixtures/include-file.asciidoc[tags=snippetA;snippetB]
|
|
708
708
|
refute_match(/included content/, output)
|
709
709
|
end
|
710
710
|
|
711
|
+
test 'include directive supports tagged selection in XML file' do
|
712
|
+
input = <<-EOS
|
713
|
+
[source,xml,indent=0]
|
714
|
+
----
|
715
|
+
include::fixtures/include-file.xml[tag=snippet]
|
716
|
+
----
|
717
|
+
EOS
|
718
|
+
|
719
|
+
output = render_string input, :safe => :safe, :header_footer => false, :base_dir => DIRNAME
|
720
|
+
assert_match('<snippet>content</snippet>', output)
|
721
|
+
refute_match('root', output)
|
722
|
+
end
|
723
|
+
|
711
724
|
test 'include directive does not select tagged lines inside tagged selection' do
|
712
725
|
input = <<-EOS
|
713
726
|
++++
|
data/test/substitutions_test.rb
CHANGED
@@ -135,6 +135,11 @@ context 'Substitutions' do
|
|
135
135
|
assert_equal "<mark>a few\nwords</mark>", para.sub_quotes(para.source)
|
136
136
|
end
|
137
137
|
|
138
|
+
test 'constrained marked string should not match entity references' do
|
139
|
+
para = block_from_string('111 #mark a# 222 "`quote a`" 333 #mark b# 444')
|
140
|
+
assert_equal %(111 <mark>mark a</mark> 222 “quote a” 333 <mark>mark b</mark> 444), para.sub_quotes(para.source)
|
141
|
+
end
|
142
|
+
|
138
143
|
test 'single-line unconstrained marked string' do
|
139
144
|
#para = block_from_string(%q{##--anything goes ##}, :attributes => {'compat-mode' => ''})
|
140
145
|
#assert_equal '--anything goes ', para.sub_quotes(para.source)
|
@@ -811,6 +816,15 @@ context 'Substitutions' do
|
|
811
816
|
assert_equal 'a <a id="b"></a> [[c]] d', footnote1.text
|
812
817
|
end
|
813
818
|
|
819
|
+
test 'subsequent footnote macros with escaped URLs should be restored in DocBook' do
|
820
|
+
input = <<-EOS
|
821
|
+
foofootnote:[+http://example.com+]barfootnote:[+http://acme.com+]baz
|
822
|
+
EOS
|
823
|
+
|
824
|
+
result = render_embedded_string input, :doctype => 'inline', :backend => 'docbook'
|
825
|
+
assert_equal 'foo<footnote><simpara>http://example.com</simpara></footnote>bar<footnote><simpara>http://acme.com</simpara></footnote>baz', result
|
826
|
+
end
|
827
|
+
|
814
828
|
test 'a footnote macro may contain a bibliographic anchor macro' do
|
815
829
|
para = block_from_string('text footnote:[a [[[b\]\]\] c]')
|
816
830
|
assert_equal %(text <span class="footnote">[<a id="_footnoteref_1" class="footnote" href="#_footnote_1" title="View footnote.">1</a>]</span>), para.sub_macros(para.source)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Allen
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2014-
|
16
|
+
date: 2014-09-19 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: coderay
|
@@ -297,6 +297,7 @@ files:
|
|
297
297
|
- test/fixtures/encoding.asciidoc
|
298
298
|
- test/fixtures/grandchild-include.adoc
|
299
299
|
- test/fixtures/include-file.asciidoc
|
300
|
+
- test/fixtures/include-file.xml
|
300
301
|
- test/fixtures/master.adoc
|
301
302
|
- test/fixtures/parent-include-restricted.adoc
|
302
303
|
- test/fixtures/parent-include.adoc
|