module Asciidoctor::SyntaxHighlighter::Factory
def create name, backend = 'html5', opts = {}
:doc - The Document for which this syntax highlighter was created.
opts - A Hash of options providing information about the context in which this syntax highlighter is used:
backend - The String name of the backend for which this syntax highlighter is being used (default: 'html5').
name - The String name of the syntax highlighter to create.
Public: Resolves the name to a syntax highlighter instance, if found in the registry.
def create name, backend = 'html5', opts = {} if (syntax_hl = self.for name) syntax_hl = syntax_hl.new name, backend, opts if ::Class === syntax_hl raise ::NameError, %(#{syntax_hl.class} must specify a value for `name') unless syntax_hl.name syntax_hl end end
def for name
name - The String name of the syntax highlighter to retrieve.
Public: Retrieves the syntax highlighter class or object registered for the specified name.
def for name registry[name] end
def register syntax_highlighter, *names
Public: Associates the syntax highlighter class or object with the specified names.
def register syntax_highlighter, *names names.each {|name| registry[name] = syntax_highlighter } end
def registry
def registry ::NotImplementedError, %(#{Factory} subclass #{self.class} must implement the ##{__method__} method)