Class: Paru::PandocFilter::Plain

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

Overview

A Plain node is a basic Block level node with Inline child nodes. Not to be confused with Para, which represents a paragraph. A Plain is a more general type of block level node.

Instance Method Summary collapse

Constructor Details

#initialize(contents) ⇒ Plain

Create a new Plain node based on contents

Parameters:

  • contents (Array)


33
34
35
# File 'lib/paru/filter/plain.rb', line 33

def initialize(contents)
    super contents, true
end

Instance Method Details

#has_inline?Boolean

Has a Plain node inline contents?

Returns:

  • (Boolean)

    true



40
41
42
# File 'lib/paru/filter/plain.rb', line 40

def has_inline?
    true
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