File: document.rb

package info (click to toggle)
ruby-maruku 0.7.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 1,304 kB
  • sloc: ruby: 5,741; xml: 235; makefile: 2
file content (44 lines) | stat: -rw-r--r-- 1,033 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
module MaRuKu
  # This represents the whole document and holds global data.
  class MDDocument # < MDElement
    # @return [{String => {:url => String, :title => String}}]
    attr_accessor :refs

    # @return [{String => MDElement}]
    attr_accessor :footnotes

    # @return [{String => String}]
    attr_accessor :abbreviations

    # Attribute definition lists.
    #
    # @return [{String => AttributeList}]
    attr_accessor :ald

    # The order in which footnotes are used. Contains the id.
    #
    # @return [Array<String>]
    attr_accessor :footnotes_order

    # @return [{String => {String => MDElement}}]
    attr_accessor :refid2ref

    # A counter for generating unique IDs [Integer]
    attr_accessor :id_counter

    def initialize(s=nil)
      super(:document)

      self.doc = self
      self.refs = {}
      self.footnotes = {}
      self.footnotes_order = []
      self.abbreviations = {}
      self.ald = {}
      self.refid2ref = {}
      self.id_counter = 0

      parse_doc(s) if s
    end
  end
end