Class: Neo4j::AsciidoctorExtensions::CypherSyntaxRoleTreeProcessor

Inherits:
Extensions::TreeProcessor
  • Object
show all
Defined in:
lib/neo4j/asciidoctor/extensions/cypher_syntax_role/extension.rb

Overview

A tree processor that adds a role on code blocks using “cypher-syntax” as a language.

Usage:

[source,cypher-syntax]
----
()
(p)
(l)
(n)
----

Instance Method Summary collapse

Instance Method Details

#process(document) ⇒ Object



25
26
27
28
29
30
# File 'lib/neo4j/asciidoctor/extensions/cypher_syntax_role/extension.rb', line 25

def process(document)
  document.find_by(context: :listing) { |block| block.attr('language') == 'cypher-syntax' }.each do |block|
    block.add_role('syntax')
  end
  document
end