Class: Paru::PandocFilter::Code
- Defined in:
- lib/paru/filter/code.rb
Overview
A Code node, with an attribute object and the code itself as a string.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#ast_contents ⇒ Object
Create an AST representation of this Code node.
-
#has_inline? ⇒ Boolean
Has this code node inline contents?.
-
#has_string? ⇒ Boolean
Has this Code node a string contents?.
-
#initialize(contents) ⇒ Code
constructor
Create a new Code node.
-
#markdown ⇒ String
Get the markdown representation of this Node, including the Node itself.
Constructor Details
Instance Attribute Details
#attr ⇒ Attr
32 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 |
# File 'lib/paru/filter/code.rb', line 32 class Code < Inline attr_accessor :attr, :string # Create a new Code node # # @param contents [Array] an array of the attribute and the code def initialize(contents) @attr = Attr.new contents[0] @string = contents[1] end # Create an AST representation of this Code node. def ast_contents() [ @attr.to_ast, @string ] end # Has this Code node a string contents? # # @return [Boolean] true def has_string?() true end # Has this code node inline contents? # # @return [Boolean] false def has_inline?() false end # Get the markdown representation of this Node, including the Node # itself. # # @return [String] the outer markdown representation of this Node def markdown() super.strip end end |
#string ⇒ String
32 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 |
# File 'lib/paru/filter/code.rb', line 32 class Code < Inline attr_accessor :attr, :string # Create a new Code node # # @param contents [Array] an array of the attribute and the code def initialize(contents) @attr = Attr.new contents[0] @string = contents[1] end # Create an AST representation of this Code node. def ast_contents() [ @attr.to_ast, @string ] end # Has this Code node a string contents? # # @return [Boolean] true def has_string?() true end # Has this code node inline contents? # # @return [Boolean] false def has_inline?() false end # Get the markdown representation of this Node, including the Node # itself. # # @return [String] the outer markdown representation of this Node def markdown() super.strip end end |
Instance Method Details
#ast_contents ⇒ Object
Create an AST representation of this Code node.
44 45 46 47 48 49 |
# File 'lib/paru/filter/code.rb', line 44 def ast_contents() [ @attr.to_ast, @string ] end |
#has_inline? ⇒ Boolean
Has this code node inline contents?
61 62 63 |
# File 'lib/paru/filter/code.rb', line 61 def has_inline?() false end |
#has_string? ⇒ Boolean
Has this Code node a string contents?
54 55 56 |
# File 'lib/paru/filter/code.rb', line 54 def has_string?() true end |
#markdown ⇒ String
Get the markdown representation of this Node, including the Node itself.
69 70 71 |
# File 'lib/paru/filter/code.rb', line 69 def markdown() super.strip end |