Class: Paru::PandocFilter::ListAttributes

Inherits:
Object
  • Object
show all
Defined in:
lib/paru/filter/list_attributes.rb

Overview

ListAttributes represent the attributes of a list.

Constant Summary collapse

STYLES =

The various styles of list numbers

[
    "DefaultStyle", 
    "Example", 
    "Decimal", 
    "LowerRoman", 
    "UpperRoman", 
    "LowerAlpha", 
    "UpperAlpha"
]
DELIMS =

The various delimeters of list numbers

[
    "DefaultDelim", 
    "Period", 
    "OneParen", 
    "TwoParens"
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ ListAttributes

Create a new ListAttribute object with attributes

Parameters:

  • attributes (Array)

    an array with start, number style, and number delimeter



60
61
62
63
64
# File 'lib/paru/filter/list_attributes.rb', line 60

def initialize(attributes)
    @start = attributes[0]
    @number_style = attributes[1]
    @number_delim = attributes[2]
end

Instance Attribute Details

#number_delimDELIMS

Returns:



33
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
# File 'lib/paru/filter/list_attributes.rb', line 33

class ListAttributes
    
    # The various styles of list numbers
    STYLES = [
        "DefaultStyle", 
        "Example", 
        "Decimal", 
        "LowerRoman", 
        "UpperRoman", 
        "LowerAlpha", 
        "UpperAlpha"
    ]

    # The various delimeters of list numbers
    DELIMS = [
        "DefaultDelim", 
        "Period", 
        "OneParen", 
        "TwoParens"
    ]

    attr_accessor :start, :number_style, :number_delim

    # Create a new ListAttribute object with attributes
    #
    # @param attributes [Array] an array with start, number style, and
    #   number delimeter
    def initialize(attributes)
        @start = attributes[0]
        @number_style = attributes[1]
        @number_delim = attributes[2]
    end

    # Create an AST representation of this ListAttributes object
    def to_ast()
        [
            @start,
            @number_style,
            @number_delim
        ]
    end
end

#number_styleSTYLES

Returns:



33
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
# File 'lib/paru/filter/list_attributes.rb', line 33

class ListAttributes
    
    # The various styles of list numbers
    STYLES = [
        "DefaultStyle", 
        "Example", 
        "Decimal", 
        "LowerRoman", 
        "UpperRoman", 
        "LowerAlpha", 
        "UpperAlpha"
    ]

    # The various delimeters of list numbers
    DELIMS = [
        "DefaultDelim", 
        "Period", 
        "OneParen", 
        "TwoParens"
    ]

    attr_accessor :start, :number_style, :number_delim

    # Create a new ListAttribute object with attributes
    #
    # @param attributes [Array] an array with start, number style, and
    #   number delimeter
    def initialize(attributes)
        @start = attributes[0]
        @number_style = attributes[1]
        @number_delim = attributes[2]
    end

    # Create an AST representation of this ListAttributes object
    def to_ast()
        [
            @start,
            @number_style,
            @number_delim
        ]
    end
end

#startInteger

Returns:

  • (Integer)


33
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
# File 'lib/paru/filter/list_attributes.rb', line 33

class ListAttributes
    
    # The various styles of list numbers
    STYLES = [
        "DefaultStyle", 
        "Example", 
        "Decimal", 
        "LowerRoman", 
        "UpperRoman", 
        "LowerAlpha", 
        "UpperAlpha"
    ]

    # The various delimeters of list numbers
    DELIMS = [
        "DefaultDelim", 
        "Period", 
        "OneParen", 
        "TwoParens"
    ]

    attr_accessor :start, :number_style, :number_delim

    # Create a new ListAttribute object with attributes
    #
    # @param attributes [Array] an array with start, number style, and
    #   number delimeter
    def initialize(attributes)
        @start = attributes[0]
        @number_style = attributes[1]
        @number_delim = attributes[2]
    end

    # Create an AST representation of this ListAttributes object
    def to_ast()
        [
            @start,
            @number_style,
            @number_delim
        ]
    end
end

Instance Method Details

#to_astObject

Create an AST representation of this ListAttributes object



67
68
69
70
71
72
73
# File 'lib/paru/filter/list_attributes.rb', line 67

def to_ast()
    [
        @start,
        @number_style,
        @number_delim
    ]
end