Class: Paru::PandocFilter::Header
- Includes:
- InnerMarkdown
- Defined in:
- lib/paru/filter/header.rb
Overview
A Header node has a level, an attribute object and the contents of the header as a list on Inline nodes.
Instance Attribute Summary collapse
Attributes inherited from Node
Instance Method Summary collapse
-
#ast_contents ⇒ Object
Create an AST representation of this Header node.
-
#has_inline? ⇒ Boolean
Has this Header node inline contents?.
-
#initialize(contents) ⇒ Header
constructor
Create a new Header node.
Methods included from InnerMarkdown
#inner_markdown, #inner_markdown=
Methods inherited from Block
Methods inherited from Node
#ast_type, #can_act_as_both_block_and_inline?, #each, from_markdown, #get_replacement, #has_been_replaced?, #has_block?, #has_children?, #has_class?, #has_parent?, #has_string?, #is_block?, #is_inline?, #is_leaf?, #is_node?, #is_root?, #markdown, #markdown=, #toMetadata, #to_ast, #to_s, #type
Methods included from ASTManipulation
#append, #delete, #each_depth_first, #find_index, #get, #insert, #prepend, #remove_at, #replace, #replace_at
Constructor Details
#initialize(contents) ⇒ Header
Create a new Header node
44 45 46 47 48 |
# File 'lib/paru/filter/header.rb', line 44 def initialize(contents) @level = contents[0] @attr = Attr.new contents[1] super(contents[2], true) end |
Instance Attribute Details
#attr ⇒ Attr
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 |
# File 'lib/paru/filter/header.rb', line 35 class Header < Block include InnerMarkdown attr_accessor :level, :attr # Create a new Header node # # @param contents [Array] an array with the level, attribute, and # the header contents def initialize(contents) @level = contents[0] @attr = Attr.new contents[1] super(contents[2], true) end # Create an AST representation of this Header node def ast_contents [ @level, @attr.to_ast, super ] end # Has this Header node inline contents? # # @return [Boolean] true def has_inline? true end end |
#level ⇒ Integer
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 |
# File 'lib/paru/filter/header.rb', line 35 class Header < Block include InnerMarkdown attr_accessor :level, :attr # Create a new Header node # # @param contents [Array] an array with the level, attribute, and # the header contents def initialize(contents) @level = contents[0] @attr = Attr.new contents[1] super(contents[2], true) end # Create an AST representation of this Header node def ast_contents [ @level, @attr.to_ast, super ] end # Has this Header node inline contents? # # @return [Boolean] true def has_inline? true end end |
Instance Method Details
#ast_contents ⇒ Object
Create an AST representation of this Header node
51 52 53 54 55 56 57 |
# File 'lib/paru/filter/header.rb', line 51 def ast_contents [ @level, @attr.to_ast, super ] end |
#has_inline? ⇒ Boolean
Has this Header node inline contents?
62 63 64 |
# File 'lib/paru/filter/header.rb', line 62 def has_inline? true end |