Method: Paru::PandocFilter::Math#string

Defined in:
lib/paru/filter/math.rb,
lib/paru/filter/math.rb

#stringString

Returns:

  • (String)


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/paru/filter/math.rb', line 34

class Math < Inline
  attr_accessor :math_type, :string

  # Create a new Math node with contents
  #
  # @param contents [Array] an array with the type and contents
  def initialize(contents)
    @math_type, @string = contents
  end

  # Is this an inline node?
  #
  # @return [Boolean] true if math type is "InlineMath", false
  #   otherwise
  def inline?
    @math_type['t'] == 'InlineMath'
  end

  # Convert this Math node's content to Inline
  def inline!
    @math_type = {
      't' => 'InlineMath'
    }
  end

  # Should this math be displayed as a block?
  #
  # @return [Boolean] true if type is "DisplayMath"
  def display?
    @math_type['t'] == 'DisplayMath'
  end

  # Make this Math node's content display as a block
  def display!
    @math_type = {
      't' => 'DisplayMath'
    }
  end

  # Create an AST representation of this Math node
  def ast_contents
    [
      @math_type,
      @string
    ]
  end

  # Has this Math node string contents?
  #
  # @return [Boolean] true
  def has_string?
    true
  end

  # Has this Math node inline contents?
  #
  # @return [Boolean] false
  def has_inline?
    false
  end
end