Class: Giblish::PdfMathPostbuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/giblish/layout_config/pdf_layout_config.rb

Overview

AIDEV-NOTE: Combined docattr provider and post-processor for asciidoctor-mathematical

Instance Method Summary collapse

Instance Method Details

#document_attributes(src_node, dst_node, dst_top) ⇒ Hash{String => String}

Provides document attributes for mathematical formula rendering.

Parameters:

  • src_node (Gran::PathTree::Node)

    Source node

  • dst_node (Gran::PathTree::Node)

    Destination node

  • dst_top (Pathname)

    Destination top directory

Returns:

  • (Hash{String => String})

    Document attributes



30
31
32
# File 'lib/giblish/layout_config/pdf_layout_config.rb', line 30

def document_attributes(src_node, dst_node, dst_top)
  {"mathematical-format" => "svg"}
end

#on_postbuild(src_topdir, dst_tree, converter) ⇒ void

This method returns an undefined value.

Cleans up temporary SVG files created by asciidoctor-mathematical.

Parameters:

  • src_topdir (Gran::PathTree)

    Source tree root

  • dst_tree (Gran::PathTree)

    Destination tree

  • converter (TreeConverter)

    Converter instance



14
15
16
17
18
19
20
21
22
# File 'lib/giblish/layout_config/pdf_layout_config.rb', line 14

def on_postbuild(src_topdir, dst_tree, converter)
  dst_top = src_topdir.pathname
  dst_top.each_child do |c|
    if c.basename.to_s.match?(/^stem-[0-9a-f]*\.svg$/)
      Giblog.logger.debug("will remove #{c}")
      c.delete
    end
  end
end