Module: Asciidoctor::Reducer::Extensions

Defined in:
lib/asciidoctor/reducer/extensions.rb

Class Method Summary collapse

Class Method Details

.groupObject



11
12
13
14
15
16
17
# File 'lib/asciidoctor/reducer/extensions.rb', line 11

def group
  proc do
    next if document.options[:reduced]
    preprocessor Preprocessor
    tree_processor TreeProcessor
  end
end

.keyObject



19
20
21
# File 'lib/asciidoctor/reducer/extensions.rb', line 19

def key
  :reducer
end

.prepare_registry(registry = nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/asciidoctor/reducer/extensions.rb', line 23

def prepare_registry registry = nil
  registry = ::Asciidoctor::Extensions.create(&registry) if ::Proc === registry
  return registry if ::Asciidoctor::Extensions.groups[key]
  if registry
    registry.groups[key] = group
    registry
  else
    ::Asciidoctor::Extensions.create key, &group
  end
end

.registerObject



34
35
36
# File 'lib/asciidoctor/reducer/extensions.rb', line 34

def register
  ::Asciidoctor::Extensions.register key, &group
end

.unregisterObject



38
39
40
# File 'lib/asciidoctor/reducer/extensions.rb', line 38

def unregister
  ::Asciidoctor::Extensions.groups.delete key # NOTE `Extensions.unregister key` fails if groups is not initialized
end