Class: Paru::PandocFilter::MetaValue

Inherits:
Node
  • Object
show all
Includes:
InnerMarkdown
Defined in:
lib/paru/filter/meta_value.rb

Overview

A MetaValue Node is either a MetaMap, MetaList, MetaBool, MetaString, MetaInlines, or a MetaBlocks.

Direct Known Subclasses

MetaBool, MetaString

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ MetaValue

Create a new MetaValue Node based on the value

Parameters:

  • value (String)


38
39
40
# File 'lib/paru/filter/meta_value.rb', line 38

def initialize(value)
    @value = value
end

Instance Attribute Details

#valueString|Boolean

Returns:

  • (String|Boolean)


30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/paru/filter/meta_value.rb', line 30

class MetaValue < Node
    include InnerMarkdown

    attr_accessor :value

    # Create a new MetaValue Node based on the value
    # 
    # @param value [String]
    def initialize(value)
        @value = value
    end

    # The AST contents
    def ast_contents()
        @value
    end

end

Instance Method Details

#ast_contentsObject

The AST contents



43
44
45
# File 'lib/paru/filter/meta_value.rb', line 43

def ast_contents()
    @value
end

#inner_markdownString Originally defined in module InnerMarkdown

Get the markdown representation of this Node's children.

Examples:

Replace all occurrences of “hello” by “world” in all paragraphs

Paru::Filter.run do
    with "Para" do |p|
        p.inner_markdown = p.inner_markdown.gsub "hello", "world"
    end
end         

Returns:

  • (String)

    the inner markdown representation of this Node

#inner_markdown=(markdown) ⇒ Object Originally defined in module InnerMarkdown

Replace this Node's children with the Nodes represented by the markdown string

Examples:

Replace all occurrences of “hello” by “world” in all paragraphs

Paru::Filter.run do
    with "Para" do |p|
        p.inner_markdown = p.inner_markdown.gsub "hello", "world"
    end
end         

Parameters:

  • markdown (String)

    the markdown string to replace this Node's children