class Paru::PandocFilter::Math

A Math Inline node with the type of math node and the mathematical contents

@!attribute math_type

@return [Hash]
@see http://hackage.haskell.org/package/pandoc-types-1.17.0.4/docs/Text-Pandoc-Definition.html#t:MathType

@!attribute string

@return [String]

Attributes

math_type[RW]
string[RW]

Public Class Methods

new(contents) click to toggle source

Create a new Math node with contents

@param contents [Array] an array with the type and contents

# File lib/paru/filter/math.rb, line 38
def initialize(contents)
    @math_type, @string = contents
end

Public Instance Methods

ast_contents() click to toggle source

Create an AST representation of this Math node

# File lib/paru/filter/math.rb, line 72
def ast_contents()
    [
        @math_type,
        @string
    ]
end
display!() click to toggle source

Make this Math node’s content display as a block

# File lib/paru/filter/math.rb, line 65
def display!()
    @math_type = {
        "t" => "DisplayMath"
    }
end
display?() click to toggle source

Should this math be displayed as a block?

@return [Boolean] true if type is “DisplayMath”

# File lib/paru/filter/math.rb, line 60
def display?()
    "DisplayMath" == @math_type["t"]
end
has_inline?() click to toggle source

Has this Math node inline contents?

@return [Boolean] false

# File lib/paru/filter/math.rb, line 89
def has_inline?()
    false
end
has_string?() click to toggle source

Has this Math node string contents?

@return [Boolean] true

# File lib/paru/filter/math.rb, line 82
def has_string?()
    true
end
inline!() click to toggle source

Convert this Math node’s content to Inline

# File lib/paru/filter/math.rb, line 51
def inline!()
    @math_type = {
        "t" => "InlineMath"
    }
end
inline?() click to toggle source

Is this an inline node?

@return [Boolean] true if math type is “InlineMath”, false

otherwise
# File lib/paru/filter/math.rb, line 46
def inline?()
    "InlineMath" == @math_type["t"]
end