Vulkan-Docs/config/asciidoctor-mathematical-ext.rb
Jon Leech 9a8314cd41 Restructure the repository to put the specification Makefile and
associated material at the top level, vk.xml and associated material in
xml/, and generated include and source files in include/vulkan/ and
src/ext_loader/, respectively (public issue 436).
2018-04-04 23:08:43 -07:00

20 lines
600 B
Ruby

require 'asciidoctor/extensions'
# This script makes [latexmath] blocks work within table cells.
# See https://github.com/asciidoctor/asciidoctor-pdf/issues/740
Asciidoctor::Extensions.register do
treeprocessor do
process do |doc|
mathematicalProcessor = MathematicalTreeprocessor.new
(table_blocks = doc.find_by context: :table).each do |table|
(table.rows[:body] + table.rows[:foot]).each do |row|
row.each do |cell|
mathematicalProcessor.process cell.inner_document if cell.style == :asciidoc
end
end
end
end
end
end