Module: Asciidoctor::Reducer::Extensions

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

Class Method Summary collapse

Class Method Details

.groupObject



14
15
16
17
18
19
20
21
22
# File 'lib/asciidoctor/reducer/extensions.rb', line 14

def group
  proc do
    document.extend HeaderAttributeTracker
    next if document.options[:reduced] # group invoked again if includes are found and sourcemap option is true
    preprocessor Preprocessor
    tree_processor TreeProcessor
    nil
  end
end

.keyObject



24
25
26
# File 'lib/asciidoctor/reducer/extensions.rb', line 24

def key
  :reducer
end

.prepare_registry(registry = nil) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/asciidoctor/reducer/extensions.rb', line 28

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

.register(registry = nil) ⇒ Object



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

def register registry = nil
  (registry || ::Asciidoctor::Extensions).groups[key] ||= group
end

.unregister(registry = nil) ⇒ Object



43
44
45
46
# File 'lib/asciidoctor/reducer/extensions.rb', line 43

def unregister registry = nil
  (registry || ::Asciidoctor::Extensions).groups.delete key
  nil
end