asciidoctor 2.0.6 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9066105e2eb3a4a1eef1b7e03730a3daa81e6b0abcfebef789e5c02e4a070db8
4
- data.tar.gz: 902d0e58872adbafcd81a6faa7373b4e207ad5596ec37f3d1a01a6e83fabfac2
3
+ metadata.gz: 363386e5f0af985125302b3f74565b9d55758b7ed2c6861fbd26e1554ce68cf6
4
+ data.tar.gz: 50204a323636922a05b26c460ed659bdef48bc7de2a2342ac1f1c40997897d80
5
5
  SHA512:
6
- metadata.gz: a77b68c94c63ba1f783cc1e2af7ead46415a8f49f85195f7367f94506b12d1ad19310b142249d534cc61513633ba4ba8e931e744922f4a3bfe92e9b0e9e4d97d
7
- data.tar.gz: d0a13bb0dfe883cb0a8e6ae949e3f6178de75f57d6d6a35f90ee5954f8b85faa6c76b0c3244a07aca43478daab789a33b3f780faa1e083b27bba5a1eb9f5cf74
6
+ metadata.gz: d8136e7b02f0cc18e4b2e3e2f906a460e895fa1f3524b5302861354f9cfba49554592ef53bbff71a92f9f08068a685462f4c5f631016065f427e8947a267548c
7
+ data.tar.gz: 778f9c5f7817a54fc4eeb863da1ee5e829e162f998ca2da2f34fd44a146973ee230201069bf65dedcfda4fd00ee4d75b429094fa612b994bfdb4b475f94940c7
@@ -13,6 +13,18 @@ endif::[]
13
13
  This document provides a high-level view of the changes introduced in Asciidoctor by release.
14
14
  For a detailed view of what has changed, refer to the {uri-repo}/commits/master[commit history] on GitHub.
15
15
 
16
+ == 2.0.7 (2019-04-13) - @mojavelinux
17
+
18
+ Bug Fixes::
19
+
20
+ * fix crash when resolving ID from text and at least one candidate contains an unresolved xref (#3254)
21
+ * fix compatibility with Rouge 2.0
22
+
23
+ Improvements::
24
+
25
+ * improve documentation for the `-a` CLI option; explain that `@` modifier can be placed at end of name as alternative to end of value
26
+ * move source for main API entry points (load, load_file, convert, convert_file) to separate files
27
+
16
28
  == 2.0.6 (2019-04-04) - @mojavelinux
17
29
 
18
30
  Bug Fixes::
@@ -1,6 +1,6 @@
1
1
  = Asciidoctor
2
2
  Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>; Ryan Waldron <https://github.com/erebor[@erebor]>
3
- v2.0.6, 2019-04-04
3
+ v2.0.7, 2019-04-13
4
4
  // settings:
5
5
  :idprefix:
6
6
  :idseparator: -
@@ -17,7 +17,7 @@ ifdef::env-github[]
17
17
  :warning-caption: :warning:
18
18
  endif::[]
19
19
  // Variables:
20
- :release-version: 2.0.6
20
+ :release-version: 2.0.7
21
21
  // URIs:
22
22
  :uri-org: https://github.com/asciidoctor
23
23
  :uri-repo: {uri-org}/asciidoctor
@@ -1,6 +1,6 @@
1
1
  = Asciidoctor
2
2
  Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>; Ryan Waldron <https://github.com/erebor[@erebor]>
3
- v2.0.6, 2019-04-04
3
+ v2.0.7, 2019-04-13
4
4
  // settings:
5
5
  :idprefix:
6
6
  :idseparator: -
@@ -17,7 +17,7 @@ ifdef::env-github[]
17
17
  :warning-caption: :warning:
18
18
  endif::[]
19
19
  // Variables:
20
- :release-version: 2.0.6
20
+ :release-version: 2.0.7
21
21
  // URIs:
22
22
  :uri-org: https://github.com/asciidoctor
23
23
  :uri-repo: {uri-org}/asciidoctor
@@ -1,6 +1,6 @@
1
1
  = Asciidoctor
2
2
  Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>; Ryan Waldron <https://github.com/erebor[@erebor]>
3
- v2.0.6, 2019-04-04
3
+ v2.0.7, 2019-04-13
4
4
  // settings:
5
5
  :page-layout: base
6
6
  :idprefix:
@@ -18,7 +18,7 @@ ifdef::env-github[]
18
18
  :warning-caption: :warning:
19
19
  endif::[]
20
20
  // Variables:
21
- :release-version: 2.0.6
21
+ :release-version: 2.0.7
22
22
  // URIs:
23
23
  :uri-org: https://github.com/asciidoctor
24
24
  :uri-repo: {uri-org}/asciidoctor
@@ -1,6 +1,6 @@
1
1
  = Asciidoctor
2
2
  Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>; Ryan Waldron <https://github.com/erebor[@erebor]>
3
- v2.0.6, 2019-04-04
3
+ v2.0.7, 2019-04-13
4
4
  // settings:
5
5
  :page-layout: base
6
6
  :idprefix:
@@ -18,7 +18,7 @@ ifdef::env-github[]
18
18
  :warning-caption: :warning:
19
19
  endif::[]
20
20
  // Variables:
21
- :release-version: 2.0.6
21
+ :release-version: 2.0.7
22
22
  // URIs:
23
23
  :uri-org: https://github.com/asciidoctor
24
24
  :uri-repo: {uri-org}/asciidoctor
@@ -1,6 +1,6 @@
1
1
  = Asciidoctor
2
2
  Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>; Ryan Waldron <https://github.com/erebor[@erebor]>
3
- v2.0.6, 2019-04-04
3
+ v2.0.7, 2019-04-13
4
4
  // settings:
5
5
  :idprefix:
6
6
  :idseparator: -
@@ -17,7 +17,7 @@ ifdef::env-github[]
17
17
  :warning-caption: :warning:
18
18
  endif::[]
19
19
  // Variables:
20
- :release-version: 2.0.6
20
+ :release-version: 2.0.7
21
21
  // URIs:
22
22
  :uri-org: https://github.com/asciidoctor
23
23
  :uri-repo: {uri-org}/asciidoctor
@@ -23,15 +23,15 @@ Gem::Specification.new do |s|
23
23
  }
24
24
 
25
25
  # NOTE the logic to build the list of files is designed to produce a usable package even when the git command is not available
26
- files = begin
27
- (result = `git ls-files -z`.split ?\0).empty? ? Dir['**/*'] : result
26
+ begin
27
+ files = (result = `git ls-files -z`.split ?\0).empty? ? Dir['**/*'] : result
28
28
  rescue
29
- Dir['**/*']
29
+ files = Dir['**/*']
30
30
  end
31
31
  s.files = files.grep %r/^(?:(?:data|lib|man)\/.+|LICENSE|(?:CHANGELOG|README(?:-\w+)?)\.adoc|\.yardopts|#{s.name}\.gemspec)$/
32
32
  s.executables = (files.grep %r/^bin\//).map {|f| File.basename f }
33
33
  s.require_paths = ['lib']
34
- #s.test_files = files.grep %r/^(?:(?:features|test)\/.+)$/
34
+ #s.test_files = files.grep %r/^(?:features|test)\/.+$/
35
35
 
36
36
  # asciimath is needed for testing AsciiMath in DocBook backend
37
37
  s.add_development_dependency 'asciimath', '~> 1.0.0'
@@ -1220,310 +1220,6 @@ module Asciidoctor
1220
1220
  [/\\?(&)amp;((?:[a-zA-Z][a-zA-Z]+\d{0,2}|#\d\d\d{0,4}|#x[\da-fA-F][\da-fA-F][\da-fA-F]{0,3});)/, '', :bounding]
1221
1221
  ]
1222
1222
 
1223
- class << self
1224
-
1225
- # Public: Parse the AsciiDoc source input into a {Document}
1226
- #
1227
- # Accepts input as an IO (or StringIO), String or String Array object. If the
1228
- # input is a File, the object is expected to be opened for reading and is not
1229
- # closed afterwards by this method. Information about the file (filename,
1230
- # directory name, etc) gets assigned to attributes on the Document object.
1231
- #
1232
- # input - the AsciiDoc source as a IO, String or Array.
1233
- # options - a String, Array or Hash of options to control processing (default: {})
1234
- # String and Array values are converted into a Hash.
1235
- # See {Document#initialize} for details about these options.
1236
- #
1237
- # Returns the Document
1238
- def load input, options = {}
1239
- options = options.merge
1240
-
1241
- if (timings = options[:timings])
1242
- timings.start :read
1243
- end
1244
-
1245
- if (logger = options[:logger]) && logger != LoggerManager.logger
1246
- LoggerManager.logger = logger
1247
- end
1248
-
1249
- if !(attrs = options[:attributes])
1250
- attrs = {}
1251
- elsif ::Hash === attrs
1252
- attrs = attrs.merge
1253
- elsif (defined? ::Java::JavaUtil::Map) && ::Java::JavaUtil::Map === attrs
1254
- attrs = attrs.dup
1255
- elsif ::Array === attrs
1256
- attrs = {}.tap do |accum|
1257
- attrs.each do |entry|
1258
- k, _, v = entry.partition '='
1259
- accum[k] = v
1260
- end
1261
- end
1262
- elsif ::String === attrs
1263
- # condense and convert non-escaped spaces to null, unescape escaped spaces, then split on null
1264
- attrs = {}.tap do |accum|
1265
- attrs.gsub(SpaceDelimiterRx, '\1' + NULL).gsub(EscapedSpaceRx, '\1').split(NULL).each do |entry|
1266
- k, _, v = entry.partition '='
1267
- accum[k] = v
1268
- end
1269
- end
1270
- elsif (attrs.respond_to? :keys) && (attrs.respond_to? :[])
1271
- # coerce attrs to a real Hash
1272
- attrs = {}.tap {|accum| attrs.keys.each {|k| accum[k] = attrs[k] } }
1273
- else
1274
- raise ::ArgumentError, %(illegal type for attributes option: #{attrs.class.ancestors.join ' < '})
1275
- end
1276
-
1277
- if ::File === input
1278
- options[:input_mtime] = input.mtime
1279
- # NOTE defer setting infile and indir until we get a better sense of their purpose
1280
- # TODO cli checks if input path can be read and is file, but might want to add check to API too
1281
- attrs['docfile'] = input_path = ::File.absolute_path input.path
1282
- attrs['docdir'] = ::File.dirname input_path
1283
- attrs['docname'] = Helpers.basename input_path, (attrs['docfilesuffix'] = Helpers.extname input_path)
1284
- source = input.read
1285
- elsif input.respond_to? :read
1286
- # NOTE tty, pipes & sockets can't be rewound, but can't be sniffed easily either
1287
- # just fail the rewind operation silently to handle all cases
1288
- input.rewind rescue nil
1289
- source = input.read
1290
- elsif ::String === input
1291
- source = input
1292
- elsif ::Array === input
1293
- source = input.drop 0
1294
- elsif input
1295
- raise ::ArgumentError, %(unsupported input type: #{input.class})
1296
- end
1297
-
1298
- if timings
1299
- timings.record :read
1300
- timings.start :parse
1301
- end
1302
-
1303
- options[:attributes] = attrs
1304
- doc = options[:parse] == false ? (Document.new source, options) : (Document.new source, options).parse
1305
-
1306
- timings.record :parse if timings
1307
- doc
1308
- rescue => ex
1309
- begin
1310
- context = %(asciidoctor: FAILED: #{attrs['docfile'] || '<stdin>'}: Failed to load AsciiDoc document)
1311
- if ex.respond_to? :exception
1312
- # The original message must be explicitly preserved when wrapping a Ruby exception
1313
- wrapped_ex = ex.exception %(#{context} - #{ex.message})
1314
- # JRuby automatically sets backtrace; MRI did not until 2.6
1315
- wrapped_ex.set_backtrace ex.backtrace
1316
- else
1317
- # Likely a Java exception class
1318
- wrapped_ex = ex.class.new context, ex
1319
- wrapped_ex.stack_trace = ex.stack_trace
1320
- end
1321
- rescue
1322
- wrapped_ex = ex
1323
- end
1324
- raise wrapped_ex
1325
- end
1326
-
1327
- # Public: Parse the contents of the AsciiDoc source file into an Asciidoctor::Document
1328
- #
1329
- # input - the String AsciiDoc source filename
1330
- # options - a String, Array or Hash of options to control processing (default: {})
1331
- # String and Array values are converted into a Hash.
1332
- # See Asciidoctor::Document#initialize for details about options.
1333
- #
1334
- # Returns the Asciidoctor::Document
1335
- def load_file filename, options = {}
1336
- ::File.open(filename, FILE_READ_MODE) {|file| self.load file, options }
1337
- end
1338
-
1339
- # Public: Parse the AsciiDoc source input into an Asciidoctor::Document and
1340
- # convert it to the specified backend format.
1341
- #
1342
- # Accepts input as an IO (or StringIO), String or String Array object. If the
1343
- # input is a File, the object is expected to be opened for reading and is not
1344
- # closed afterwards by this method. Information about the file (filename,
1345
- # directory name, etc) gets assigned to attributes on the Document object.
1346
- #
1347
- # If the :to_file option is true, and the input is a File, the output is
1348
- # written to a file adjacent to the input file, having an extension that
1349
- # corresponds to the backend format. Otherwise, if the :to_file option is
1350
- # specified, the file is written to that file. If :to_file is not an absolute
1351
- # path, it is resolved relative to :to_dir, if given, otherwise the
1352
- # Document#base_dir. If the target directory does not exist, it will not be
1353
- # created unless the :mkdirs option is set to true. If the file cannot be
1354
- # written because the target directory does not exist, or because it falls
1355
- # outside of the Document#base_dir in safe mode, an IOError is raised.
1356
- #
1357
- # If the output is going to be written to a file, the header and footer are
1358
- # included unless specified otherwise (writing to a file implies creating a
1359
- # standalone document). Otherwise, the header and footer are not included by
1360
- # default and the converted result is returned.
1361
- #
1362
- # input - the String AsciiDoc source filename
1363
- # options - a String, Array or Hash of options to control processing (default: {})
1364
- # String and Array values are converted into a Hash.
1365
- # See Asciidoctor::Document#initialize for details about options.
1366
- #
1367
- # Returns the Document object if the converted String is written to a
1368
- # file, otherwise the converted String
1369
- def convert input, options = {}
1370
- (options = options.merge).delete :parse
1371
- to_dir = options.delete :to_dir
1372
- mkdirs = options.delete :mkdirs
1373
-
1374
- case (to_file = options.delete :to_file)
1375
- when true, nil
1376
- unless (write_to_target = to_dir)
1377
- sibling_path = ::File.absolute_path input.path if ::File === input
1378
- end
1379
- to_file = nil
1380
- when false
1381
- to_file = nil
1382
- when '/dev/null'
1383
- return self.load input, options
1384
- else
1385
- options[:to_file] = write_to_target = to_file unless (stream_output = to_file.respond_to? :write)
1386
- end
1387
-
1388
- unless options.key? :standalone
1389
- if sibling_path || write_to_target
1390
- options[:standalone] = true
1391
- elsif options.key? :header_footer
1392
- options[:standalone] = options[:header_footer]
1393
- end
1394
- end
1395
-
1396
- # NOTE outfile may be controlled by document attributes, so resolve outfile after loading
1397
- if sibling_path
1398
- options[:to_dir] = outdir = ::File.dirname sibling_path
1399
- elsif write_to_target
1400
- if to_dir
1401
- if to_file
1402
- options[:to_dir] = ::File.dirname ::File.expand_path ::File.join to_dir, to_file
1403
- else
1404
- options[:to_dir] = ::File.expand_path to_dir
1405
- end
1406
- elsif to_file
1407
- options[:to_dir] = ::File.dirname ::File.expand_path to_file
1408
- end
1409
- end
1410
-
1411
- # NOTE :to_dir is always set when outputting to a file
1412
- # NOTE :to_file option only passed if assigned an explicit path
1413
- doc = self.load input, options
1414
-
1415
- if sibling_path # write to file in same directory
1416
- outfile = ::File.join outdir, %(#{doc.attributes['docname']}#{doc.outfilesuffix})
1417
- raise ::IOError, %(input file and output file cannot be the same: #{outfile}) if outfile == sibling_path
1418
- elsif write_to_target # write to explicit file or directory
1419
- working_dir = (options.key? :base_dir) ? (::File.expand_path options[:base_dir]) : ::Dir.pwd
1420
- # QUESTION should the jail be the working_dir or doc.base_dir???
1421
- jail = doc.safe >= SafeMode::SAFE ? working_dir : nil
1422
- if to_dir
1423
- outdir = doc.normalize_system_path(to_dir, working_dir, jail, target_name: 'to_dir', recover: false)
1424
- if to_file
1425
- outfile = doc.normalize_system_path(to_file, outdir, nil, target_name: 'to_dir', recover: false)
1426
- # reestablish outdir as the final target directory (in the case to_file had directory segments)
1427
- outdir = ::File.dirname outfile
1428
- else
1429
- outfile = ::File.join outdir, %(#{doc.attributes['docname']}#{doc.outfilesuffix})
1430
- end
1431
- elsif to_file
1432
- outfile = doc.normalize_system_path(to_file, working_dir, jail, target_name: 'to_dir', recover: false)
1433
- # establish outdir as the final target directory (in the case to_file had directory segments)
1434
- outdir = ::File.dirname outfile
1435
- end
1436
-
1437
- if ::File === input && outfile == (::File.absolute_path input.path)
1438
- raise ::IOError, %(input file and output file cannot be the same: #{outfile})
1439
- end
1440
-
1441
- if mkdirs
1442
- Helpers.mkdir_p outdir
1443
- else
1444
- # NOTE we intentionally refer to the directory as it was passed to the API
1445
- raise ::IOError, %(target directory does not exist: #{to_dir} (hint: set :mkdirs option)) unless ::File.directory? outdir
1446
- end
1447
- else # write to stream
1448
- outfile = to_file
1449
- outdir = nil
1450
- end
1451
-
1452
- if outfile && !stream_output
1453
- output = doc.convert 'outfile' => outfile, 'outdir' => outdir
1454
- else
1455
- output = doc.convert
1456
- end
1457
-
1458
- if outfile
1459
- doc.write output, outfile
1460
-
1461
- # NOTE document cannot control this behavior if safe >= SafeMode::SERVER
1462
- # NOTE skip if stylesdir is a URI
1463
- if !stream_output && doc.safe < SafeMode::SECURE && (doc.attr? 'linkcss') && (doc.attr? 'copycss') &&
1464
- (doc.basebackend? 'html') && !((stylesdir = (doc.attr 'stylesdir')) && (Helpers.uriish? stylesdir))
1465
- if (stylesheet = doc.attr 'stylesheet')
1466
- if DEFAULT_STYLESHEET_KEYS.include? stylesheet
1467
- copy_asciidoctor_stylesheet = true
1468
- elsif !(Helpers.uriish? stylesheet)
1469
- copy_user_stylesheet = true
1470
- end
1471
- end
1472
- copy_syntax_hl_stylesheet = (syntax_hl = doc.syntax_highlighter) && (syntax_hl.write_stylesheet? doc)
1473
- if copy_asciidoctor_stylesheet || copy_user_stylesheet || copy_syntax_hl_stylesheet
1474
- stylesoutdir = doc.normalize_system_path(stylesdir, outdir, doc.safe >= SafeMode::SAFE ? outdir : nil)
1475
- if mkdirs
1476
- Helpers.mkdir_p stylesoutdir
1477
- else
1478
- raise ::IOError, %(target stylesheet directory does not exist: #{stylesoutdir} (hint: set :mkdirs option)) unless ::File.directory? stylesoutdir
1479
- end
1480
-
1481
- if copy_asciidoctor_stylesheet
1482
- Stylesheets.instance.write_primary_stylesheet stylesoutdir
1483
- # FIXME should Stylesheets also handle the user stylesheet?
1484
- elsif copy_user_stylesheet
1485
- if (stylesheet_src = doc.attr 'copycss').empty?
1486
- stylesheet_src = doc.normalize_system_path stylesheet
1487
- else
1488
- # NOTE in this case, copycss is a source location (but cannot be a URI)
1489
- stylesheet_src = doc.normalize_system_path stylesheet_src
1490
- end
1491
- stylesheet_dest = doc.normalize_system_path stylesheet, stylesoutdir, (doc.safe >= SafeMode::SAFE ? outdir : nil)
1492
- # NOTE don't warn if src can't be read and dest already exists (see #2323)
1493
- if stylesheet_src != stylesheet_dest && (stylesheet_data = doc.read_asset stylesheet_src,
1494
- warn_on_failure: !(::File.file? stylesheet_dest), label: 'stylesheet')
1495
- ::File.write stylesheet_dest, stylesheet_data, mode: FILE_WRITE_MODE
1496
- end
1497
- end
1498
- syntax_hl.write_stylesheet doc, stylesoutdir if copy_syntax_hl_stylesheet
1499
- end
1500
- end
1501
- doc
1502
- else
1503
- output
1504
- end
1505
- end
1506
-
1507
- # Deprecated: Use {Asciidoctor.convert} instead.
1508
- alias render convert
1509
-
1510
- # Public: Parse the contents of the AsciiDoc source file into an
1511
- # Asciidoctor::Document and convert it to the specified backend format.
1512
- #
1513
- # input - the String AsciiDoc source filename
1514
- # options - a String, Array or Hash of options to control processing (default: {})
1515
- # String and Array values are converted into a Hash.
1516
- # See Asciidoctor::Document#initialize for details about options.
1517
- #
1518
- # Returns the Document object if the converted String is written to a
1519
- # file, otherwise the converted String
1520
- def convert_file filename, options = {}
1521
- ::File.open(filename, FILE_READ_MODE) {|file| self.convert file, options }
1522
- end
1523
-
1524
- # Deprecated: Use {Asciidoctor.convert_file} instead.
1525
- alias render_file convert_file
1526
-
1527
1223
  # Internal: Automatically load the Asciidoctor::Extensions module.
1528
1224
  #
1529
1225
  # Requires the Asciidoctor::Extensions module if the name is :Extensions.
@@ -1534,7 +1230,7 @@ module Asciidoctor
1534
1230
  # defined prior to it being loaded.
1535
1231
  #
1536
1232
  # Returns the resolved constant, if resolved, otherwise nothing.
1537
- def const_missing name
1233
+ def self.const_missing name
1538
1234
  if name == :Extensions
1539
1235
  require_relative 'asciidoctor/extensions'
1540
1236
  Extensions
@@ -1543,8 +1239,6 @@ module Asciidoctor
1543
1239
  end
1544
1240
  end unless RUBY_ENGINE == 'opal'
1545
1241
 
1546
- end
1547
-
1548
1242
  unless RUBY_ENGINE == 'opal'
1549
1243
  autoload :SyntaxHighlighter, %(#{LIB_DIR}/asciidoctor/syntax_highlighter)
1550
1244
  autoload :Timings, %(#{LIB_DIR}/asciidoctor/timings)
@@ -1580,6 +1274,10 @@ require_relative 'asciidoctor/stylesheets'
1580
1274
  require_relative 'asciidoctor/table'
1581
1275
  require_relative 'asciidoctor/writer'
1582
1276
 
1277
+ # main API entry points
1278
+ require_relative 'asciidoctor/load'
1279
+ require_relative 'asciidoctor/convert'
1280
+
1583
1281
  if RUBY_ENGINE == 'opal'
1584
1282
  require_relative 'asciidoctor/syntax_highlighter'
1585
1283
  require_relative 'asciidoctor/timings'
@@ -80,13 +80,13 @@ module Asciidoctor
80
80
  'specify eRuby implementation to use when rendering custom ERB templates: [erb, erubis] (default: erb)') do |eruby|
81
81
  self[:eruby] = eruby
82
82
  end
83
- opts.on('-a', '--attribute key[=value]', 'a document attribute to set in the form of key, key! or key=value pair',
84
- 'unless @ is appended to the value, this attributes takes precedence over attributes',
85
- 'defined in the source document') do |attr|
83
+ opts.on('-a', '--attribute name[=value]', 'a document attribute to set in the form of name, name!, or name=value pair',
84
+ 'this attribute takes precedence over the same attribute defined in the source document',
85
+ 'unless either the name or value ends in @ (i.e., name@=value or name=value@)') do |attr|
86
86
  next if (attr = attr.rstrip).empty? || attr == '='
87
87
  attr = attr.encode UTF_8 unless attr.encoding == UTF_8
88
- key, _, val = attr.partition '='
89
- self[:attributes][key] = val
88
+ name, _, val = attr.partition '='
89
+ self[:attributes][name] = val
90
90
  end
91
91
  opts.on('-T', '--template-dir DIR', 'a directory containing custom converter templates that override the built-in converter (requires tilt gem)',
92
92
  'may be specified multiple times') do |template_dir|
@@ -0,0 +1,193 @@
1
+ module Asciidoctor
2
+ module_function
3
+
4
+ # Public: Parse the AsciiDoc source input into an Asciidoctor::Document and
5
+ # convert it to the specified backend format.
6
+ #
7
+ # Accepts input as an IO (or StringIO), String or String Array object. If the
8
+ # input is a File, the object is expected to be opened for reading and is not
9
+ # closed afterwards by this method. Information about the file (filename,
10
+ # directory name, etc) gets assigned to attributes on the Document object.
11
+ #
12
+ # If the :to_file option is true, and the input is a File, the output is
13
+ # written to a file adjacent to the input file, having an extension that
14
+ # corresponds to the backend format. Otherwise, if the :to_file option is
15
+ # specified, the file is written to that file. If :to_file is not an absolute
16
+ # path, it is resolved relative to :to_dir, if given, otherwise the
17
+ # Document#base_dir. If the target directory does not exist, it will not be
18
+ # created unless the :mkdirs option is set to true. If the file cannot be
19
+ # written because the target directory does not exist, or because it falls
20
+ # outside of the Document#base_dir in safe mode, an IOError is raised.
21
+ #
22
+ # If the output is going to be written to a file, the header and footer are
23
+ # included unless specified otherwise (writing to a file implies creating a
24
+ # standalone document). Otherwise, the header and footer are not included by
25
+ # default and the converted result is returned.
26
+ #
27
+ # input - the String AsciiDoc source filename
28
+ # options - a String, Array or Hash of options to control processing (default: {})
29
+ # String and Array values are converted into a Hash.
30
+ # See Asciidoctor::Document#initialize for details about options.
31
+ #
32
+ # Returns the Document object if the converted String is written to a
33
+ # file, otherwise the converted String
34
+ def convert input, options = {}
35
+ (options = options.merge).delete :parse
36
+ to_dir = options.delete :to_dir
37
+ mkdirs = options.delete :mkdirs
38
+
39
+ case (to_file = options.delete :to_file)
40
+ when true, nil
41
+ unless (write_to_target = to_dir)
42
+ sibling_path = ::File.absolute_path input.path if ::File === input
43
+ end
44
+ to_file = nil
45
+ when false
46
+ to_file = nil
47
+ when '/dev/null'
48
+ return load input, options
49
+ else
50
+ options[:to_file] = write_to_target = to_file unless (stream_output = to_file.respond_to? :write)
51
+ end
52
+
53
+ unless options.key? :standalone
54
+ if sibling_path || write_to_target
55
+ options[:standalone] = true
56
+ elsif options.key? :header_footer
57
+ options[:standalone] = options[:header_footer]
58
+ end
59
+ end
60
+
61
+ # NOTE outfile may be controlled by document attributes, so resolve outfile after loading
62
+ if sibling_path
63
+ options[:to_dir] = outdir = ::File.dirname sibling_path
64
+ elsif write_to_target
65
+ if to_dir
66
+ if to_file
67
+ options[:to_dir] = ::File.dirname ::File.expand_path ::File.join to_dir, to_file
68
+ else
69
+ options[:to_dir] = ::File.expand_path to_dir
70
+ end
71
+ elsif to_file
72
+ options[:to_dir] = ::File.dirname ::File.expand_path to_file
73
+ end
74
+ end
75
+
76
+ # NOTE :to_dir is always set when outputting to a file
77
+ # NOTE :to_file option only passed if assigned an explicit path
78
+ doc = load input, options
79
+
80
+ if sibling_path # write to file in same directory
81
+ outfile = ::File.join outdir, %(#{doc.attributes['docname']}#{doc.outfilesuffix})
82
+ raise ::IOError, %(input file and output file cannot be the same: #{outfile}) if outfile == sibling_path
83
+ elsif write_to_target # write to explicit file or directory
84
+ working_dir = (options.key? :base_dir) ? (::File.expand_path options[:base_dir]) : ::Dir.pwd
85
+ # QUESTION should the jail be the working_dir or doc.base_dir???
86
+ jail = doc.safe >= SafeMode::SAFE ? working_dir : nil
87
+ if to_dir
88
+ outdir = doc.normalize_system_path(to_dir, working_dir, jail, target_name: 'to_dir', recover: false)
89
+ if to_file
90
+ outfile = doc.normalize_system_path(to_file, outdir, nil, target_name: 'to_dir', recover: false)
91
+ # reestablish outdir as the final target directory (in the case to_file had directory segments)
92
+ outdir = ::File.dirname outfile
93
+ else
94
+ outfile = ::File.join outdir, %(#{doc.attributes['docname']}#{doc.outfilesuffix})
95
+ end
96
+ elsif to_file
97
+ outfile = doc.normalize_system_path(to_file, working_dir, jail, target_name: 'to_dir', recover: false)
98
+ # establish outdir as the final target directory (in the case to_file had directory segments)
99
+ outdir = ::File.dirname outfile
100
+ end
101
+
102
+ if ::File === input && outfile == (::File.absolute_path input.path)
103
+ raise ::IOError, %(input file and output file cannot be the same: #{outfile})
104
+ end
105
+
106
+ if mkdirs
107
+ Helpers.mkdir_p outdir
108
+ else
109
+ # NOTE we intentionally refer to the directory as it was passed to the API
110
+ raise ::IOError, %(target directory does not exist: #{to_dir} (hint: set :mkdirs option)) unless ::File.directory? outdir
111
+ end
112
+ else # write to stream
113
+ outfile = to_file
114
+ outdir = nil
115
+ end
116
+
117
+ if outfile && !stream_output
118
+ output = doc.convert 'outfile' => outfile, 'outdir' => outdir
119
+ else
120
+ output = doc.convert
121
+ end
122
+
123
+ if outfile
124
+ doc.write output, outfile
125
+
126
+ # NOTE document cannot control this behavior if safe >= SafeMode::SERVER
127
+ # NOTE skip if stylesdir is a URI
128
+ if !stream_output && doc.safe < SafeMode::SECURE && (doc.attr? 'linkcss') && (doc.attr? 'copycss') &&
129
+ (doc.basebackend? 'html') && !((stylesdir = (doc.attr 'stylesdir')) && (Helpers.uriish? stylesdir))
130
+ if (stylesheet = doc.attr 'stylesheet')
131
+ if DEFAULT_STYLESHEET_KEYS.include? stylesheet
132
+ copy_asciidoctor_stylesheet = true
133
+ elsif !(Helpers.uriish? stylesheet)
134
+ copy_user_stylesheet = true
135
+ end
136
+ end
137
+ copy_syntax_hl_stylesheet = (syntax_hl = doc.syntax_highlighter) && (syntax_hl.write_stylesheet? doc)
138
+ if copy_asciidoctor_stylesheet || copy_user_stylesheet || copy_syntax_hl_stylesheet
139
+ stylesoutdir = doc.normalize_system_path(stylesdir, outdir, doc.safe >= SafeMode::SAFE ? outdir : nil)
140
+ if mkdirs
141
+ Helpers.mkdir_p stylesoutdir
142
+ else
143
+ raise ::IOError, %(target stylesheet directory does not exist: #{stylesoutdir} (hint: set :mkdirs option)) unless ::File.directory? stylesoutdir
144
+ end
145
+
146
+ if copy_asciidoctor_stylesheet
147
+ Stylesheets.instance.write_primary_stylesheet stylesoutdir
148
+ # FIXME should Stylesheets also handle the user stylesheet?
149
+ elsif copy_user_stylesheet
150
+ if (stylesheet_src = doc.attr 'copycss').empty?
151
+ stylesheet_src = doc.normalize_system_path stylesheet
152
+ else
153
+ # NOTE in this case, copycss is a source location (but cannot be a URI)
154
+ stylesheet_src = doc.normalize_system_path stylesheet_src
155
+ end
156
+ stylesheet_dest = doc.normalize_system_path stylesheet, stylesoutdir, (doc.safe >= SafeMode::SAFE ? outdir : nil)
157
+ # NOTE don't warn if src can't be read and dest already exists (see #2323)
158
+ if stylesheet_src != stylesheet_dest && (stylesheet_data = doc.read_asset stylesheet_src,
159
+ warn_on_failure: !(::File.file? stylesheet_dest), label: 'stylesheet')
160
+ ::File.write stylesheet_dest, stylesheet_data, mode: FILE_WRITE_MODE
161
+ end
162
+ end
163
+ syntax_hl.write_stylesheet doc, stylesoutdir if copy_syntax_hl_stylesheet
164
+ end
165
+ end
166
+ doc
167
+ else
168
+ output
169
+ end
170
+ end
171
+
172
+ # Public: Parse the contents of the AsciiDoc source file into an
173
+ # Asciidoctor::Document and convert it to the specified backend format.
174
+ #
175
+ # input - the String AsciiDoc source filename
176
+ # options - a String, Array or Hash of options to control processing (default: {})
177
+ # String and Array values are converted into a Hash.
178
+ # See Asciidoctor::Document#initialize for details about options.
179
+ #
180
+ # Returns the Document object if the converted String is written to a
181
+ # file, otherwise the converted String
182
+ def convert_file filename, options = {}
183
+ ::File.open(filename, FILE_READ_MODE) {|file| convert file, options }
184
+ end
185
+
186
+ # Deprecated: Use {Asciidoctor.convert} instead.
187
+ alias render convert
188
+ module_function :render
189
+
190
+ # Deprecated: Use {Asciidoctor.convert_file} instead.
191
+ alias render_file convert_file
192
+ module_function :render_file
193
+ end
@@ -331,8 +331,7 @@ class Document < AbstractBlock
331
331
  options[:standalone] = options[:header_footer] if (options.key? :header_footer) && !(options.key? :standalone)
332
332
  end
333
333
 
334
- @parsed = false
335
- @header = @header_attributes = nil
334
+ @parsed = @reftexts = @header = @header_attributes = nil
336
335
  @counters = {}
337
336
  @attributes_modified = ::Set.new
338
337
  @docinfo_processor_extensions = {}
@@ -615,16 +614,25 @@ class Document < AbstractBlock
615
614
  end
616
615
  end
617
616
 
618
- # Public: Scan all registered references and return the ID of the reference that matches the specified reference text.
619
- #
620
- # If multiple references in the document have the same reference text, the first match in document order is used.
617
+ # Public: Scan registered references and return the ID of the first reference that matches the specified reference text.
621
618
  #
622
619
  # text - The String reference text to compare to the converted reference text of each registered reference.
623
620
  #
624
621
  # Returns the String ID of the first reference with matching reference text or nothing if no reference is found.
625
622
  def resolve_id text
626
- ((@reftexts ||= @parsed ? {}.tap {|accum| @catalog[:refs].each {|id, ref| accum[ref.xreftext] = id } } : nil) ||
627
- {}.tap {|accum| @catalog[:refs].find {|id, ref| ref.xreftext == text ? accum[text] = id : nil } })[text]
623
+ if @reftexts
624
+ @reftexts[text]
625
+ elsif @parsed
626
+ # @reftexts is set eagerly to prevent nested lazy init
627
+ (@reftexts = {}).tap {|accum| @catalog[:refs].each {|id, ref| accum[ref.xreftext] ||= id } }[text]
628
+ else
629
+ # @reftexts is set eagerly to prevent nested lazy init
630
+ resolved_id = nil
631
+ # NOTE short-circuit early since we're throwing away this table
632
+ (@reftexts = {}).tap {|accum| @catalog[:refs].each {|id, ref| (xreftext = ref.xreftext) == text ? (break (resolved_id = id)) : (accum[xreftext] ||= id) } }
633
+ @reftexts = nil
634
+ resolved_id
635
+ end
628
636
  end
629
637
 
630
638
  def footnotes?
@@ -0,0 +1,117 @@
1
+ module Asciidoctor
2
+ module_function
3
+
4
+ # Public: Parse the AsciiDoc source input into a {Document}
5
+ #
6
+ # Accepts input as an IO (or StringIO), String or String Array object. If the
7
+ # input is a File, the object is expected to be opened for reading and is not
8
+ # closed afterwards by this method. Information about the file (filename,
9
+ # directory name, etc) gets assigned to attributes on the Document object.
10
+ #
11
+ # input - the AsciiDoc source as a IO, String or Array.
12
+ # options - a String, Array or Hash of options to control processing (default: {})
13
+ # String and Array values are converted into a Hash.
14
+ # See {Document#initialize} for details about these options.
15
+ #
16
+ # Returns the Document
17
+ def load input, options = {}
18
+ options = options.merge
19
+
20
+ if (timings = options[:timings])
21
+ timings.start :read
22
+ end
23
+
24
+ if (logger = options[:logger]) && logger != LoggerManager.logger
25
+ LoggerManager.logger = logger
26
+ end
27
+
28
+ if !(attrs = options[:attributes])
29
+ attrs = {}
30
+ elsif ::Hash === attrs
31
+ attrs = attrs.merge
32
+ elsif (defined? ::Java::JavaUtil::Map) && ::Java::JavaUtil::Map === attrs
33
+ attrs = attrs.dup
34
+ elsif ::Array === attrs
35
+ attrs = {}.tap do |accum|
36
+ attrs.each do |entry|
37
+ k, _, v = entry.partition '='
38
+ accum[k] = v
39
+ end
40
+ end
41
+ elsif ::String === attrs
42
+ # condense and convert non-escaped spaces to null, unescape escaped spaces, then split on null
43
+ attrs = {}.tap do |accum|
44
+ attrs.gsub(SpaceDelimiterRx, '\1' + NULL).gsub(EscapedSpaceRx, '\1').split(NULL).each do |entry|
45
+ k, _, v = entry.partition '='
46
+ accum[k] = v
47
+ end
48
+ end
49
+ elsif (attrs.respond_to? :keys) && (attrs.respond_to? :[])
50
+ # coerce attrs to a real Hash
51
+ attrs = {}.tap {|accum| attrs.keys.each {|k| accum[k] = attrs[k] } }
52
+ else
53
+ raise ::ArgumentError, %(illegal type for attributes option: #{attrs.class.ancestors.join ' < '})
54
+ end
55
+
56
+ if ::File === input
57
+ options[:input_mtime] = input.mtime
58
+ # NOTE defer setting infile and indir until we get a better sense of their purpose
59
+ # TODO cli checks if input path can be read and is file, but might want to add check to API too
60
+ attrs['docfile'] = input_path = ::File.absolute_path input.path
61
+ attrs['docdir'] = ::File.dirname input_path
62
+ attrs['docname'] = Helpers.basename input_path, (attrs['docfilesuffix'] = Helpers.extname input_path)
63
+ source = input.read
64
+ elsif input.respond_to? :read
65
+ # NOTE tty, pipes & sockets can't be rewound, but can't be sniffed easily either
66
+ # just fail the rewind operation silently to handle all cases
67
+ input.rewind rescue nil
68
+ source = input.read
69
+ elsif ::String === input
70
+ source = input
71
+ elsif ::Array === input
72
+ source = input.drop 0
73
+ elsif input
74
+ raise ::ArgumentError, %(unsupported input type: #{input.class})
75
+ end
76
+
77
+ if timings
78
+ timings.record :read
79
+ timings.start :parse
80
+ end
81
+
82
+ options[:attributes] = attrs
83
+ doc = options[:parse] == false ? (Document.new source, options) : (Document.new source, options).parse
84
+
85
+ timings.record :parse if timings
86
+ doc
87
+ rescue => ex
88
+ begin
89
+ context = %(asciidoctor: FAILED: #{attrs['docfile'] || '<stdin>'}: Failed to load AsciiDoc document)
90
+ if ex.respond_to? :exception
91
+ # The original message must be explicitly preserved when wrapping a Ruby exception
92
+ wrapped_ex = ex.exception %(#{context} - #{ex.message})
93
+ # JRuby automatically sets backtrace; MRI did not until 2.6
94
+ wrapped_ex.set_backtrace ex.backtrace
95
+ else
96
+ # Likely a Java exception class
97
+ wrapped_ex = ex.class.new context, ex
98
+ wrapped_ex.stack_trace = ex.stack_trace
99
+ end
100
+ rescue
101
+ wrapped_ex = ex
102
+ end
103
+ raise wrapped_ex
104
+ end
105
+
106
+ # Public: Parse the contents of the AsciiDoc source file into an Asciidoctor::Document
107
+ #
108
+ # input - the String AsciiDoc source filename
109
+ # options - a String, Array or Hash of options to control processing (default: {})
110
+ # String and Array values are converted into a Hash.
111
+ # See Asciidoctor::Document#initialize for details about options.
112
+ #
113
+ # Returns the Asciidoctor::Document
114
+ def load_file filename, options = {}
115
+ ::File.open(filename, FILE_READ_MODE) {|file| load file, options }
116
+ end
117
+ end
@@ -807,7 +807,7 @@ module Substitutors
807
807
  refid, target = fragment, %(##{fragment})
808
808
  # handles: Node Title or Reference Text
809
809
  # do reverse lookup on fragment if not a known ID and resembles reftext (contains a space or uppercase char)
810
- elsif (refid = doc.resolve_id fragment) && ((fragment.include? ' ') || fragment.downcase != fragment)
810
+ elsif ((fragment.include? ' ') || fragment.downcase != fragment) && (refid = doc.resolve_id fragment)
811
811
  fragment, target = refid, %(##{refid})
812
812
  else
813
813
  refid, target = fragment, %(##{fragment})
@@ -5,8 +5,7 @@ class SyntaxHighlighter::RougeAdapter < SyntaxHighlighter::Base
5
5
 
6
6
  def initialize *args
7
7
  super
8
- @requires_stylesheet = nil
9
- @style = nil
8
+ @requires_stylesheet = @style = nil
10
9
  end
11
10
 
12
11
  def highlight?
@@ -19,9 +18,9 @@ class SyntaxHighlighter::RougeAdapter < SyntaxHighlighter::Base
19
18
  @style ||= (style = opts[:style]) && (style_available? style) || DEFAULT_STYLE
20
19
  if opts[:css_mode] == :class
21
20
  @requires_stylesheet = true
22
- formatter = ::Rouge::Formatters::HTML.new @style
21
+ formatter = ::Rouge::Formatters::HTML.new inline_theme: @style
23
22
  else
24
- formatter = ::Rouge::Formatters::HTMLInline.new @style
23
+ formatter = ::Rouge::Formatters::HTMLInline.new (::Rouge::Theme.find @style).new
25
24
  end
26
25
  if (highlight_lines = opts[:highlight_lines])
27
26
  formatter = RougeExt::Formatters::HTMLLineHighlighter.new formatter, lines: highlight_lines
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Asciidoctor
3
- VERSION = '2.0.6'
3
+ VERSION = '2.0.7'
4
4
  end
@@ -1,13 +1,13 @@
1
1
  '\" t
2
2
  .\" Title: asciidoctor
3
3
  .\" Author: Dan Allen, Sarah White, Ryan Waldron
4
- .\" Generator: Asciidoctor 2.0.6
5
- .\" Date: 2019-04-04
4
+ .\" Generator: Asciidoctor 2.0.7
5
+ .\" Date: 2019-04-13
6
6
  .\" Manual: Asciidoctor Manual
7
- .\" Source: Asciidoctor 2.0.6
7
+ .\" Source: Asciidoctor 2.0.7
8
8
  .\" Language: English
9
9
  .\"
10
- .TH "ASCIIDOCTOR" "1" "2019-04-04" "Asciidoctor 2.0.6" "Asciidoctor Manual"
10
+ .TH "ASCIIDOCTOR" "1" "2019-04-13" "Asciidoctor 2.0.7" "Asciidoctor Manual"
11
11
  .ie \n(.g .ds Aq \(aq
12
12
  .el .ds Aq '
13
13
  .ss \n[.ss] 0
@@ -28,13 +28,13 @@
28
28
  . LINKSTYLE blue R < >
29
29
  .\}
30
30
  .SH "NAME"
31
- asciidoctor \- converts AsciiDoc source files to HTML, DocBook and other formats
31
+ asciidoctor \- converts AsciiDoc source files to HTML, DocBook, and other formats
32
32
  .SH "SYNOPSIS"
33
33
  .sp
34
34
  \fBasciidoctor\fP [\fIOPTION\fP]... \fIFILE\fP...
35
35
  .SH "DESCRIPTION"
36
36
  .sp
37
- The asciidoctor(1) command converts the AsciiDoc source file(s) \fIFILE\fP to HTML5, DocBook 5, man(ual) page and other custom output formats.
37
+ The asciidoctor(1) command converts the AsciiDoc source file(s) \fIFILE\fP to HTML5, DocBook 5, man(ual) page, and other custom output formats.
38
38
  .sp
39
39
  If \fIFILE\fP is \fI\-\fP then the AsciiDoc source is read from standard input.
40
40
  .SH "OPTIONS"
@@ -43,13 +43,13 @@ If \fIFILE\fP is \fI\-\fP then the AsciiDoc source is read from standard input.
43
43
  \fB\-B, \-\-base\-dir\fP=\fIDIR\fP
44
44
  .RS 4
45
45
  Base directory containing the document and resources.
46
- Defaults to the directory containing the source file, or the working directory if the source is read from a stream.
46
+ Defaults to the directory containing the source file or, if the source is read from a stream, the working directory.
47
47
  When combined with the safe mode setting, can be used to chroot the execution of the program.
48
48
  .RE
49
49
  .sp
50
50
  \fB\-S, \-\-safe\-mode\fP=\fISAFE_MODE\fP
51
51
  .RS 4
52
- Set safe mode level: \fIunsafe\fP, \fIsafe\fP, \fIserver\fP or \fIsecure\fP.
52
+ Set safe mode level: \fIunsafe\fP, \fIsafe\fP, \fIserver\fP, or \fIsecure\fP.
53
53
  Disables potentially dangerous macros in source files, such as \f(CRinclude::[]\fP.
54
54
  If not set, the safe mode level defaults to \fIunsafe\fP when Asciidoctor is invoked using this script.
55
55
  .RE
@@ -65,11 +65,11 @@ If not set, the safe mode level defaults to \fIunsafe\fP when Asciidoctor is inv
65
65
  .sp
66
66
  \fB\-a, \-\-attribute\fP=\fIATTRIBUTE\fP
67
67
  .RS 4
68
- Define, override or delete a document attribute.
69
- Command\-line attributes take precedence over attributes defined in the source file unless the value ends with \fI@\fP.
68
+ Define, override, or unset a document attribute.
69
+ Command\-line attributes take precedence over attributes defined in the source file unless either the name or value ends in \fI@\fP.
70
70
  .sp
71
71
  \fIATTRIBUTE\fP is normally formatted as a key\-value pair, in the form \fINAME=VALUE\fP.
72
- Alternate acceptable forms are \fINAME\fP (where the \fIVALUE\fP defaults to an empty string), \fINAME!\fP (unassigns the \fINAME\fP attribute) and \fINAME=VALUE@\fP (where \fIVALUE\fP does not override value of \fINAME\fP attribute if it\(cqs already defined in the source document).
72
+ Alternate forms are \fINAME\fP (where the \fIVALUE\fP defaults to an empty string), \fINAME!\fP (unsets the \fINAME\fP attribute), and \fINAME=VALUE@\fP (or \fINAME@=VALUE\fP) (where \fIVALUE\fP does not override the \fINAME\fP attribute if it\(cqs already defined in the source document).
73
73
  Values containing spaces should be enclosed in quotes.
74
74
  .sp
75
75
  This option may be specified more than once.
@@ -77,7 +77,7 @@ This option may be specified more than once.
77
77
  .sp
78
78
  \fB\-b, \-\-backend\fP=\fIBACKEND\fP
79
79
  .RS 4
80
- Backend output file format: \fIhtml5\fP, \fIdocbook5\fP, \fIdocbook45\fP and \fImanpage\fP are supported out of the box.
80
+ Backend output file format: \fIhtml5\fP, \fIdocbook5\fP, \fIdocbook45\fP, and \fImanpage\fP are supported out of the box.
81
81
  You can also use the backend alias names \fIhtml\fP (aliased to \fIhtml5\fP) or \fIdocbook\fP (aliased to \fIdocbook5\fP).
82
82
  Other values can be passed, but if Asciidoctor cannot resolve the backend to a converter, it will fail.
83
83
  Defaults to \fIhtml5\fP.
@@ -85,7 +85,7 @@ Defaults to \fIhtml5\fP.
85
85
  .sp
86
86
  \fB\-d, \-\-doctype\fP=\fIDOCTYPE\fP
87
87
  .RS 4
88
- Document type: \fIarticle\fP, \fIbook\fP, \fImanpage\fP or \fIinline\fP.
88
+ Document type: \fIarticle\fP, \fIbook\fP, \fImanpage\fP, or \fIinline\fP.
89
89
  Sets the root element when using the \fIdocbook\fP backend and the style class on the HTML body element when using the \fIhtml\fP backend.
90
90
  The \fIbook\fP document type allows multiple level\-0 section titles in a single document.
91
91
  The \fImanpage\fP document type enables parsing of metadata necessary to produce a man page.
@@ -97,7 +97,7 @@ Defaults to \fIarticle\fP.
97
97
  \fB\-D, \-\-destination\-dir\fP=\fIDIR\fP
98
98
  .RS 4
99
99
  Destination output directory.
100
- Defaults to the directory containing the source file, or the working directory if the source is read from a stream.
100
+ Defaults to the directory containing the source file or, if the source is read from a stream, the working directory.
101
101
  If specified, the directory is resolved relative to the working directory.
102
102
  .RE
103
103
  .sp
@@ -198,7 +198,7 @@ Turn on script warnings (applies to executed code).
198
198
  .sp
199
199
  \fB\-t, \-\-timings\fP
200
200
  .RS 4
201
- Print timings report to stderr (time to read, parse and convert).
201
+ Print timings report to stderr (time to read, parse, and convert).
202
202
  .RE
203
203
  .SS "Program Information"
204
204
  .sp
@@ -239,7 +239,7 @@ Refer to the \fBAsciidoctor\fP issue tracker at \c
239
239
  .URL "https://github.com/asciidoctor/asciidoctor/issues?q=is%3Aopen" "" "."
240
240
  .SH "AUTHORS"
241
241
  .sp
242
- \fBAsciidoctor\fP was written by Dan Allen, Ryan Waldron, Jason Porter, Nick Hengeveld and other contributors.
242
+ \fBAsciidoctor\fP was written by Dan Allen, Ryan Waldron, Jason Porter, Nick Hengeveld, and other contributors.
243
243
  .sp
244
244
  \fBAsciiDoc\fP was written by Stuart Rackham and has received contributions from many other individuals.
245
245
  .SH "RESOURCES"
@@ -257,7 +257,7 @@ Refer to the \fBAsciidoctor\fP issue tracker at \c
257
257
  .URL "http://discuss.asciidoctor.org" "" ""
258
258
  .SH "COPYING"
259
259
  .sp
260
- Copyright (C) 2012\-2019 Dan Allen, Ryan Waldron and the Asciidoctor Project.
260
+ Copyright (C) 2012\-2019 Dan Allen, Ryan Waldron, and the Asciidoctor Project.
261
261
  Free use of this software is granted under the terms of the MIT License.
262
262
  .SH "AUTHORS"
263
263
  .sp
@@ -2,12 +2,12 @@
2
2
  Dan Allen; Sarah White; Ryan Waldron
3
3
  :doctype: manpage
4
4
  :man manual: Asciidoctor Manual
5
- :man source: Asciidoctor 2.0.6
5
+ :man source: Asciidoctor 2.0.7
6
6
  :page-layout: base
7
7
 
8
8
  == NAME
9
9
 
10
- asciidoctor - converts AsciiDoc source files to HTML, DocBook and other formats
10
+ asciidoctor - converts AsciiDoc source files to HTML, DocBook, and other formats
11
11
 
12
12
  == SYNOPSIS
13
13
 
@@ -15,7 +15,7 @@ asciidoctor - converts AsciiDoc source files to HTML, DocBook and other formats
15
15
 
16
16
  == DESCRIPTION
17
17
 
18
- The asciidoctor(1) command converts the AsciiDoc source file(s) _FILE_ to HTML5, DocBook 5, man(ual) page and other custom output formats.
18
+ The asciidoctor(1) command converts the AsciiDoc source file(s) _FILE_ to HTML5, DocBook 5, man(ual) page, and other custom output formats.
19
19
 
20
20
  If _FILE_ is _-_ then the AsciiDoc source is read from standard input.
21
21
 
@@ -25,11 +25,11 @@ If _FILE_ is _-_ then the AsciiDoc source is read from standard input.
25
25
 
26
26
  *-B, --base-dir*=_DIR_::
27
27
  Base directory containing the document and resources.
28
- Defaults to the directory containing the source file, or the working directory if the source is read from a stream.
28
+ Defaults to the directory containing the source file or, if the source is read from a stream, the working directory.
29
29
  When combined with the safe mode setting, can be used to chroot the execution of the program.
30
30
 
31
31
  *-S, --safe-mode*=_SAFE_MODE_::
32
- Set safe mode level: _unsafe_, _safe_, _server_ or _secure_.
32
+ Set safe mode level: _unsafe_, _safe_, _server_, or _secure_.
33
33
  Disables potentially dangerous macros in source files, such as `include::[]`.
34
34
  If not set, the safe mode level defaults to _unsafe_ when Asciidoctor is invoked using this script.
35
35
 
@@ -42,23 +42,23 @@ If _FILE_ is _-_ then the AsciiDoc source is read from standard input.
42
42
  === Document Settings
43
43
 
44
44
  *-a, --attribute*=_ATTRIBUTE_::
45
- Define, override or delete a document attribute.
46
- Command-line attributes take precedence over attributes defined in the source file unless the value ends with _@_.
45
+ Define, override, or unset a document attribute.
46
+ Command-line attributes take precedence over attributes defined in the source file unless either the name or value ends in _@_.
47
47
  +
48
48
  _ATTRIBUTE_ is normally formatted as a key-value pair, in the form _NAME=VALUE_.
49
- Alternate acceptable forms are _NAME_ (where the _VALUE_ defaults to an empty string), _NAME!_ (unassigns the _NAME_ attribute) and _NAME=VALUE@_ (where _VALUE_ does not override value of _NAME_ attribute if it's already defined in the source document).
49
+ Alternate forms are _NAME_ (where the _VALUE_ defaults to an empty string), _NAME!_ (unsets the _NAME_ attribute), and _NAME=VALUE@_ (or _NAME@=VALUE_) (where _VALUE_ does not override the _NAME_ attribute if it's already defined in the source document).
50
50
  Values containing spaces should be enclosed in quotes.
51
51
  +
52
52
  This option may be specified more than once.
53
53
 
54
54
  *-b, --backend*=_BACKEND_::
55
- Backend output file format: _html5_, _docbook5_, _docbook45_ and _manpage_ are supported out of the box.
55
+ Backend output file format: _html5_, _docbook5_, _docbook45_, and _manpage_ are supported out of the box.
56
56
  You can also use the backend alias names _html_ (aliased to _html5_) or _docbook_ (aliased to _docbook5_).
57
57
  Other values can be passed, but if Asciidoctor cannot resolve the backend to a converter, it will fail.
58
58
  Defaults to _html5_.
59
59
 
60
60
  *-d, --doctype*=_DOCTYPE_::
61
- Document type: _article_, _book_, _manpage_ or _inline_.
61
+ Document type: _article_, _book_, _manpage_, or _inline_.
62
62
  Sets the root element when using the _docbook_ backend and the style class on the HTML body element when using the _html_ backend.
63
63
  The _book_ document type allows multiple level-0 section titles in a single document.
64
64
  The _manpage_ document type enables parsing of metadata necessary to produce a man page.
@@ -69,7 +69,7 @@ This option may be specified more than once.
69
69
 
70
70
  *-D, --destination-dir*=_DIR_::
71
71
  Destination output directory.
72
- Defaults to the directory containing the source file, or the working directory if the source is read from a stream.
72
+ Defaults to the directory containing the source file or, if the source is read from a stream, the working directory.
73
73
  If specified, the directory is resolved relative to the working directory.
74
74
 
75
75
  *-E, --template-engine*=_NAME_::
@@ -141,7 +141,7 @@ Matching templates found in subsequent directories override ones previously disc
141
141
  Turn on script warnings (applies to executed code).
142
142
 
143
143
  *-t, --timings*::
144
- Print timings report to stderr (time to read, parse and convert).
144
+ Print timings report to stderr (time to read, parse, and convert).
145
145
 
146
146
  === Program Information
147
147
 
@@ -175,7 +175,7 @@ Refer to the *Asciidoctor* issue tracker at https://github.com/asciidoctor/ascii
175
175
 
176
176
  == AUTHORS
177
177
 
178
- *Asciidoctor* was written by Dan Allen, Ryan Waldron, Jason Porter, Nick Hengeveld and other contributors.
178
+ *Asciidoctor* was written by Dan Allen, Ryan Waldron, Jason Porter, Nick Hengeveld, and other contributors.
179
179
 
180
180
  *AsciiDoc* was written by Stuart Rackham and has received contributions from many other individuals.
181
181
 
@@ -191,5 +191,5 @@ Refer to the *Asciidoctor* issue tracker at https://github.com/asciidoctor/ascii
191
191
 
192
192
  == COPYING
193
193
 
194
- Copyright \(C) 2012-2019 Dan Allen, Ryan Waldron and the Asciidoctor Project.
194
+ Copyright \(C) 2012-2019 Dan Allen, Ryan Waldron, and the Asciidoctor Project.
195
195
  Free use of this software is granted under the terms of the MIT License.
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: 2.0.6
4
+ version: 2.0.7
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: 2019-04-04 00:00:00.000000000 Z
16
+ date: 2019-04-13 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: asciimath
@@ -260,6 +260,7 @@ files:
260
260
  - lib/asciidoctor/cli.rb
261
261
  - lib/asciidoctor/cli/invoker.rb
262
262
  - lib/asciidoctor/cli/options.rb
263
+ - lib/asciidoctor/convert.rb
263
264
  - lib/asciidoctor/converter.rb
264
265
  - lib/asciidoctor/converter/composite.rb
265
266
  - lib/asciidoctor/converter/docbook5.rb
@@ -277,6 +278,7 @@ files:
277
278
  - lib/asciidoctor/helpers.rb
278
279
  - lib/asciidoctor/inline.rb
279
280
  - lib/asciidoctor/list.rb
281
+ - lib/asciidoctor/load.rb
280
282
  - lib/asciidoctor/logging.rb
281
283
  - lib/asciidoctor/parser.rb
282
284
  - lib/asciidoctor/path_resolver.rb