Module: DatoDast

Defined in:
lib/dato_dast.rb,
lib/dato_dast/marks.rb,
lib/dato_dast/nodes.rb,
lib/dato_dast/version.rb,
lib/dato_dast/html_tag.rb,
lib/dato_dast/nodes/base.rb,
lib/dato_dast/nodes/code.rb,
lib/dato_dast/nodes/item.rb,
lib/dato_dast/nodes/link.rb,
lib/dato_dast/nodes/list.rb,
lib/dato_dast/nodes/root.rb,
lib/dato_dast/nodes/span.rb,
lib/dato_dast/nodes/block.rb,
lib/dato_dast/configuration.rb,
lib/dato_dast/nodes/generic.rb,
lib/dato_dast/nodes/heading.rb,
lib/dato_dast/nodes/item_link.rb,
lib/dato_dast/nodes/list_item.rb,
lib/dato_dast/nodes/paragraph.rb,
lib/dato_dast/nodes/blockquote.rb,
lib/dato_dast/nodes/inline_item.rb,
lib/dato_dast/errors/field_missing.rb,
lib/dato_dast/errors/invalid_nodes.rb,
lib/dato_dast/extensions/middleman.rb,
lib/dato_dast/nodes/thematic_break.rb,
lib/dato_dast/nodes/attributed_quote.rb,
lib/dato_dast/errors/invalid_structure_type.rb,
lib/dato_dast/errors/missing_render_function.rb,
lib/dato_dast/errors/missing_item_configuration.rb,
lib/dato_dast/errors/invalid_items_configuration.rb,
lib/dato_dast/errors/invalid_marks_configuration.rb,
lib/dato_dast/errors/invalid_types_configuration.rb,
lib/dato_dast/errors/missing_render_value_function.rb

Defined Under Namespace

Modules: Errors, Extensions, Nodes Classes: Configuration, HtmlTag, Marks

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.configurationObject



15
16
17
# File 'lib/dato_dast.rb', line 15

def self.configuration
  @configuration ||= DatoDast::Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



19
20
21
# File 'lib/dato_dast.rb', line 19

def self.configure
  yield configuration
end

.reset_configurationObject



23
24
25
# File 'lib/dato_dast.rb', line 23

def self.reset_configuration
  @configuration = DatoDast::Configuration.new
end

.structured_text(item, config = nil) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/dato_dast.rb', line 27

def self.structured_text(item, config = nil)
  object = item.to_hash
  document = object[:value]["document"]
  links = object[:links]
  blocks = object[:blocks]

  Nodes.wrap(document, links, blocks, config).render
end