• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2018-2024 The Khronos Group Inc.
2#
3# SPDX-License-Identifier: Apache-2.0
4
5require 'asciidoctor/extensions'
6
7# This script makes [latexmath] blocks work within table cells.
8# See https://github.com/asciidoctor/asciidoctor-pdf/issues/740
9
10Asciidoctor::Extensions.register do
11  treeprocessor do
12    process do |doc|
13      mathematicalProcessor = MathematicalTreeprocessor.new
14      (table_blocks = doc.find_by context: :table).each do |table|
15        (table.rows[:body] + table.rows[:foot]).each do |row|
16          row.each do |cell|
17            mathematicalProcessor.process cell.inner_document if cell.style == :asciidoc
18          end
19        end
20      end
21    end
22  end
23end
24