class Paru::PandocFilter::Citation
A Citation
consists of an id, a prefix, a suffix, a mode, a note number, and integer hash. All of which are optional.
@see hackage.haskell.org/package/pandoc-types-1.17.0.5/docs/Text-Pandoc-Definition.html#t:Citation
@!attribute id
@return [String]
@!attribute prefix
@return [Array<Inline>]
@!attribute suffix
@return [Array<Inline>]
@!attribute mode
@return [String]
@!attribute note_num
@return [Integer]
@!attribute hash
@return [Integer]
Attributes
Public Class Methods
Source
# File lib/paru/filter/citation.rb, line 51 def initialize(spec) @id = spec["citationId"] if spec.has_key? "citationId" @prefix = Inline.new spec["citationPrefix"] if spec.has_key? "citationPrefix" @suffix = Inline.new spec["citationSuffix"] if spec.has_key? "citationSuffix" @mode = spec["citationMode"] if spec.has_key? "citationMode" @note_num = spec["citationNoteNum"] if spec.has_key? "citationNoteNum" @hash = spec["citationHash"] if spec.has_key? "citationHash" end
Create a new Citation
node base on an AST specification
@param spec [Hash] the specification of this citation
Public Instance Methods
Source
# File lib/paru/filter/citation.rb, line 61 def to_ast() citation = Hash.new citation["citationId"] = @id if not @id.nil? citation["citationPrefix"] = @prefix.ast_contents if not @prefix.nil? citation["citationSuffix"] = @suffix.ast_contents if not @suffix.nil? citation["citationMode"] = @mode if not @mode.nil? citation["citationNoteNum"] = @note_num if not @note_num.nil? citation["citationHash"] = @hash if not @hash.nil? citation end
Convert this Citation
to an AST representation