asciidoctor 0.1.0 → 0.1.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.

Files changed (40) hide show
  1. data/README.asciidoc +11 -2
  2. data/asciidoctor.gemspec +3 -2
  3. data/lib/asciidoctor.rb +95 -62
  4. data/lib/asciidoctor/abstract_block.rb +7 -5
  5. data/lib/asciidoctor/abstract_node.rb +63 -15
  6. data/lib/asciidoctor/attribute_list.rb +3 -1
  7. data/lib/asciidoctor/backends/base_template.rb +17 -7
  8. data/lib/asciidoctor/backends/docbook45.rb +182 -150
  9. data/lib/asciidoctor/backends/html5.rb +138 -110
  10. data/lib/asciidoctor/block.rb +21 -18
  11. data/lib/asciidoctor/callouts.rb +3 -1
  12. data/lib/asciidoctor/cli/invoker.rb +3 -3
  13. data/lib/asciidoctor/cli/options.rb +6 -6
  14. data/lib/asciidoctor/debug.rb +7 -6
  15. data/lib/asciidoctor/document.rb +197 -25
  16. data/lib/asciidoctor/errors.rb +1 -1
  17. data/lib/asciidoctor/helpers.rb +29 -0
  18. data/lib/asciidoctor/inline.rb +11 -4
  19. data/lib/asciidoctor/lexer.rb +338 -182
  20. data/lib/asciidoctor/list_item.rb +14 -12
  21. data/lib/asciidoctor/reader.rb +423 -206
  22. data/lib/asciidoctor/renderer.rb +59 -15
  23. data/lib/asciidoctor/section.rb +7 -4
  24. data/lib/asciidoctor/substituters.rb +536 -511
  25. data/lib/asciidoctor/table.rb +473 -472
  26. data/lib/asciidoctor/version.rb +1 -1
  27. data/man/asciidoctor.1 +23 -14
  28. data/man/asciidoctor.ad +13 -7
  29. data/test/attributes_test.rb +42 -8
  30. data/test/blocks_test.rb +161 -1
  31. data/test/document_test.rb +134 -16
  32. data/test/invoker_test.rb +14 -6
  33. data/test/lexer_test.rb +45 -18
  34. data/test/lists_test.rb +79 -0
  35. data/test/paragraphs_test.rb +9 -1
  36. data/test/reader_test.rb +456 -19
  37. data/test/sections_test.rb +19 -0
  38. data/test/substitutions_test.rb +14 -12
  39. data/test/tables_test.rb +10 -10
  40. metadata +3 -5
data/README.asciidoc CHANGED
@@ -75,13 +75,13 @@ To invoke it, simply execute:
75
75
 
76
76
  This will use the built-in defaults for options and create a new file
77
77
  in the same directory as the input file, with the same base name, but
78
- with the .html extention.
78
+ with the .html extension.
79
79
 
80
80
  There are many other options available and full help is provided via:
81
81
 
82
82
  asciidoctor --help
83
83
 
84
- , or in the http://asciidoctor.org/man/asciidoctor[man page].
84
+ or in the http://asciidoctor.org/man/asciidoctor[man page].
85
85
 
86
86
  There is also an `asciidoctor-safe` command, which turns on safe mode
87
87
  by default, preventing access to files outside the parent directory of
@@ -279,6 +279,15 @@ providing patches in a timely fashion. If critical issues for a
279
279
  particular implementation exist at the time of a major release,
280
280
  support for that Ruby version may be dropped.
281
281
 
282
+ == Authors
283
+
284
+ *Asciidoctor* was written by Ryan Waldron, Dan Allen and
285
+ https://github.com/asciidoctor/asciidoctor/graphs/contributors[other
286
+ contributors].
287
+
288
+ *AsciiDoc* was written by Stuart Rackham and has received
289
+ contributions from many other individuals.
290
+
282
291
  == Copyright
283
292
 
284
293
  Copyright (C) 2012 Ryan Waldron.
data/asciidoctor.gemspec CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'asciidoctor'
16
- s.version = '0.1.0'
17
- s.date = '2013-02-04'
16
+ s.version = '0.1.1'
17
+ s.date = '2013-02-26'
18
18
  s.rubyforge_project = 'asciidoctor'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -82,6 +82,7 @@ Gem::Specification.new do |s|
82
82
  lib/asciidoctor/debug.rb
83
83
  lib/asciidoctor/document.rb
84
84
  lib/asciidoctor/errors.rb
85
+ lib/asciidoctor/helpers.rb
85
86
  lib/asciidoctor/inline.rb
86
87
  lib/asciidoctor/lexer.rb
87
88
  lib/asciidoctor/list_item.rb
data/lib/asciidoctor.rb CHANGED
@@ -113,6 +113,26 @@ module Asciidoctor
113
113
  'markdown' => '.md'
114
114
  }
115
115
 
116
+ DELIMITED_BLOCKS = {
117
+ '--' => :open,
118
+ '----' => :listing,
119
+ '....' => :literal,
120
+ '====' => :example,
121
+ '****' => :sidebar,
122
+ '____' => :quote,
123
+ '++++' => :pass,
124
+ '|===' => :table,
125
+ '!===' => :table,
126
+ '////' => :comment,
127
+ '```' => :fenced_code,
128
+ '~~~' => :fenced_code
129
+ }
130
+
131
+ BREAK_LINES = {
132
+ %q{'''} => :ruler,
133
+ '<<<' => :page_break
134
+ }
135
+
116
136
  LIST_CONTEXTS = [:ulist, :olist, :dlist, :colist]
117
137
 
118
138
  NESTABLE_LIST_CONTEXTS = [:ulist, :olist, :dlist]
@@ -120,7 +140,7 @@ module Asciidoctor
120
140
  ORDERED_LIST_STYLES = [:arabic, :loweralpha, :lowerroman, :upperalpha, :upperroman]
121
141
 
122
142
  ORDERED_LIST_MARKER_PATTERNS = {
123
- :arabic => /\d+[\.>]/,
143
+ :arabic => /\d+[.>]/,
124
144
  :loweralpha => /[a-z]\./,
125
145
  :upperalpha => /[A-Z]\./,
126
146
  :lowerroman => /[ivx]+\)/,
@@ -129,6 +149,9 @@ module Asciidoctor
129
149
 
130
150
  LIST_CONTINUATION = '+'
131
151
 
152
+ LINE_BREAK = ' +'
153
+
154
+ # NOTE allows for empty space in line as it could be left by the template engine
132
155
  BLANK_LINES_PATTERN = /^\s*\n/
133
156
 
134
157
  LINE_FEED_ENTITY = '&#10;' # or &#x0A;
@@ -142,10 +165,10 @@ module Asciidoctor
142
165
  # [enclosed text here] or [enclosed [text\] here]
143
166
  REGEXP = {
144
167
  # [[Foo]]
145
- :anchor => /^\[\[([^\[\]]+)\]\]\s*$/,
168
+ :anchor => /^\[\[([^\[\]]+)\]\]$/,
146
169
 
147
170
  # Foowhatevs [[Bar]]
148
- :anchor_embedded => /^(.*?)\s*\[\[([^\[\]]+)\]\]\s*$/,
171
+ :anchor_embedded => /^(.*?)\s*\[\[([^\[\]]+)\]\]$/,
149
172
 
150
173
  # [[ref]] (anywhere inline)
151
174
  :anchor_macro => /\\?\[\[([\w":].*?)\]\]/,
@@ -153,14 +176,12 @@ module Asciidoctor
153
176
  # matches any block delimiter:
154
177
  # open, listing, example, literal, comment, quote, sidebar, passthrough, table
155
178
  # NOTE position the most common blocks towards the front of the pattern
156
- :any_blk => %r{^(?:\-\-|(?:\-|=|\.|/|_|\*|\+){4,}|[\|!]={3,})\s*$},
157
-
158
- # optimization when scanning lines for blocks
159
- # NOTE accessing the first element before calling ord is first Ruby 1.8.7 compat
160
- :any_blk_ord => %w(- = . / _ * + | !).map {|c| c[0].ord },
179
+ :any_blk => %r{^(?:--|(?:-|\.|=|\*|_|\+|/){4,}|[\|!]={3,}|(?:`|~){3,}.*)$},
161
180
 
162
181
  # :foo: bar
163
- :attr_assign => /^:([^:!]+):\s*(.*)\s*$/,
182
+ # :Author: Dan
183
+ # :numbered!:
184
+ :attr_entry => /^:(\w.*?):(?:[[:blank:]]+(.*))?$/,
164
185
 
165
186
  # {name?value}
166
187
  :attr_conditional => /^\s*\{([^\?]+)\?\s*([^\}]+)\s*\}/,
@@ -173,7 +194,7 @@ module Asciidoctor
173
194
  :attr_continue => /^[[:blank:]]*(.*)[[:blank:]]\+[[:blank:]]*$/,
174
195
 
175
196
  # :foo!:
176
- :attr_delete => /^:([^:]+)!:\s*$/,
197
+ :attr_delete => /^:([^:]+)!:$/,
177
198
 
178
199
  # An attribute list above a block element
179
200
  #
@@ -185,20 +206,20 @@ module Asciidoctor
185
206
  # [{lead}]
186
207
  :blk_attr_list => /^\[([\w\{].*)\]$/,
187
208
 
188
- # attribute list or anchor (indicates a paragraph break)
209
+ # block attribute list or block id (bulk query)
189
210
  :attr_line => /^\[([\w\{].*|\[[^\[\]]+\])\]$/,
190
211
 
191
212
  # attribute reference
192
213
  # {foo}
193
214
  # {counter:pcount:1}
194
- :attr_ref => /(\\?)\{(\w|\w[\w\-:]*\w)(\\?)\}/,
215
+ :attr_ref => /(\\?)\{(\w+(?:[\-:]\w+)*)(\\?)\}/,
195
216
 
196
217
  # The author info line the appears immediately following the document title
197
218
  # John Doe <john@anonymous.com>
198
- :author_info => /^\s*(\w[\w\-'\.]*)(?: +(\w[\w\-'\.]*))?(?: +(\w[\w\-'\.]*))?(?: +<([^>]+)>)?\s*$/,
219
+ :author_info => /^\s*(\w[\w\-'.]*)(?: +(\w[\w\-'.]*))?(?: +(\w[\w\-'.]*))?(?: +<([^>]+)>)?$/,
199
220
 
200
221
  # [[[Foo]]] (anywhere inline)
201
- :biblio_macro => /\\?\[\[\[([\w:][\w:\.-]*?)\]\]\]/,
222
+ :biblio_macro => /\\?\[\[\[([\w:][\w:.-]*?)\]\]\]/,
202
223
 
203
224
  # callout reference inside literal text
204
225
  # <1>
@@ -213,10 +234,10 @@ module Asciidoctor
213
234
  # ////
214
235
  # comment block
215
236
  # ////
216
- :comment_blk => %r{^/{4,}\s*$},
237
+ :comment_blk => %r{^/{4,}$},
217
238
 
218
239
  # // (and then whatever)
219
- :comment => %r{^//([^/].*|)$},
240
+ :comment => %r{^//(?:[^/]|$)},
220
241
 
221
242
  # one,two
222
243
  # one, two
@@ -243,7 +264,7 @@ module Asciidoctor
243
264
  ';;' => /^\s*(.*)(;;)(?:[[:blank:]]+(.*))?$/
244
265
  },
245
266
  # ====
246
- :example => /^={4,}\s*$/,
267
+ #:example => /^={4,}$/,
247
268
 
248
269
  # footnote:[text]
249
270
  # footnoteref:[id,text]
@@ -251,7 +272,7 @@ module Asciidoctor
251
272
  :footnote_macro => /\\?(footnote|footnoteref):\[((?:\\\]|[^\]])*?)\]/m,
252
273
 
253
274
  # image::filename.png[Caption]
254
- :image_blk => /^image::(\S+?)\[(.*?)\]\s*$/,
275
+ :image_blk => /^image::(\S+?)\[(.*?)\]$/,
255
276
 
256
277
  # image:filename.png[Alt Text]
257
278
  :image_macro => /\\?image:([^\[]+)(?:\[([^\]]*)\])/,
@@ -274,27 +295,27 @@ module Asciidoctor
274
295
  # + (would not match because there's no space before +)
275
296
  # + (would match and capture '')
276
297
  # Foo + (would and capture 'Foo')
277
- :line_break => /^(.*)[[:blank:]]\+[[:blank:]]*$/,
298
+ :line_break => /^(.*)[[:blank:]]\+$/,
278
299
 
279
300
  # inline link and some inline link macro
280
301
  # FIXME revisit!
281
- :link_inline => %r{(^|link:|\s|>|&lt;|[\(\)\[\]])(\\?https?://[^\s\[<]*[^\s\.\)\[<])(?:\[((?:\\\]|[^\]])*?)\])?},
302
+ :link_inline => %r{(^|link:|\s|>|&lt;|[\(\)\[\]])(\\?(?:https?|ftp)://[^\s\[<]*[^\s.\)\[<])(?:\[((?:\\\]|[^\]])*?)\])?},
282
303
 
283
304
  # inline link macro
284
305
  # link:path[label]
285
306
  :link_macro => /\\?link:([^\s\[]+)(?:\[((?:\\\]|[^\]])*?)\])/,
286
307
 
287
308
  # ----
288
- :listing => /^\-{4,}\s*$/,
309
+ #:listing => /^\-{4,}$/,
289
310
 
290
311
  # ....
291
- :literal => /^\.{4,}\s*$/,
312
+ #:literal => /^\.{4,}$/,
292
313
 
293
314
  # <TAB>Foo or one-or-more-spaces-or-tabs then whatever
294
315
  :lit_par => /^([[:blank:]]+.*)$/,
295
316
 
296
317
  # --
297
- :open_blk => /^\-\-\s*$/,
318
+ #:open_blk => /^\-\-$/,
298
319
 
299
320
  # . Foo (up to 5 consecutive dots)
300
321
  # 1. Foo (arabic, default)
@@ -304,8 +325,12 @@ module Asciidoctor
304
325
  # I. Foo (upperroman)
305
326
  :olist => /^\s*(\d+\.|[a-z]\.|[ivx]+\)|\.{1,5}) +(.*)$/i,
306
327
 
328
+ # ''' (ruler)
329
+ # <<< (pagebreak)
330
+ :break_line => /^('|<){3,}$/,
331
+
307
332
  # ++++
308
- :pass => /^\+{4,}\s*$/,
333
+ #:pass => /^\+{4,}$/,
309
334
 
310
335
  # inline passthrough macros
311
336
  # +++text+++
@@ -325,33 +350,36 @@ module Asciidoctor
325
350
  :pass_placeholder => /\x0(\d+)\x0/,
326
351
 
327
352
  # ____
328
- :quote => /^_{4,}\s*$/,
353
+ #:quote => /^_{4,}$/,
329
354
 
330
355
  # The document revision info line the appears immediately following the
331
356
  # document title author info line, if present
332
357
  # v1.0, 2013-01-01: Ring in the new year release
333
- :revision_info => /^\s*(?:\D*(.*?),)?(?:\s*(.*?))(?:\s*:\s*(.*)\s*)?$/,
358
+ :revision_info => /^(?:\D*(.*?),)?(?:\s*(?!:)(.*?))(?:\s*(?!^):\s*(.*))?$/,
334
359
 
335
360
  # '''
336
- :ruler => /^'{3,}\s*$/,
361
+ #:ruler => /^'{3,}$/,
337
362
 
338
363
  # ****
339
- :sidebar_blk => /^\*{4,}\s*$/,
364
+ #:sidebar_blk => /^\*{4,}$/,
340
365
 
341
366
  # \' within a word
342
367
  :single_quote_esc => /(\w)\\'(\w)/,
343
368
  # an alternative if our backend generated single-quoted html/xml attributes
344
369
  #:single_quote_esc => /(\w|=)\\'(\w)/,
345
370
 
371
+ # used for sanitizing attribute names
372
+ :illegal_attr_name_chars => /[^\w\-]/,
373
+
346
374
  # |===
347
375
  # |table
348
376
  # |===
349
- :table => /^\|={3,}\s*$/,
377
+ #:table => /^\|={3,}$/,
350
378
 
351
379
  # !===
352
380
  # !table
353
381
  # !===
354
- :table_nested => /^!={3,}\s*$/,
382
+ #:table_nested => /^!={3,}$/,
355
383
 
356
384
  # 1*h,2*,^3e
357
385
  :table_colspec => /^(?:(\d+)\*)?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?(\d+)?([a-z])?$/,
@@ -364,7 +392,11 @@ module Asciidoctor
364
392
  },
365
393
 
366
394
  # .Foo but not . Foo or ..Foo
367
- :blk_title => /^\.([^\s\.].*)\s*$/,
395
+ :blk_title => /^\.([^\s.].*)$/,
396
+
397
+ :dbl_quoted => /^("|)(.*)\1$/,
398
+
399
+ :m_dbl_quoted => /^("|)(.*)\1$/m,
368
400
 
369
401
  # == Foo
370
402
  # ^ yields a level 2 title
@@ -379,13 +411,13 @@ module Asciidoctor
379
411
  # match[1] is the delimiter, whose length determines the level
380
412
  # match[2] is the title itself
381
413
  # match[3] is an inline anchor, which becomes the section id
382
- :section_title => /^(={1,5})\s+(\S.*?)\s*(?:\[\[([^\[]+)\]\]\s*)?(?:\s\1)?$/,
414
+ :section_title => /^(={1,5})\s+(\S.*?)(?:\s*\[\[([^\[]+)\]\])?(?:\s+\1)?$/,
383
415
 
384
416
  # does not begin with a dot and has at least one alphanumeric character
385
- :section_name => /^((?=.*\w+.*)[^\.].*?)\s*$/,
417
+ :section_name => /^((?=.*\w+.*)[^.].*?)$/,
386
418
 
387
419
  # ====== || ------ || ~~~~~~ || ^^^^^^ || ++++++
388
- :section_underline => /^([=\-~^\+])+\s*$/,
420
+ :section_underline => /^([=\-~^\+])+$/,
389
421
 
390
422
  # * Foo (up to 5 consecutive asterisks)
391
423
  # - Foo
@@ -398,14 +430,25 @@ module Asciidoctor
398
430
 
399
431
  # ifdef::basebackend-html[]
400
432
  # ifndef::theme[]
401
- :ifdef_macro => /^(ifdef|ifndef)::([^\[]+)\[\]/,
402
-
433
+ # ifeval::["{asciidoctor-version}" >= "0.1.0"]
434
+ # ifdef::asciidoctor[Asciidoctor!]
403
435
  # endif::theme[]
404
436
  # endif::basebackend-html[]
405
- :endif_macro => /^endif::/,
437
+ # endif::[]
438
+ :ifdef_macro => /^[\\]?(ifdef|ifndef|ifeval|endif)::(\S*?(?:([,\+])\S+?)?)\[(.+)?\]$/,
439
+
440
+ # "{asciidoctor-version}" >= "0.1.0"
441
+ :eval_expr => /^(\S.*?)[[:blank:]]*(==|!=|<=|>=|<|>)[[:blank:]]*(\S.*)$/,
442
+ # ...or if we want to be more strict up front about what's on each side
443
+ #:eval_expr => /^(true|false|("|'|)\{\w+(?:\-\w+)*\}\2|("|')[^\3]*\3|\-?\d+(?:\.\d+)*)[[:blank:]]*(==|!=|<=|>=|<|>)[[:blank:]]*(true|false|("|'|)\{\w+(?:\-\w+)*\}\6|("|')[^\7]*\7|\-?\d+(?:\.\d+)*)$/,
406
444
 
407
445
  # include::chapter1.ad[]
408
- :include_macro => /^\\?include::([^\[]+)\[\]\s*\n?\z/
446
+ :include_macro => /^\\?include::([^\[]+)\[\]$/,
447
+
448
+ # http://domain
449
+ # https://domain
450
+ # data:info
451
+ :uri_sniff => /^[[:alpha:]][[:alnum:].+-]*:/i
409
452
  }
410
453
 
411
454
  ADMONITION_STYLES = ['NOTE', 'TIP', 'IMPORTANT', 'WARNING', 'CAUTION']
@@ -508,7 +551,7 @@ module Asciidoctor
508
551
  # (TM)
509
552
  [/(^|[^\\])\(TM\)/, '\1&#8482;'],
510
553
  # foo -- bar
511
- [/(^|\n| )-- /, '&#8201;&#8212;&#8201;'],
554
+ [/(^|\n| )--( |\n|$)/, '&#8201;&#8212;&#8201;'],
512
555
  # foo--bar
513
556
  [/(\w)--(?=\w)/, '\1&#8212;'],
514
557
  # ellipsis
@@ -654,7 +697,7 @@ module Asciidoctor
654
697
 
655
698
  if !File.directory? to_dir
656
699
  if mkdirs
657
- require_library 'fileutils'
700
+ Helpers.require_library 'fileutils'
658
701
  FileUtils.mkdir_p to_dir
659
702
  else
660
703
  raise IOError, "target directory does not exist: #{to_dir}"
@@ -684,29 +727,18 @@ module Asciidoctor
684
727
  Asciidoctor.render(File.new(filename), options, &block)
685
728
  end
686
729
 
687
- # Internal: Prior to invoking Kernel#require, issues a warning urging a
688
- # manual require if running in a threaded environment.
689
- #
690
- # name - the String name of the library to require.
691
- #
692
- # returns false if the library is detected on the load path or the return
693
- # value of delegating to Kernel#require
694
- def self.require_library(name)
695
- if Thread.list.size > 1
696
- main_script = "#{name}.rb"
697
- main_script_path_segment = "/#{name}.rb"
698
- if !$LOADED_FEATURES.detect {|p| p == main_script || p.end_with?(main_script_path_segment) }.nil?
699
- return false
700
- else
701
- warn "WARN: asciidoctor is autoloading '#{name}' in threaded environment. " +
702
- "The use of an explicit require '#{name}' statement is recommended."
703
- end
704
- end
705
- require name
706
- end
730
+ # NOTE still contemplating this method
731
+ #def self.parse_document_header(input, options = {})
732
+ # document = Document.new [], options
733
+ # reader = Reader.new input, document, true
734
+ # Lexer.parse_document_header reader, document
735
+ # document
736
+ #end
707
737
 
708
738
  # modules
739
+ require 'asciidoctor/debug'
709
740
  require 'asciidoctor/substituters'
741
+ require 'asciidoctor/helpers'
710
742
 
711
743
  # abstract classes
712
744
  require 'asciidoctor/abstract_node'
@@ -717,9 +749,8 @@ module Asciidoctor
717
749
  require 'asciidoctor/backends/base_template'
718
750
  require 'asciidoctor/block'
719
751
  require 'asciidoctor/callouts'
720
- require 'asciidoctor/debug'
721
752
  require 'asciidoctor/document'
722
- require 'asciidoctor/errors'
753
+ #require 'asciidoctor/errors'
723
754
  require 'asciidoctor/inline'
724
755
  require 'asciidoctor/lexer'
725
756
  require 'asciidoctor/list_item'
@@ -727,5 +758,7 @@ module Asciidoctor
727
758
  require 'asciidoctor/renderer'
728
759
  require 'asciidoctor/section'
729
760
  require 'asciidoctor/table'
761
+
762
+ # info
730
763
  require 'asciidoctor/version'
731
764
  end
@@ -1,4 +1,5 @@
1
- class Asciidoctor::AbstractBlock < Asciidoctor::AbstractNode
1
+ module Asciidoctor
2
+ class AbstractBlock < AbstractNode
2
3
  # Public: Get the Array of Asciidoctor::AbstractBlock sub-blocks for this block
3
4
  attr_reader :blocks
4
5
 
@@ -15,7 +16,7 @@ class Asciidoctor::AbstractBlock < Asciidoctor::AbstractNode
15
16
  @title = nil
16
17
  if context == :document
17
18
  @level = 0
18
- elsif !parent.nil? && !self.is_a?(Asciidoctor::Section)
19
+ elsif !parent.nil? && !self.is_a?(Section)
19
20
  @level = parent.level
20
21
  else
21
22
  @level = nil
@@ -94,7 +95,7 @@ class Asciidoctor::AbstractBlock < Asciidoctor::AbstractNode
94
95
  #
95
96
  # Returns nothing.
96
97
  def <<(block)
97
- if block.is_a?(Asciidoctor::Section)
98
+ if block.is_a?(Section)
98
99
  assign_index(block)
99
100
  end
100
101
  @blocks << block
@@ -183,7 +184,7 @@ class Asciidoctor::AbstractBlock < Asciidoctor::AbstractNode
183
184
  # returns an Array of Section objects
184
185
  def sections
185
186
  @blocks.inject([]) {|collector, block|
186
- collector << block if block.is_a?(Asciidoctor::Section)
187
+ collector << block if block.is_a?(Section)
187
188
  collector
188
189
  }
189
190
  end
@@ -209,10 +210,11 @@ class Asciidoctor::AbstractBlock < Asciidoctor::AbstractNode
209
210
  def reindex_sections
210
211
  @next_section_index = 0
211
212
  @blocks.each {|block|
212
- if block.is_a?(Asciidoctor::Section)
213
+ if block.is_a?(Section)
213
214
  assign_index(block)
214
215
  block.reindex_sections
215
216
  end
216
217
  }
217
218
  end
218
219
  end
220
+ end