Almirah 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/almirah/doc_fabric.rb +200 -0
 - data/lib/almirah/doc_items/blockquote.rb +2 -2
 - data/lib/almirah/doc_items/controlled_paragraph.rb +20 -13
 - data/lib/almirah/doc_items/controlled_table.rb +172 -0
 - data/lib/almirah/doc_items/controlled_table_row.rb +23 -0
 - data/lib/almirah/doc_items/heading.rb +2 -2
 - data/lib/almirah/doc_items/image.rb +1 -1
 - data/lib/almirah/doc_items/markdown_list.rb +4 -4
 - data/lib/almirah/doc_items/markdown_table.rb +19 -8
 - data/lib/almirah/doc_types/base_document.rb +18 -0
 - data/lib/almirah/doc_types/protocol.rb +22 -0
 - data/lib/almirah/doc_types/specification.rb +22 -0
 - data/lib/almirah/html_render.rb +4 -5
 - data/lib/almirah/navigation_pane.rb +2 -4
 - data/lib/almirah/project.rb +111 -23
 - data/lib/almirah/templates/page.html +1 -1
 - data/lib/almirah.rb +20 -6
 - metadata +8 -3
 - data/lib/almirah/specification.rb +0 -194
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 877a4c7b296af5fa0418113a4287df82661d23903764f73a74b8794d2be22d9a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 4195b1434e0ca4c75177c4af9ea3e97ffa9a373106bda58fa11621ba273df7cf
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4425611cadee99f5686c79abbc853d93bbfeb0e729a97168f93842d998daf8e1a879de8e25918fcbd01bd49abe2b842cc192f24d137cd987d77816f606abed15
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: ca609c497ebde13428c516a0369f860c323f7bcaba740424d125b9a3c4bd2e1955f8f8aec665d6afd088cc44772c4edfaba5dc64f47827be631253111f82a446
         
     | 
| 
         @@ -0,0 +1,200 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_relative "doc_types/base_document"
         
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative "doc_types/specification"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require_relative "doc_types/protocol"
         
     | 
| 
      
 5 
     | 
    
         
            +
            #
         
     | 
| 
      
 6 
     | 
    
         
            +
            require_relative "doc_items/doc_item"
         
     | 
| 
      
 7 
     | 
    
         
            +
            require_relative "doc_items/heading"
         
     | 
| 
      
 8 
     | 
    
         
            +
            require_relative "doc_items/paragraph"
         
     | 
| 
      
 9 
     | 
    
         
            +
            require_relative "doc_items/blockquote"
         
     | 
| 
      
 10 
     | 
    
         
            +
            require_relative "doc_items/controlled_paragraph"
         
     | 
| 
      
 11 
     | 
    
         
            +
            require_relative "doc_items/markdown_table"
         
     | 
| 
      
 12 
     | 
    
         
            +
            require_relative "doc_items/controlled_table"
         
     | 
| 
      
 13 
     | 
    
         
            +
            require_relative "doc_items/image"
         
     | 
| 
      
 14 
     | 
    
         
            +
            require_relative "doc_items/markdown_list"
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            class DocFabric
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                def self.create_specification(path)
         
     | 
| 
      
 19 
     | 
    
         
            +
                    doc = Specification.new path
         
     | 
| 
      
 20 
     | 
    
         
            +
                    DocFabric.parse_document doc
         
     | 
| 
      
 21 
     | 
    
         
            +
                    return doc
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                def self.create_protocol(path)
         
     | 
| 
      
 25 
     | 
    
         
            +
                    doc = Protocol.new path
         
     | 
| 
      
 26 
     | 
    
         
            +
                    DocFabric.parse_document doc
         
     | 
| 
      
 27 
     | 
    
         
            +
                    return doc
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                def self.parse_document(doc)
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                    tempMdTable = nil
         
     | 
| 
      
 33 
     | 
    
         
            +
                    tempMdList = nil
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                    file = File.open( doc.path )
         
     | 
| 
      
 36 
     | 
    
         
            +
                    file_lines = file.readlines     
         
     | 
| 
      
 37 
     | 
    
         
            +
                    file.close
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                    file_lines.each do |s|
         
     | 
| 
      
 40 
     | 
    
         
            +
                        if s.lstrip != ""
         
     | 
| 
      
 41 
     | 
    
         
            +
                            if res = /^([#]{1,})\s(.*)/.match(s)     # Heading    
         
     | 
| 
      
 42 
     | 
    
         
            +
                                
         
     | 
| 
      
 43 
     | 
    
         
            +
                                if tempMdTable
         
     | 
| 
      
 44 
     | 
    
         
            +
                                    doc.items.append tempMdTable
         
     | 
| 
      
 45 
     | 
    
         
            +
                                    tempMdTable = nil
         
     | 
| 
      
 46 
     | 
    
         
            +
                                end
         
     | 
| 
      
 47 
     | 
    
         
            +
                                if  tempMdList
         
     | 
| 
      
 48 
     | 
    
         
            +
                                    doc.items.append tempMdList
         
     | 
| 
      
 49 
     | 
    
         
            +
                                    tempMdList = nil
         
     | 
| 
      
 50 
     | 
    
         
            +
                                end 
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                                level = res[1].length
         
     | 
| 
      
 53 
     | 
    
         
            +
                                value = res[2]
         
     | 
| 
      
 54 
     | 
    
         
            +
                                item = Heading.new(value, level)
         
     | 
| 
      
 55 
     | 
    
         
            +
                                doc.items.append(item)
         
     | 
| 
      
 56 
     | 
    
         
            +
                                doc.headings.append(item)
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                                if level == 1 && doc.title == ""
         
     | 
| 
      
 59 
     | 
    
         
            +
                                    doc.title = value
         
     | 
| 
      
 60 
     | 
    
         
            +
                                end   
         
     | 
| 
      
 61 
     | 
    
         
            +
                                    
         
     | 
| 
      
 62 
     | 
    
         
            +
                            elsif res = /^\[(\S*)\]\s+(.*)/.match(s)     # Controlled Paragraph
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                                if tempMdTable
         
     | 
| 
      
 65 
     | 
    
         
            +
                                    doc.items.append tempMdTable
         
     | 
| 
      
 66 
     | 
    
         
            +
                                    tempMdTable = nil
         
     | 
| 
      
 67 
     | 
    
         
            +
                                end
         
     | 
| 
      
 68 
     | 
    
         
            +
                                if tempMdList
         
     | 
| 
      
 69 
     | 
    
         
            +
                                    doc.items.append tempMdList
         
     | 
| 
      
 70 
     | 
    
         
            +
                                    tempMdList = nil
         
     | 
| 
      
 71 
     | 
    
         
            +
                                end 
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                                id = res[1]
         
     | 
| 
      
 74 
     | 
    
         
            +
                                text = res[2]
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                                #check if it contains the uplink
         
     | 
| 
      
 77 
     | 
    
         
            +
                                if tmp = /(.*)\s+>\[(\S*)\]$/.match(text)           # >[SRS-001]
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                                    text = tmp[1]
         
     | 
| 
      
 80 
     | 
    
         
            +
                                    up_link = tmp[2]
         
     | 
| 
      
 81 
     | 
    
         
            +
                                    
         
     | 
| 
      
 82 
     | 
    
         
            +
                                    if tmp = /^([a-zA-Z]+)[-]\d+/.match(up_link)    # SRS
         
     | 
| 
      
 83 
     | 
    
         
            +
                                        doc.up_link_doc_id = tmp[1].downcase
         
     | 
| 
      
 84 
     | 
    
         
            +
                                    end
         
     | 
| 
      
 85 
     | 
    
         
            +
                                end
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                                item = ControlledParagraph.new( text, id )
         
     | 
| 
      
 88 
     | 
    
         
            +
                                item.up_link = up_link
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                                doc.items.append(item)
         
     | 
| 
      
 91 
     | 
    
         
            +
                                doc.dictionary[ id.to_s ] = item       #for fast search
         
     | 
| 
      
 92 
     | 
    
         
            +
                                doc.controlled_items.append(item)      #for fast search
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
                            elsif res = /^[!]\[(.*)\]\((.*)\)/.match(s)     # Image
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
                                if tempMdTable
         
     | 
| 
      
 97 
     | 
    
         
            +
                                    doc.items.append tempMdTable
         
     | 
| 
      
 98 
     | 
    
         
            +
                                    tempMdTable = nil
         
     | 
| 
      
 99 
     | 
    
         
            +
                                end
         
     | 
| 
      
 100 
     | 
    
         
            +
                                if tempMdList
         
     | 
| 
      
 101 
     | 
    
         
            +
                                    doc.items.append tempMdList
         
     | 
| 
      
 102 
     | 
    
         
            +
                                    tempMdList = nil
         
     | 
| 
      
 103 
     | 
    
         
            +
                                end
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
                                img_text = res[1]
         
     | 
| 
      
 106 
     | 
    
         
            +
                                img_path = res[2]
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
                                item = Image.new( img_text, img_path )
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                                doc.items.append(item)
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
                            elsif res = /^(\*\s?)+(.*)/.match(s)   #check if bullet list
         
     | 
| 
      
 113 
     | 
    
         
            +
                                
         
     | 
| 
      
 114 
     | 
    
         
            +
                                if tempMdTable
         
     | 
| 
      
 115 
     | 
    
         
            +
                                    doc.items.append tempMdTable
         
     | 
| 
      
 116 
     | 
    
         
            +
                                    tempMdTable = nil
         
     | 
| 
      
 117 
     | 
    
         
            +
                                end
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
                                row = res[2]
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
                                if tempMdList
         
     | 
| 
      
 122 
     | 
    
         
            +
                                    tempMdList.addRow(row)
         
     | 
| 
      
 123 
     | 
    
         
            +
                                else
         
     | 
| 
      
 124 
     | 
    
         
            +
                                    item = MarkdownList.new(row)
         
     | 
| 
      
 125 
     | 
    
         
            +
                                    tempMdList = item
         
     | 
| 
      
 126 
     | 
    
         
            +
                                end
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
                            elsif s[0] == '|'   #check if table
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
                                if tempMdList
         
     | 
| 
      
 131 
     | 
    
         
            +
                                    doc.items.append tempMdList
         
     | 
| 
      
 132 
     | 
    
         
            +
                                    tempMdList = nil
         
     | 
| 
      
 133 
     | 
    
         
            +
                                end
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
                                if res = /^[|](-{3,})[|]/.match(s) #check if it is a separator first
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
                                    if tempMdTable 
         
     | 
| 
      
 138 
     | 
    
         
            +
                                        #separator is found after heading - just skip it
         
     | 
| 
      
 139 
     | 
    
         
            +
                                    else
         
     | 
| 
      
 140 
     | 
    
         
            +
                                        #separator out of table scope consider it just as a regular paragraph
         
     | 
| 
      
 141 
     | 
    
         
            +
                                        item = Paragraph.new(s)
         
     | 
| 
      
 142 
     | 
    
         
            +
                                        doc.items.append(item)
         
     | 
| 
      
 143 
     | 
    
         
            +
                                    end
         
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
      
 145 
     | 
    
         
            +
                                elsif res = /^[|](.*[|])/.match(s) #check if it looks as a table
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
                                    row = res[1]
         
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
                                    if tempMdTable
         
     | 
| 
      
 150 
     | 
    
         
            +
                                        # check if it is a controlled table
         
     | 
| 
      
 151 
     | 
    
         
            +
                                        unless tempMdTable.addRow(row)
         
     | 
| 
      
 152 
     | 
    
         
            +
                                            tempMdTable = ControlledTable.new(tempMdTable, doc)
         
     | 
| 
      
 153 
     | 
    
         
            +
                                            tempMdTable.addRow(row)
         
     | 
| 
      
 154 
     | 
    
         
            +
                                        end
         
     | 
| 
      
 155 
     | 
    
         
            +
                                    else
         
     | 
| 
      
 156 
     | 
    
         
            +
                                        #start table from heading
         
     | 
| 
      
 157 
     | 
    
         
            +
                                        tempMdTable = MarkdownTable.new(row)
         
     | 
| 
      
 158 
     | 
    
         
            +
                                    end
         
     | 
| 
      
 159 
     | 
    
         
            +
                                end
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
                            elsif res = /^[>](.*)/.match(s)   #check if blockquote
         
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
| 
      
 163 
     | 
    
         
            +
                                if tempMdTable
         
     | 
| 
      
 164 
     | 
    
         
            +
                                    doc.items.append tempMdTable
         
     | 
| 
      
 165 
     | 
    
         
            +
                                    tempMdTable = nil
         
     | 
| 
      
 166 
     | 
    
         
            +
                                end
         
     | 
| 
      
 167 
     | 
    
         
            +
                                if tempMdList
         
     | 
| 
      
 168 
     | 
    
         
            +
                                    doc.items.append tempMdList
         
     | 
| 
      
 169 
     | 
    
         
            +
                                    tempMdList = nil
         
     | 
| 
      
 170 
     | 
    
         
            +
                                end 
         
     | 
| 
      
 171 
     | 
    
         
            +
             
     | 
| 
      
 172 
     | 
    
         
            +
                                item = Blockquote.new(res[1])
         
     | 
| 
      
 173 
     | 
    
         
            +
                                doc.items.append(item)
         
     | 
| 
      
 174 
     | 
    
         
            +
             
     | 
| 
      
 175 
     | 
    
         
            +
                            else # Reqular Paragraph
         
     | 
| 
      
 176 
     | 
    
         
            +
                                if tempMdTable
         
     | 
| 
      
 177 
     | 
    
         
            +
                                    doc.items.append tempMdTable
         
     | 
| 
      
 178 
     | 
    
         
            +
                                    tempMdTable = nil
         
     | 
| 
      
 179 
     | 
    
         
            +
                                end
         
     | 
| 
      
 180 
     | 
    
         
            +
                                if tempMdList
         
     | 
| 
      
 181 
     | 
    
         
            +
                                    doc.items.append tempMdList
         
     | 
| 
      
 182 
     | 
    
         
            +
                                    tempMdList = nil
         
     | 
| 
      
 183 
     | 
    
         
            +
                                end
         
     | 
| 
      
 184 
     | 
    
         
            +
             
     | 
| 
      
 185 
     | 
    
         
            +
                                item = Paragraph.new(s)
         
     | 
| 
      
 186 
     | 
    
         
            +
                                doc.items.append(item)
         
     | 
| 
      
 187 
     | 
    
         
            +
                            end
         
     | 
| 
      
 188 
     | 
    
         
            +
                        end
         
     | 
| 
      
 189 
     | 
    
         
            +
                    end
         
     | 
| 
      
 190 
     | 
    
         
            +
                    # Finalize non-closed elements
         
     | 
| 
      
 191 
     | 
    
         
            +
                    if tempMdTable
         
     | 
| 
      
 192 
     | 
    
         
            +
                        doc.items.append tempMdTable
         
     | 
| 
      
 193 
     | 
    
         
            +
                        tempMdTable = nil
         
     | 
| 
      
 194 
     | 
    
         
            +
                    end
         
     | 
| 
      
 195 
     | 
    
         
            +
                    if tempMdList
         
     | 
| 
      
 196 
     | 
    
         
            +
                        doc.items.append tempMdList
         
     | 
| 
      
 197 
     | 
    
         
            +
                        tempMdList = nil
         
     | 
| 
      
 198 
     | 
    
         
            +
                    end
         
     | 
| 
      
 199 
     | 
    
         
            +
                end
         
     | 
| 
      
 200 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -11,11 +11,11 @@ class Blockquote < DocItem 
     | 
|
| 
       11 
11 
     | 
    
         
             
                def to_html
         
     | 
| 
       12 
12 
     | 
    
         
             
                    s = ''
         
     | 
| 
       13 
13 
     | 
    
         
             
                    if @@htmlTableRenderInProgress
         
     | 
| 
       14 
     | 
    
         
            -
                        s += "</table>\n 
     | 
| 
      
 14 
     | 
    
         
            +
                        s += "</table>\n"
         
     | 
| 
       15 
15 
     | 
    
         
             
                        @@htmlTableRenderInProgress = false
         
     | 
| 
       16 
16 
     | 
    
         
             
                    end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
                    s += "<div class=\"blockquote\"><p>#{@text}</div>\n 
     | 
| 
      
 18 
     | 
    
         
            +
                    s += "<div class=\"blockquote\"><p>#{@text}</div>\n"
         
     | 
| 
       19 
19 
     | 
    
         
             
                    return s
         
     | 
| 
       20 
20 
     | 
    
         
             
                end
         
     | 
| 
       21 
21 
     | 
    
         
             
            end
         
     | 
| 
         @@ -5,47 +5,54 @@ class ControlledParagraph < Paragraph 
     | 
|
| 
       5 
5 
     | 
    
         
             
                attr_accessor :id
         
     | 
| 
       6 
6 
     | 
    
         
             
                attr_accessor :up_link
         
     | 
| 
       7 
7 
     | 
    
         
             
                attr_accessor :down_links
         
     | 
| 
      
 8 
     | 
    
         
            +
                attr_accessor :coverage_links
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
10 
     | 
    
         
             
                def initialize(text, id)
         
     | 
| 
       10 
11 
     | 
    
         
             
                    @text = text
         
     | 
| 
       11 
12 
     | 
    
         
             
                    @id = id
         
     | 
| 
       12 
13 
     | 
    
         
             
                    @up_link = nil
         
     | 
| 
       13 
14 
     | 
    
         
             
                    @down_links = nil
         
     | 
| 
      
 15 
     | 
    
         
            +
                    @coverage_links = nil
         
     | 
| 
       14 
16 
     | 
    
         
             
                end
         
     | 
| 
       15 
17 
     | 
    
         | 
| 
       16 
18 
     | 
    
         
             
                def to_html
         
     | 
| 
       17 
19 
     | 
    
         
             
                    s = ''
         
     | 
| 
       18 
20 
     | 
    
         
             
                    unless @@htmlTableRenderInProgress                    
         
     | 
| 
       19 
     | 
    
         
            -
                        s += "<table class=\"controlled\">\n 
     | 
| 
       20 
     | 
    
         
            -
                        s += "\t<thead> <th>#</th> <th>Text</th> <th>UL</th> <th>DL</th> <th>COV</th> </thead>\n 
     | 
| 
      
 21 
     | 
    
         
            +
                        s += "<table class=\"controlled\">\n"
         
     | 
| 
      
 22 
     | 
    
         
            +
                        s += "\t<thead> <th>#</th> <th>Text</th> <th>UL</th> <th>DL</th> <th>COV</th> </thead>\n"
         
     | 
| 
       21 
23 
     | 
    
         
             
                        @@htmlTableRenderInProgress = true
         
     | 
| 
       22 
24 
     | 
    
         
             
                    end
         
     | 
| 
       23 
     | 
    
         
            -
                    s += "\t<tr>\n 
     | 
| 
       24 
     | 
    
         
            -
                    s += "\t\t<td class=\"item_id\"> <a name=\"#{@id}\"></a>#{@id} </td>\n 
     | 
| 
       25 
     | 
    
         
            -
                    s += "\t\t<td class=\"item_text\">#{@text}</td>\n 
     | 
| 
      
 25 
     | 
    
         
            +
                    s += "\t<tr>\n"
         
     | 
| 
      
 26 
     | 
    
         
            +
                    s += "\t\t<td class=\"item_id\"> <a name=\"#{@id}\"></a>#{@id} </td>\n"
         
     | 
| 
      
 27 
     | 
    
         
            +
                    s += "\t\t<td class=\"item_text\">#{@text}</td>\n"
         
     | 
| 
       26 
28 
     | 
    
         | 
| 
       27 
29 
     | 
    
         
             
                    if @up_link
         
     | 
| 
       28 
30 
     | 
    
         
             
                        if tmp = /^([a-zA-Z]+)[-]\d+/.match(@up_link)
         
     | 
| 
       29 
31 
     | 
    
         
             
                            up_link_doc_name = tmp[1].downcase
         
     | 
| 
       30 
32 
     | 
    
         
             
                        end
         
     | 
| 
       31 
     | 
    
         
            -
                        s += "\t\t<td class=\"item_id\"><a href=\"./../#{up_link_doc_name}/#{up_link_doc_name}.html\" class=\"external\">#{@up_link}</a></td>\n 
     | 
| 
      
 33 
     | 
    
         
            +
                        s += "\t\t<td class=\"item_id\"><a href=\"./../#{up_link_doc_name}/#{up_link_doc_name}.html\" class=\"external\">#{@up_link}</a></td>\n"
         
     | 
| 
       32 
34 
     | 
    
         
             
                    else
         
     | 
| 
       33 
     | 
    
         
            -
                        s += "\t\t<td class=\"item_id\"></td>\n 
     | 
| 
      
 35 
     | 
    
         
            +
                        s += "\t\t<td class=\"item_id\"></td>\n"
         
     | 
| 
       34 
36 
     | 
    
         
             
                    end
         
     | 
| 
       35 
37 
     | 
    
         | 
| 
       36 
38 
     | 
    
         
             
                    if @down_links
         
     | 
| 
       37 
39 
     | 
    
         
             
                        if tmp = /^([a-zA-Z]+)[-]\d+/.match(@down_links[0].id)    # guessing that all the links refer to one document
         
     | 
| 
       38 
40 
     | 
    
         
             
                            down_link_doc_name = tmp[1].downcase
         
     | 
| 
       39 
41 
     | 
    
         
             
                        end
         
     | 
| 
       40 
     | 
    
         
            -
                        s += "\t\t<td class=\"item_id\"><a href=\"./../#{down_link_doc_name}/#{down_link_doc_name}.html\" class=\"external\">#{@down_links.length}</a></td>\n 
     | 
| 
      
 42 
     | 
    
         
            +
                        s += "\t\t<td class=\"item_id\"><a href=\"./../#{down_link_doc_name}/#{down_link_doc_name}.html\" class=\"external\">#{@down_links.length}</a></td>\n"
         
     | 
| 
       41 
43 
     | 
    
         
             
                    else
         
     | 
| 
       42 
     | 
    
         
            -
                        s += "\t\t<td class=\"item_id\"></td>\n 
     | 
| 
      
 44 
     | 
    
         
            +
                        s += "\t\t<td class=\"item_id\"></td>\n"
         
     | 
| 
       43 
45 
     | 
    
         
             
                    end
         
     | 
| 
       44 
46 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
                     
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
      
 47 
     | 
    
         
            +
                    if @coverage_links
         
     | 
| 
      
 48 
     | 
    
         
            +
                        if tmp = /^(.+)[.]\d+/.match(@coverage_links[0].id)    # guessing that all the links refer to one document
         
     | 
| 
      
 49 
     | 
    
         
            +
                            cov_link_doc_name = tmp[1].downcase
         
     | 
| 
      
 50 
     | 
    
         
            +
                        end
         
     | 
| 
      
 51 
     | 
    
         
            +
                        s += "\t\t<td class=\"item_id\"><a href=\"./../../tests/protocols/#{cov_link_doc_name}/#{cov_link_doc_name}.html\" class=\"external\">#{@coverage_links.length}</a></td>\n"
         
     | 
| 
      
 52 
     | 
    
         
            +
                    else
         
     | 
| 
      
 53 
     | 
    
         
            +
                        s += "\t\t<td class=\"item_id\"></td>\n"
         
     | 
| 
      
 54 
     | 
    
         
            +
                    end
         
     | 
| 
      
 55 
     | 
    
         
            +
                    s += "\t</tr>\n"
         
     | 
| 
       49 
56 
     | 
    
         
             
                    return s
         
     | 
| 
       50 
57 
     | 
    
         
             
                end 
         
     | 
| 
       51 
58 
     | 
    
         | 
| 
         @@ -0,0 +1,172 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative "controlled_table_row"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            class ControlledTableColumn
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                attr_accessor :text
         
     | 
| 
      
 7 
     | 
    
         
            +
                
         
     | 
| 
      
 8 
     | 
    
         
            +
                def initialize(text)
         
     | 
| 
      
 9 
     | 
    
         
            +
                    @text = text.strip
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                def to_html
         
     | 
| 
      
 13 
     | 
    
         
            +
                    "\t\t<td>#{@text}</td>\n\r"
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            class RegualrColumn < ControlledTableColumn
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            class TestStepNumberColumn < ControlledTableColumn
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                attr_accessor :step_number
         
     | 
| 
      
 26 
     | 
    
         
            +
                
         
     | 
| 
      
 27 
     | 
    
         
            +
                def initialize(text)
         
     | 
| 
      
 28 
     | 
    
         
            +
                    text = text.strip
         
     | 
| 
      
 29 
     | 
    
         
            +
                    @step_number = text.to_i
         
     | 
| 
      
 30 
     | 
    
         
            +
                    @text =  text
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                def to_html
         
     | 
| 
      
 34 
     | 
    
         
            +
                    "\t\t<td style=\"text-align: center;\">#{@text}</td>\n\r"
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
            end 
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            class TestStepResultColumn <  ControlledTableColumn
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                def to_html
         
     | 
| 
      
 42 
     | 
    
         
            +
                    if @text.downcase == "pass"
         
     | 
| 
      
 43 
     | 
    
         
            +
                        "\t\t<td style=\"background-color: #cfc;\">#{@text}</td>\n\r"
         
     | 
| 
      
 44 
     | 
    
         
            +
                    elsif @text.downcase == "fail"
         
     | 
| 
      
 45 
     | 
    
         
            +
                        "\t\t<td style=\"background-color: #fcc;\">#{@text}</td>\n\r"
         
     | 
| 
      
 46 
     | 
    
         
            +
                    else
         
     | 
| 
      
 47 
     | 
    
         
            +
                        "\t\t<td>#{@text}</td>\n\r"
         
     | 
| 
      
 48 
     | 
    
         
            +
                    end
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
            end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            class TestStepReferenceColumn <  ControlledTableColumn
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                attr_accessor :up_link
         
     | 
| 
      
 56 
     | 
    
         
            +
                attr_accessor :up_link_doc_id
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                def initialize(text)
         
     | 
| 
      
 59 
     | 
    
         
            +
                    
         
     | 
| 
      
 60 
     | 
    
         
            +
                    @up_link = nil
         
     | 
| 
      
 61 
     | 
    
         
            +
                    @up_link_doc_id = nil
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
                    if tmp = />\[(\S*)\]/.match(text)   # >[SRS-001]
         
     | 
| 
      
 64 
     | 
    
         
            +
                        @up_link = tmp[1]
         
     | 
| 
      
 65 
     | 
    
         
            +
                        if tmp = /^([a-zA-Z]+)[-]\d+/.match(@up_link)   # SRS
         
     | 
| 
      
 66 
     | 
    
         
            +
                            @up_link_doc_id = tmp[1].downcase 
         
     | 
| 
      
 67 
     | 
    
         
            +
                        end
         
     | 
| 
      
 68 
     | 
    
         
            +
                    end
         
     | 
| 
      
 69 
     | 
    
         
            +
                end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                def to_html
         
     | 
| 
      
 72 
     | 
    
         
            +
                    if @up_link
         
     | 
| 
      
 73 
     | 
    
         
            +
                        "\t\t<td class=\"item_id\"><a href=\"./../../../specifications/#{@up_link_doc_id}/#{@up_link_doc_id}.html\" class=\"external\">#{@up_link}</a></td>\n\r"
         
     | 
| 
      
 74 
     | 
    
         
            +
                    else
         
     | 
| 
      
 75 
     | 
    
         
            +
                        "\t\t<td style=\"text-align: center;\"></td>\n\r"
         
     | 
| 
      
 76 
     | 
    
         
            +
                    end
         
     | 
| 
      
 77 
     | 
    
         
            +
                end
         
     | 
| 
      
 78 
     | 
    
         
            +
                
         
     | 
| 
      
 79 
     | 
    
         
            +
            end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
            class ControlledTable < DocItem
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                attr_accessor :column_names
         
     | 
| 
      
 85 
     | 
    
         
            +
                attr_accessor :rows
         
     | 
| 
      
 86 
     | 
    
         
            +
                attr_accessor :parent_doc
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
                def initialize(markdown_table, parent_doc)
         
     | 
| 
      
 89 
     | 
    
         
            +
                    @parent_doc = parent_doc
         
     | 
| 
      
 90 
     | 
    
         
            +
                    @column_names = markdown_table.column_names
         
     | 
| 
      
 91 
     | 
    
         
            +
                    # copy and re-format existing rows
         
     | 
| 
      
 92 
     | 
    
         
            +
                    @rows = Array.new
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
                    markdown_table.rows.each do |r|
         
     | 
| 
      
 95 
     | 
    
         
            +
                        @rows.append(format_columns(r))
         
     | 
| 
      
 96 
     | 
    
         
            +
                    end  
         
     | 
| 
      
 97 
     | 
    
         
            +
                end
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                def addRow(row)
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
                    columns = row.split('|')
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
                    @rows.append(format_columns(columns))
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
                    return true
         
     | 
| 
      
 106 
     | 
    
         
            +
                end
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
                def format_columns(columns)
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                    new_row = ControlledTableRow.new
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
                    columns.each_with_index do | element, index |
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
                        if index == 0 # it is expected that test step id is placed in the first columl
         
     | 
| 
      
 115 
     | 
    
         
            +
                            
         
     | 
| 
      
 116 
     | 
    
         
            +
                            col = TestStepNumberColumn.new element
         
     | 
| 
      
 117 
     | 
    
         
            +
                            new_row.columns.append col
         
     | 
| 
      
 118 
     | 
    
         
            +
                            new_row.id = @parent_doc.id + '.' + col.text
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                        elsif index + 1 == columns.length # it is expected that a link is placed to the last column only
         
     | 
| 
      
 121 
     | 
    
         
            +
                            
         
     | 
| 
      
 122 
     | 
    
         
            +
                            col = TestStepReferenceColumn.new element
         
     | 
| 
      
 123 
     | 
    
         
            +
                            new_row.columns.append col
         
     | 
| 
      
 124 
     | 
    
         
            +
                            # save uplink key but do not rewrite
         
     | 
| 
      
 125 
     | 
    
         
            +
                            if col.up_link_doc_id != nil 
         
     | 
| 
      
 126 
     | 
    
         
            +
                                if @parent_doc.up_link_doc_id == ""
         
     | 
| 
      
 127 
     | 
    
         
            +
                                    @parent_doc.up_link_doc_id = col.up_link_doc_id
         
     | 
| 
      
 128 
     | 
    
         
            +
                                end
         
     | 
| 
      
 129 
     | 
    
         
            +
                                # save reference to the test step
         
     | 
| 
      
 130 
     | 
    
         
            +
                                new_row.up_link = col.up_link
         
     | 
| 
      
 131 
     | 
    
         
            +
                                @parent_doc.controlled_items.append new_row
         
     | 
| 
      
 132 
     | 
    
         
            +
                            end               
         
     | 
| 
      
 133 
     | 
    
         
            +
             
     | 
| 
      
 134 
     | 
    
         
            +
                        elsif index + 2 == columns.length # it is expected that test step result is placed to the pre-last column only
         
     | 
| 
      
 135 
     | 
    
         
            +
                            
         
     | 
| 
      
 136 
     | 
    
         
            +
                            col = TestStepResultColumn.new element
         
     | 
| 
      
 137 
     | 
    
         
            +
                            new_row.columns.append col
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
                        else
         
     | 
| 
      
 140 
     | 
    
         
            +
                            col = RegualrColumn.new element
         
     | 
| 
      
 141 
     | 
    
         
            +
                            new_row.columns.append col
         
     | 
| 
      
 142 
     | 
    
         
            +
                        end             
         
     | 
| 
      
 143 
     | 
    
         
            +
                    end
         
     | 
| 
      
 144 
     | 
    
         
            +
                    return new_row
         
     | 
| 
      
 145 
     | 
    
         
            +
                end
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
                def to_html
         
     | 
| 
      
 148 
     | 
    
         
            +
                    s = ''
         
     | 
| 
      
 149 
     | 
    
         
            +
                    if @@htmlTableRenderInProgress
         
     | 
| 
      
 150 
     | 
    
         
            +
                        s += "</table>\n"
         
     | 
| 
      
 151 
     | 
    
         
            +
                        @@htmlTableRenderInProgress = false
         
     | 
| 
      
 152 
     | 
    
         
            +
                    end
         
     | 
| 
      
 153 
     | 
    
         
            +
                               
         
     | 
| 
      
 154 
     | 
    
         
            +
                    s += "<table class=\"markdown_table\">\n"
         
     | 
| 
      
 155 
     | 
    
         
            +
                    s += "\t<thead>" 
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
                    @column_names.each do |h|
         
     | 
| 
      
 158 
     | 
    
         
            +
                        s += " <th>#{h}</th>"
         
     | 
| 
      
 159 
     | 
    
         
            +
                    end
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
                    s += " </thead>\n"
         
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
| 
      
 163 
     | 
    
         
            +
                    @rows.each do |row|
         
     | 
| 
      
 164 
     | 
    
         
            +
                        s += row.to_html
         
     | 
| 
      
 165 
     | 
    
         
            +
                    end
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
      
 167 
     | 
    
         
            +
                    s += "</table>\n"
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
                    return s
         
     | 
| 
      
 170 
     | 
    
         
            +
                end
         
     | 
| 
      
 171 
     | 
    
         
            +
             
     | 
| 
      
 172 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative "doc_item"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class ControlledTableRow < DocItem
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                attr_accessor :id
         
     | 
| 
      
 6 
     | 
    
         
            +
                attr_accessor :up_link
         
     | 
| 
      
 7 
     | 
    
         
            +
                attr_accessor :columns
         
     | 
| 
      
 8 
     | 
    
         
            +
                
         
     | 
| 
      
 9 
     | 
    
         
            +
                def initialize
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @id = ""
         
     | 
| 
      
 11 
     | 
    
         
            +
                    @up_link = ""
         
     | 
| 
      
 12 
     | 
    
         
            +
                    @columns = Array.new
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                def to_html
         
     | 
| 
      
 16 
     | 
    
         
            +
                    s = ""
         
     | 
| 
      
 17 
     | 
    
         
            +
                    s += "\t<tr>\n"
         
     | 
| 
      
 18 
     | 
    
         
            +
                    @columns.each do |col|
         
     | 
| 
      
 19 
     | 
    
         
            +
                        s += col.to_html    # "\t\t<td>#{col}</td>\n\r"
         
     | 
| 
      
 20 
     | 
    
         
            +
                    end
         
     | 
| 
      
 21 
     | 
    
         
            +
                    s += "\t</tr>\n"
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -14,11 +14,11 @@ class Heading < Paragraph 
     | 
|
| 
       14 
14 
     | 
    
         
             
                def to_html
         
     | 
| 
       15 
15 
     | 
    
         
             
                    s = ''
         
     | 
| 
       16 
16 
     | 
    
         
             
                    if @@htmlTableRenderInProgress
         
     | 
| 
       17 
     | 
    
         
            -
                        s += "</table 
     | 
| 
      
 17 
     | 
    
         
            +
                        s += "</table>\n"
         
     | 
| 
       18 
18 
     | 
    
         
             
                        @@htmlTableRenderInProgress = false
         
     | 
| 
       19 
19 
     | 
    
         
             
                    end
         
     | 
| 
       20 
20 
     | 
    
         
             
                    headingLevel = level.to_s 
         
     | 
| 
       21 
     | 
    
         
            -
                    s += "<a name=\"#{@anchor_id}\"></a>\n 
     | 
| 
      
 21 
     | 
    
         
            +
                    s += "<a name=\"#{@anchor_id}\"></a>\n"
         
     | 
| 
       22 
22 
     | 
    
         
             
                    s += "<h#{headingLevel}> #{@text} <a href=\"\##{@anchor_id}\" class=\"heading_anchor\">"
         
     | 
| 
       23 
23 
     | 
    
         
             
                    s += "¶</a></h#{headingLevel}>"
         
     | 
| 
       24 
24 
     | 
    
         
             
                    return s
         
     | 
| 
         @@ -16,15 +16,15 @@ class MarkdownList < DocItem 
     | 
|
| 
       16 
16 
     | 
    
         
             
                def to_html
         
     | 
| 
       17 
17 
     | 
    
         
             
                    s = ''
         
     | 
| 
       18 
18 
     | 
    
         
             
                    if @@htmlTableRenderInProgress
         
     | 
| 
       19 
     | 
    
         
            -
                        s += "</table 
     | 
| 
      
 19 
     | 
    
         
            +
                        s += "</table>\n"
         
     | 
| 
       20 
20 
     | 
    
         
             
                        @@htmlTableRenderInProgress = false
         
     | 
| 
       21 
21 
     | 
    
         
             
                    end
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
                    s += "<ul>\n 
     | 
| 
      
 23 
     | 
    
         
            +
                    s += "<ul>\n"
         
     | 
| 
       24 
24 
     | 
    
         
             
                    @rows.each do |r|
         
     | 
| 
       25 
     | 
    
         
            -
                        s += "\t<li>#{r}</li>\n 
     | 
| 
      
 25 
     | 
    
         
            +
                        s += "\t<li>#{r}</li>\n"
         
     | 
| 
       26 
26 
     | 
    
         
             
                    end
         
     | 
| 
       27 
     | 
    
         
            -
                    s += "</ul>\n 
     | 
| 
      
 27 
     | 
    
         
            +
                    s += "</ul>\n"
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
                    return s
         
     | 
| 
       30 
30 
     | 
    
         
             
                end
         
     | 
| 
         @@ -11,35 +11,46 @@ class MarkdownTable < DocItem 
     | 
|
| 
       11 
11 
     | 
    
         
             
                end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                def addRow(row)
         
     | 
| 
      
 14 
     | 
    
         
            +
                    #check if row contains a link
         
     | 
| 
      
 15 
     | 
    
         
            +
                    if tmp = /(.*)\s+>\[(\S*)\]/.match(row)
         
     | 
| 
      
 16 
     | 
    
         
            +
                        return false # this is not a regular Markdown table.
         
     | 
| 
      
 17 
     | 
    
         
            +
                        # so the table type shall be changed and this row shall be passed one more time
         
     | 
| 
      
 18 
     | 
    
         
            +
                    end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       14 
20 
     | 
    
         
             
                    columns = row.split('|')
         
     | 
| 
       15 
     | 
    
         
            -
                    @rows.append(columns)
         
     | 
| 
      
 21 
     | 
    
         
            +
                    @rows.append(columns.map!{ |x| x.strip })
         
     | 
| 
      
 22 
     | 
    
         
            +
                    return true
         
     | 
| 
       16 
23 
     | 
    
         
             
                end
         
     | 
| 
       17 
24 
     | 
    
         | 
| 
       18 
25 
     | 
    
         
             
                def to_html
         
     | 
| 
       19 
26 
     | 
    
         
             
                    s = ''
         
     | 
| 
       20 
27 
     | 
    
         
             
                    if @@htmlTableRenderInProgress
         
     | 
| 
       21 
     | 
    
         
            -
                        s += "</table 
     | 
| 
      
 28 
     | 
    
         
            +
                        s += "</table>\n"
         
     | 
| 
       22 
29 
     | 
    
         
             
                        @@htmlTableRenderInProgress = false
         
     | 
| 
       23 
30 
     | 
    
         
             
                    end
         
     | 
| 
       24 
31 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                    s += "<table class=\"markdown_table\">\n 
     | 
| 
      
 32 
     | 
    
         
            +
                    s += "<table class=\"markdown_table\">\n"
         
     | 
| 
       26 
33 
     | 
    
         
             
                    s += "\t<thead>" 
         
     | 
| 
       27 
34 
     | 
    
         | 
| 
       28 
35 
     | 
    
         
             
                    @column_names.each do |h|
         
     | 
| 
       29 
36 
     | 
    
         
             
                        s += " <th>#{h}</th>"
         
     | 
| 
       30 
37 
     | 
    
         
             
                    end
         
     | 
| 
       31 
38 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                    s += " </thead>\n 
     | 
| 
      
 39 
     | 
    
         
            +
                    s += " </thead>\n"
         
     | 
| 
       33 
40 
     | 
    
         | 
| 
       34 
41 
     | 
    
         
             
                    @rows.each do |row|
         
     | 
| 
       35 
     | 
    
         
            -
                        s += "\t<tr>\n 
     | 
| 
      
 42 
     | 
    
         
            +
                        s += "\t<tr>\n"
         
     | 
| 
       36 
43 
     | 
    
         
             
                        row.each do |col|
         
     | 
| 
       37 
     | 
    
         
            -
                             
     | 
| 
      
 44 
     | 
    
         
            +
                            if col.to_i > 0 && col.to_i.to_s == col  # autoalign cells with numbers
         
     | 
| 
      
 45 
     | 
    
         
            +
                                s += "\t\t<td style=\"text-align: center;\">#{col}</td>\n"
         
     | 
| 
      
 46 
     | 
    
         
            +
                            else
         
     | 
| 
      
 47 
     | 
    
         
            +
                                s += "\t\t<td>#{col}</td>\n"
         
     | 
| 
      
 48 
     | 
    
         
            +
                            end
         
     | 
| 
       38 
49 
     | 
    
         
             
                        end
         
     | 
| 
       39 
     | 
    
         
            -
                        s += "\t</tr>\n 
     | 
| 
      
 50 
     | 
    
         
            +
                        s += "\t</tr>\n"
         
     | 
| 
       40 
51 
     | 
    
         
             
                    end
         
     | 
| 
       41 
52 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
                    s += "</table>\n 
     | 
| 
      
 53 
     | 
    
         
            +
                    s += "</table>\n"
         
     | 
| 
       43 
54 
     | 
    
         | 
| 
       44 
55 
     | 
    
         
             
                    return s
         
     | 
| 
       45 
56 
     | 
    
         
             
                end
         
     | 
| 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
             
     | 
| 
      
 2 
     | 
    
         
            +
            class BaseDocument
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
                attr_accessor :path
         
     | 
| 
      
 5 
     | 
    
         
            +
                attr_accessor :items
         
     | 
| 
      
 6 
     | 
    
         
            +
                attr_accessor :headings
         
     | 
| 
      
 7 
     | 
    
         
            +
                attr_accessor :title
         
     | 
| 
      
 8 
     | 
    
         
            +
                attr_accessor :id
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                def initialize(fele_path)
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                    @path = fele_path
         
     | 
| 
      
 13 
     | 
    
         
            +
                    @items = Array.new
         
     | 
| 
      
 14 
     | 
    
         
            +
                    @headings = Array.new
         
     | 
| 
      
 15 
     | 
    
         
            +
                    @title = ""
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @id = ""
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative "base_document"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class Protocol < BaseDocument
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                attr_accessor :up_link_doc_id
         
     | 
| 
      
 6 
     | 
    
         
            +
                #attr_accessor :dictionary
         
     | 
| 
      
 7 
     | 
    
         
            +
                attr_accessor :controlled_items
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def initialize(fele_path)
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                    @path = fele_path
         
     | 
| 
      
 12 
     | 
    
         
            +
                    @title = ""
         
     | 
| 
      
 13 
     | 
    
         
            +
                    @items = Array.new
         
     | 
| 
      
 14 
     | 
    
         
            +
                    @headings = Array.new
         
     | 
| 
      
 15 
     | 
    
         
            +
                    @controlled_items = Array.new
         
     | 
| 
      
 16 
     | 
    
         
            +
                    #@dictionary = Hash.new
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                    @id = File.basename(fele_path, File.extname(fele_path)).downcase
         
     | 
| 
      
 19 
     | 
    
         
            +
                    @up_link_doc_id = ""
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative "base_document"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class Specification < BaseDocument
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                attr_accessor :up_link_doc_id
         
     | 
| 
      
 6 
     | 
    
         
            +
                attr_accessor :dictionary
         
     | 
| 
      
 7 
     | 
    
         
            +
                attr_accessor :controlled_items
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def initialize(fele_path)
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                    @path = fele_path
         
     | 
| 
      
 12 
     | 
    
         
            +
                    @title = ""
         
     | 
| 
      
 13 
     | 
    
         
            +
                    @items = Array.new
         
     | 
| 
      
 14 
     | 
    
         
            +
                    @headings = Array.new
         
     | 
| 
      
 15 
     | 
    
         
            +
                    @controlled_items = Array.new
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @dictionary = Hash.new
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                    @id = File.basename(fele_path, File.extname(fele_path)).downcase
         
     | 
| 
      
 19 
     | 
    
         
            +
                    @up_link_doc_id = ""
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/almirah/html_render.rb
    CHANGED
    
    | 
         @@ -1,6 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require_relative "specification"
         
     | 
| 
       2 
     | 
    
         
            -
            require_relative "doc_items/doc_item"
         
     | 
| 
       3 
     | 
    
         
            -
            require_relative "navigation_pane"
         
     | 
| 
       4 
1 
     | 
    
         | 
| 
       5 
2 
     | 
    
         
             
            class HtmlRender
         
     | 
| 
       6 
3 
     | 
    
         | 
| 
         @@ -25,7 +22,7 @@ class HtmlRender 
     | 
|
| 
       25 
22 
     | 
    
         
             
                def render()
         
     | 
| 
       26 
23 
     | 
    
         
             
                    self.htmlRows.append('')
         
     | 
| 
       27 
24 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
                    self.document. 
     | 
| 
      
 25 
     | 
    
         
            +
                    self.document.items.each do |item|    
         
     | 
| 
       29 
26 
     | 
    
         
             
                        a = item.to_html
         
     | 
| 
       30 
27 
     | 
    
         
             
                        self.htmlRows.append a
         
     | 
| 
       31 
28 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -44,7 +41,9 @@ class HtmlRender 
     | 
|
| 
       44 
41 
     | 
    
         
             
                                file.puts r
         
     | 
| 
       45 
42 
     | 
    
         
             
                            end
         
     | 
| 
       46 
43 
     | 
    
         
             
                        elsif s.include?('{{NAV_PANE}}')
         
     | 
| 
       47 
     | 
    
         
            -
                             
     | 
| 
      
 44 
     | 
    
         
            +
                            if @nav_pane
         
     | 
| 
      
 45 
     | 
    
         
            +
                                file.puts self.nav_pane.to_html
         
     | 
| 
      
 46 
     | 
    
         
            +
                            end
         
     | 
| 
       48 
47 
     | 
    
         
             
                        else
         
     | 
| 
       49 
48 
     | 
    
         
             
                            file.puts s
         
     | 
| 
       50 
49 
     | 
    
         
             
                        end
         
     | 
| 
         @@ -1,5 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require_relative "doc_items/doc_item"
         
     | 
| 
       2 
     | 
    
         
            -
            require_relative "specification"
         
     | 
| 
       3 
1 
     | 
    
         | 
| 
       4 
2 
     | 
    
         
             
            class NavigationPane
         
     | 
| 
       5 
3 
     | 
    
         | 
| 
         @@ -12,10 +10,10 @@ class NavigationPane 
     | 
|
| 
       12 
10 
     | 
    
         
             
                def to_html        
         
     | 
| 
       13 
11 
     | 
    
         
             
                    s = "<ul class=\"fa-ul\">\n"
         
     | 
| 
       14 
12 
     | 
    
         
             
                    @specifications.each do |spec|
         
     | 
| 
       15 
     | 
    
         
            -
                        s += "\t<li><span class=\"fa-li\"><i class=\"fa fa-folder-open-o\"> </i></span> #{spec. 
     | 
| 
      
 13 
     | 
    
         
            +
                        s += "\t<li><span class=\"fa-li\"><i class=\"fa fa-folder-open-o\"> </i></span> #{spec.id}\n"
         
     | 
| 
       16 
14 
     | 
    
         
             
                            s += "\t\t<ul class=\"fa-ul\">\n"
         
     | 
| 
       17 
15 
     | 
    
         
             
                            s += "\t\t\t<li><span class=\"fa-li\"><i class=\"fa fa-plus-square-o\"> </i></span>\n"
         
     | 
| 
       18 
     | 
    
         
            -
                            s += "\t\t\t\t<a href=\".\\..\\#{spec. 
     | 
| 
      
 16 
     | 
    
         
            +
                            s += "\t\t\t\t<a href=\".\\..\\#{spec.id }\\#{spec.id }.html\">#{spec.title}</a>\n"
         
     | 
| 
       19 
17 
     | 
    
         
             
                            s += "\t\t\t</li>\n"
         
     | 
| 
       20 
18 
     | 
    
         
             
                            s += "\t\t</ul>\n"
         
     | 
| 
       21 
19 
     | 
    
         
             
                        s += "\t</li>\n"
         
     | 
    
        data/lib/almirah/project.rb
    CHANGED
    
    | 
         @@ -1,11 +1,11 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require_relative " 
     | 
| 
       2 
     | 
    
         
            -
            require_relative "specification"
         
     | 
| 
      
 1 
     | 
    
         
            +
            require_relative "doc_fabric"
         
     | 
| 
       3 
2 
     | 
    
         
             
            require_relative "html_render"
         
     | 
| 
       4 
3 
     | 
    
         
             
            require_relative "navigation_pane"
         
     | 
| 
       5 
4 
     | 
    
         | 
| 
       6 
5 
     | 
    
         
             
            class Project
         
     | 
| 
       7 
6 
     | 
    
         | 
| 
       8 
7 
     | 
    
         
             
                attr_accessor :specifications
         
     | 
| 
      
 8 
     | 
    
         
            +
                attr_accessor :protocols
         
     | 
| 
       9 
9 
     | 
    
         
             
                attr_accessor :project_root_directory
         
     | 
| 
       10 
10 
     | 
    
         
             
                attr_accessor :gem_root
         
     | 
| 
       11 
11 
     | 
    
         
             
                attr_accessor :specifications_dictionary
         
     | 
| 
         @@ -13,45 +13,88 @@ class Project 
     | 
|
| 
       13 
13 
     | 
    
         
             
                def initialize(path, gem_root)
         
     | 
| 
       14 
14 
     | 
    
         
             
                    @project_root_directory = path
         
     | 
| 
       15 
15 
     | 
    
         
             
                    @specifications = Array.new
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @protocols = Array.new
         
     | 
| 
       16 
17 
     | 
    
         
             
                    @gem_root = gem_root
         
     | 
| 
       17 
18 
     | 
    
         
             
                    @specifications_dictionary = Hash.new
         
     | 
| 
       18 
19 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
                     
     | 
| 
       20 
     | 
    
         
            -
                    link_all_specifications()
         
     | 
| 
       21 
     | 
    
         
            -
                    render_all_specifications()
         
     | 
| 
       22 
     | 
    
         
            -
                   
         
     | 
| 
      
 20 
     | 
    
         
            +
                    FileUtils.remove_dir(@project_root_directory + "/build", true)      
         
     | 
| 
       23 
21 
     | 
    
         
             
                end
         
     | 
| 
       24 
22 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                def  
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                     
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
      
 23 
     | 
    
         
            +
                def specifications_and_protocols
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                    parse_all_specifications
         
     | 
| 
      
 26 
     | 
    
         
            +
                    parse_all_protocols
         
     | 
| 
      
 27 
     | 
    
         
            +
                    link_all_specifications
         
     | 
| 
      
 28 
     | 
    
         
            +
                    link_all_protocols
         
     | 
| 
      
 29 
     | 
    
         
            +
                    render_all_specifications
         
     | 
| 
      
 30 
     | 
    
         
            +
                    render_all_protocols
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                def specifications_and_results( test_run )
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                    parse_all_specifications
         
     | 
| 
      
 36 
     | 
    
         
            +
                    parse_test_run test_run
         
     | 
| 
      
 37 
     | 
    
         
            +
                    link_all_specifications
         
     | 
| 
      
 38 
     | 
    
         
            +
                    link_all_protocols
         
     | 
| 
      
 39 
     | 
    
         
            +
                    render_all_specifications
         
     | 
| 
      
 40 
     | 
    
         
            +
                    render_all_protocols
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                def parse_all_specifications        
         
     | 
| 
      
 44 
     | 
    
         
            +
                    Dir.glob( "#{@project_root_directory}/specifications/**/*.md" ).each do |f|
         
     | 
| 
      
 45 
     | 
    
         
            +
                        puts "Spec: " + f
         
     | 
| 
      
 46 
     | 
    
         
            +
                        doc = DocFabric.create_specification(f)
         
     | 
| 
      
 47 
     | 
    
         
            +
                        @specifications.append(doc)
         
     | 
| 
      
 48 
     | 
    
         
            +
                    end
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                def parse_all_protocols
         
     | 
| 
      
 52 
     | 
    
         
            +
                    Dir.glob( "#{@project_root_directory}/tests/protocols/**/*.md" ).each do |f|
         
     | 
| 
      
 53 
     | 
    
         
            +
                        puts "Prot: " + f
         
     | 
| 
      
 54 
     | 
    
         
            +
                        doc = DocFabric.create_protocol(f)
         
     | 
| 
      
 55 
     | 
    
         
            +
                        @protocols.append(doc)
         
     | 
| 
      
 56 
     | 
    
         
            +
                    end
         
     | 
| 
      
 57 
     | 
    
         
            +
                end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
                def parse_test_run( test_run )
         
     | 
| 
      
 60 
     | 
    
         
            +
                    Dir.glob( "#{@project_root_directory}/tests/runs/#{test_run}/**/*.md" ).each do |f|
         
     | 
| 
      
 61 
     | 
    
         
            +
                        puts "Run: " + f
         
     | 
| 
      
 62 
     | 
    
         
            +
                        doc = DocFabric.create_protocol(f)
         
     | 
| 
      
 63 
     | 
    
         
            +
                        @protocols.append(doc)
         
     | 
| 
       31 
64 
     | 
    
         
             
                    end
         
     | 
| 
       32 
65 
     | 
    
         
             
                end
         
     | 
| 
       33 
66 
     | 
    
         | 
| 
       34 
67 
     | 
    
         
             
                def link_all_specifications
         
     | 
| 
       35 
68 
     | 
    
         
             
                    combList = @specifications.combination(2)
         
     | 
| 
       36 
69 
     | 
    
         
             
                    combList.each do |c|
         
     | 
| 
       37 
     | 
    
         
            -
                         
     | 
| 
      
 70 
     | 
    
         
            +
                        link_two_specifications(c[0], c[1])
         
     | 
| 
      
 71 
     | 
    
         
            +
                    end
         
     | 
| 
      
 72 
     | 
    
         
            +
                end
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                def link_all_protocols
         
     | 
| 
      
 75 
     | 
    
         
            +
                    @protocols.each do |p|
         
     | 
| 
      
 76 
     | 
    
         
            +
                        @specifications.each do |s|
         
     | 
| 
      
 77 
     | 
    
         
            +
                            if s.id == p.up_link_doc_id
         
     | 
| 
      
 78 
     | 
    
         
            +
                                link_protocol_to_spec(p,s)
         
     | 
| 
      
 79 
     | 
    
         
            +
                            end
         
     | 
| 
      
 80 
     | 
    
         
            +
                        end
         
     | 
| 
       38 
81 
     | 
    
         
             
                    end
         
     | 
| 
       39 
82 
     | 
    
         
             
                end
         
     | 
| 
       40 
83 
     | 
    
         | 
| 
       41 
84 
     | 
    
         
             
                def link_two_specifications(doc_A, doc_B)
         
     | 
| 
       42 
85 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
                    if doc_A. 
     | 
| 
      
 86 
     | 
    
         
            +
                    if doc_A.id == doc_B.up_link_doc_id
         
     | 
| 
       44 
87 
     | 
    
         
             
                        top_document = doc_A
         
     | 
| 
       45 
88 
     | 
    
         
             
                        bottom_document = doc_B
         
     | 
| 
       46 
     | 
    
         
            -
                    elsif doc_B. 
     | 
| 
      
 89 
     | 
    
         
            +
                    elsif doc_B.id == doc_A.up_link_doc_id
         
     | 
| 
       47 
90 
     | 
    
         
             
                        top_document = doc_B
         
     | 
| 
       48 
91 
     | 
    
         
             
                        bottom_document = doc_A
         
     | 
| 
       49 
92 
     | 
    
         
             
                    else
         
     | 
| 
       50 
93 
     | 
    
         
             
                        puts "No Links"
         
     | 
| 
       51 
94 
     | 
    
         
             
                        return # no links
         
     | 
| 
       52 
95 
     | 
    
         
             
                    end
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
                    bottom_document. 
     | 
| 
      
 96 
     | 
    
         
            +
                    
         
     | 
| 
      
 97 
     | 
    
         
            +
                    bottom_document.controlled_items.each do |item|
         
     | 
| 
       55 
98 
     | 
    
         | 
| 
       56 
99 
     | 
    
         
             
                        if top_document.dictionary.has_key?(item.up_link.to_s)
         
     | 
| 
       57 
100 
     | 
    
         | 
| 
         @@ -69,6 +112,25 @@ class Project 
     | 
|
| 
       69 
112 
     | 
    
         
             
                    end
         
     | 
| 
       70 
113 
     | 
    
         
             
                end
         
     | 
| 
       71 
114 
     | 
    
         | 
| 
      
 115 
     | 
    
         
            +
                def link_protocol_to_spec(protocol, specification)
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
                    top_document = specification
         
     | 
| 
      
 118 
     | 
    
         
            +
                    bottom_document = protocol
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                    bottom_document.controlled_items.each do |item|
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
                        if top_document.dictionary.has_key?(item.up_link.to_s)
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
                            topItem = top_document.dictionary[item.up_link.to_s]
         
     | 
| 
      
 125 
     | 
    
         
            +
                            
         
     | 
| 
      
 126 
     | 
    
         
            +
                            unless topItem.coverage_links
         
     | 
| 
      
 127 
     | 
    
         
            +
                                topItem.coverage_links = Array.new
         
     | 
| 
      
 128 
     | 
    
         
            +
                            end
         
     | 
| 
      
 129 
     | 
    
         
            +
                            topItem.coverage_links.append(item)
         
     | 
| 
      
 130 
     | 
    
         
            +
                        end
         
     | 
| 
      
 131 
     | 
    
         
            +
                    end
         
     | 
| 
      
 132 
     | 
    
         
            +
                end
         
     | 
| 
      
 133 
     | 
    
         
            +
             
     | 
| 
       72 
134 
     | 
    
         
             
                def render_all_specifications
         
     | 
| 
       73 
135 
     | 
    
         | 
| 
       74 
136 
     | 
    
         
             
                    # create a sidebar first
         
     | 
| 
         @@ -76,13 +138,39 @@ class Project 
     | 
|
| 
       76 
138 
     | 
    
         | 
| 
       77 
139 
     | 
    
         
             
                    pass = @project_root_directory
         
     | 
| 
       78 
140 
     | 
    
         | 
| 
       79 
     | 
    
         
            -
                    FileUtils.remove_dir(pass + "/build", true)
         
     | 
| 
       80 
141 
     | 
    
         
             
                    FileUtils.mkdir_p(pass + "/build/specifications")
         
     | 
| 
       81 
142 
     | 
    
         | 
| 
       82 
     | 
    
         
            -
                    @specifications.each do | 
     | 
| 
      
 143 
     | 
    
         
            +
                    @specifications.each do |doc|
         
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
      
 145 
     | 
    
         
            +
                        img_src_dir = pass + "/specifications/" + doc.id + "/img"
         
     | 
| 
      
 146 
     | 
    
         
            +
                        img_dst_dir = pass + "/build/specifications/" + doc.id + "/img"
         
     | 
| 
      
 147 
     | 
    
         
            +
                 
         
     | 
| 
      
 148 
     | 
    
         
            +
                        FileUtils.mkdir_p(img_dst_dir)
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
                        if File.directory?(img_src_dir)
         
     | 
| 
      
 151 
     | 
    
         
            +
                            FileUtils.copy_entry( img_src_dir, img_dst_dir )
         
     | 
| 
      
 152 
     | 
    
         
            +
                        end
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
                        HtmlRender.new( doc, nav_pane,
         
     | 
| 
      
 155 
     | 
    
         
            +
                        @gem_root + "/lib/almirah/templates/page.html",
         
     | 
| 
      
 156 
     | 
    
         
            +
                        "#{pass}/build/specifications/#{doc.id}/#{doc.id}.html" )
         
     | 
| 
      
 157 
     | 
    
         
            +
                    end
         
     | 
| 
      
 158 
     | 
    
         
            +
                end
         
     | 
| 
      
 159 
     | 
    
         
            +
             
     | 
| 
      
 160 
     | 
    
         
            +
                def render_all_protocols
         
     | 
| 
      
 161 
     | 
    
         
            +
                    
         
     | 
| 
      
 162 
     | 
    
         
            +
                    # create a sidebar first
         
     | 
| 
      
 163 
     | 
    
         
            +
                    #nav_pane = NavigationPane.new(@specifications)        
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
                    pass = @project_root_directory
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
      
 167 
     | 
    
         
            +
                    # FileUtils.remove_dir(pass + "/build/tests", true)
         
     | 
| 
      
 168 
     | 
    
         
            +
                    FileUtils.mkdir_p(pass + "/build/tests/protocols")
         
     | 
| 
      
 169 
     | 
    
         
            +
                
         
     | 
| 
      
 170 
     | 
    
         
            +
                    @protocols.each do |doc|
         
     | 
| 
       83 
171 
     | 
    
         | 
| 
       84 
     | 
    
         
            -
                        img_src_dir = pass + "/ 
     | 
| 
       85 
     | 
    
         
            -
                        img_dst_dir = pass + "/build/ 
     | 
| 
      
 172 
     | 
    
         
            +
                        img_src_dir = pass + "/tests/protocols/" + doc.id + "/img"
         
     | 
| 
      
 173 
     | 
    
         
            +
                        img_dst_dir = pass + "/build/tests/protocols/" + doc.id + "/img"
         
     | 
| 
       86 
174 
     | 
    
         | 
| 
       87 
175 
     | 
    
         
             
                        FileUtils.mkdir_p(img_dst_dir)
         
     | 
| 
       88 
176 
     | 
    
         | 
| 
         @@ -90,9 +178,9 @@ class Project 
     | 
|
| 
       90 
178 
     | 
    
         
             
                            FileUtils.copy_entry( img_src_dir, img_dst_dir )
         
     | 
| 
       91 
179 
     | 
    
         
             
                        end
         
     | 
| 
       92 
180 
     | 
    
         | 
| 
       93 
     | 
    
         
            -
                        HtmlRender.new(  
     | 
| 
      
 181 
     | 
    
         
            +
                        HtmlRender.new( doc, nil,
         
     | 
| 
       94 
182 
     | 
    
         
             
                        @gem_root + "/lib/almirah/templates/page.html",
         
     | 
| 
       95 
     | 
    
         
            -
                        "#{pass}/build/ 
     | 
| 
      
 183 
     | 
    
         
            +
                        "#{pass}/build/tests/protocols/#{doc.id}/#{doc.id}.html" )
         
     | 
| 
       96 
184 
     | 
    
         
             
                    end
         
     | 
| 
       97 
185 
     | 
    
         
             
                end
         
     | 
| 
       98 
186 
     | 
    
         
             
            end
         
     | 
    
        data/lib/almirah.rb
    CHANGED
    
    | 
         @@ -2,22 +2,36 @@ require "thor" 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require_relative "almirah/project"
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            class CLI < Thor
         
     | 
| 
       5 
     | 
    
         
            -
              desc "please < 
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
              desc "please <project_folder>", "say <project_folder>"
         
     | 
| 
      
 6 
     | 
    
         
            +
              option :results
         
     | 
| 
      
 7 
     | 
    
         
            +
                def please(project_folder)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  a = Almirah.new project_folder
         
     | 
| 
      
 9 
     | 
    
         
            +
                  if options[:results]
         
     | 
| 
      
 10 
     | 
    
         
            +
                    a.results options[:results]
         
     | 
| 
      
 11 
     | 
    
         
            +
                  else
         
     | 
| 
      
 12 
     | 
    
         
            +
                    a.default
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
       8 
14 
     | 
    
         
             
                end
         
     | 
| 
       9 
15 
     | 
    
         
             
            end
         
     | 
| 
       10 
16 
     | 
    
         | 
| 
       11 
17 
     | 
    
         
             
            class Almirah
         
     | 
| 
       12 
18 
     | 
    
         | 
| 
      
 19 
     | 
    
         
            +
              attr_accessor :project
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              def initialize project_folder
         
     | 
| 
      
 22 
     | 
    
         
            +
                @project = Project.new project_folder, getGemRoot
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
       13 
25 
     | 
    
         
             
              def getGemRoot
         
     | 
| 
       14 
26 
     | 
    
         
             
                File.expand_path './..', File.dirname(__FILE__)
         
     | 
| 
       15 
27 
     | 
    
         
             
              end
         
     | 
| 
       16 
28 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
              def  
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 29 
     | 
    
         
            +
              def results( test_run )
         
     | 
| 
      
 30 
     | 
    
         
            +
                @project.specifications_and_results test_run
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
       20 
32 
     | 
    
         | 
| 
      
 33 
     | 
    
         
            +
              def default
         
     | 
| 
      
 34 
     | 
    
         
            +
                @project.specifications_and_protocols
         
     | 
| 
       21 
35 
     | 
    
         
             
              end
         
     | 
| 
       22 
36 
     | 
    
         | 
| 
       23 
37 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: Almirah
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.7
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Oleksandr Ivanov
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2024- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-02-10 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
13 
     | 
    
         
             
            description: The software part of the Almirah system
         
     | 
| 
       14 
14 
     | 
    
         
             
            email: oleksandr.ivanov.development@gmail.com
         
     | 
| 
         @@ -19,18 +19,23 @@ extra_rdoc_files: [] 
     | 
|
| 
       19 
19 
     | 
    
         
             
            files:
         
     | 
| 
       20 
20 
     | 
    
         
             
            - bin/almirah
         
     | 
| 
       21 
21 
     | 
    
         
             
            - lib/almirah.rb
         
     | 
| 
      
 22 
     | 
    
         
            +
            - lib/almirah/doc_fabric.rb
         
     | 
| 
       22 
23 
     | 
    
         
             
            - lib/almirah/doc_items/blockquote.rb
         
     | 
| 
       23 
24 
     | 
    
         
             
            - lib/almirah/doc_items/controlled_paragraph.rb
         
     | 
| 
      
 25 
     | 
    
         
            +
            - lib/almirah/doc_items/controlled_table.rb
         
     | 
| 
      
 26 
     | 
    
         
            +
            - lib/almirah/doc_items/controlled_table_row.rb
         
     | 
| 
       24 
27 
     | 
    
         
             
            - lib/almirah/doc_items/doc_item.rb
         
     | 
| 
       25 
28 
     | 
    
         
             
            - lib/almirah/doc_items/heading.rb
         
     | 
| 
       26 
29 
     | 
    
         
             
            - lib/almirah/doc_items/image.rb
         
     | 
| 
       27 
30 
     | 
    
         
             
            - lib/almirah/doc_items/markdown_list.rb
         
     | 
| 
       28 
31 
     | 
    
         
             
            - lib/almirah/doc_items/markdown_table.rb
         
     | 
| 
       29 
32 
     | 
    
         
             
            - lib/almirah/doc_items/paragraph.rb
         
     | 
| 
      
 33 
     | 
    
         
            +
            - lib/almirah/doc_types/base_document.rb
         
     | 
| 
      
 34 
     | 
    
         
            +
            - lib/almirah/doc_types/protocol.rb
         
     | 
| 
      
 35 
     | 
    
         
            +
            - lib/almirah/doc_types/specification.rb
         
     | 
| 
       30 
36 
     | 
    
         
             
            - lib/almirah/html_render.rb
         
     | 
| 
       31 
37 
     | 
    
         
             
            - lib/almirah/navigation_pane.rb
         
     | 
| 
       32 
38 
     | 
    
         
             
            - lib/almirah/project.rb
         
     | 
| 
       33 
     | 
    
         
            -
            - lib/almirah/specification.rb
         
     | 
| 
       34 
39 
     | 
    
         
             
            - lib/almirah/templates/page.html
         
     | 
| 
       35 
40 
     | 
    
         
             
            homepage: http://almirah.site
         
     | 
| 
       36 
41 
     | 
    
         
             
            licenses:
         
     | 
| 
         @@ -1,194 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require_relative "doc_items/doc_item"
         
     | 
| 
       2 
     | 
    
         
            -
            require_relative "doc_items/heading"
         
     | 
| 
       3 
     | 
    
         
            -
            require_relative "doc_items/paragraph"
         
     | 
| 
       4 
     | 
    
         
            -
            require_relative "doc_items/blockquote"
         
     | 
| 
       5 
     | 
    
         
            -
            require_relative "doc_items/controlled_paragraph"
         
     | 
| 
       6 
     | 
    
         
            -
            require_relative "doc_items/markdown_table"
         
     | 
| 
       7 
     | 
    
         
            -
            require_relative "doc_items/image"
         
     | 
| 
       8 
     | 
    
         
            -
            require_relative "doc_items/markdown_list"
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            class Specification
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                attr_accessor :path
         
     | 
| 
       13 
     | 
    
         
            -
                attr_accessor :docItems
         
     | 
| 
       14 
     | 
    
         
            -
                attr_accessor :headings
         
     | 
| 
       15 
     | 
    
         
            -
                attr_accessor :title
         
     | 
| 
       16 
     | 
    
         
            -
                attr_accessor :key
         
     | 
| 
       17 
     | 
    
         
            -
                attr_accessor :up_link_key
         
     | 
| 
       18 
     | 
    
         
            -
                attr_accessor :dictionary
         
     | 
| 
       19 
     | 
    
         
            -
                attr_accessor :controlledParagraphs
         
     | 
| 
       20 
     | 
    
         
            -
                attr_accessor :tempMdTable
         
     | 
| 
       21 
     | 
    
         
            -
                attr_accessor :tempMdList
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                def initialize(fele_path)
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
                    @path = fele_path
         
     | 
| 
       26 
     | 
    
         
            -
                    @title = ""
         
     | 
| 
       27 
     | 
    
         
            -
                    @docItems = Array.new
         
     | 
| 
       28 
     | 
    
         
            -
                    @headings = Array.new
         
     | 
| 
       29 
     | 
    
         
            -
                    @controlledParagraphs = Array.new
         
     | 
| 
       30 
     | 
    
         
            -
                    @dictionary = Hash.new
         
     | 
| 
       31 
     | 
    
         
            -
                    @tempMdTable = nil
         
     | 
| 
       32 
     | 
    
         
            -
                    @tempMdList = nil
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                    @key = File.basename(fele_path, File.extname(fele_path)).upcase
         
     | 
| 
       35 
     | 
    
         
            -
                    @up_link_key = ""
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
                    self.parse()
         
     | 
| 
       38 
     | 
    
         
            -
                end
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                def parse()
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                    file = File.open( self.path )
         
     | 
| 
       43 
     | 
    
         
            -
                    file_lines = file.readlines     
         
     | 
| 
       44 
     | 
    
         
            -
                    file.close
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                    file_lines.each do |s|
         
     | 
| 
       47 
     | 
    
         
            -
                        if s.lstrip != ""
         
     | 
| 
       48 
     | 
    
         
            -
                            if res = /^([#]{1,})\s(.*)/.match(s)     # Heading    
         
     | 
| 
       49 
     | 
    
         
            -
                                
         
     | 
| 
       50 
     | 
    
         
            -
                                if @tempMdTable
         
     | 
| 
       51 
     | 
    
         
            -
                                    self.docItems.append(@tempMdTable)
         
     | 
| 
       52 
     | 
    
         
            -
                                    @tempMdTable = nil
         
     | 
| 
       53 
     | 
    
         
            -
                                end
         
     | 
| 
       54 
     | 
    
         
            -
                                if @tempMdList
         
     | 
| 
       55 
     | 
    
         
            -
                                    self.docItems.append(@tempMdList)
         
     | 
| 
       56 
     | 
    
         
            -
                                    @tempMdList = nil
         
     | 
| 
       57 
     | 
    
         
            -
                                end 
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
                                level = res[1].length
         
     | 
| 
       60 
     | 
    
         
            -
                                value = res[2]
         
     | 
| 
       61 
     | 
    
         
            -
                                item = Heading.new(value, level)
         
     | 
| 
       62 
     | 
    
         
            -
                                self.docItems.append(item)
         
     | 
| 
       63 
     | 
    
         
            -
                                self.headings.append(item)
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
                                if level == 1 && self.title == ""
         
     | 
| 
       66 
     | 
    
         
            -
                                    self.title = value
         
     | 
| 
       67 
     | 
    
         
            -
                                end   
         
     | 
| 
       68 
     | 
    
         
            -
                                 
         
     | 
| 
       69 
     | 
    
         
            -
                            elsif res = /^\[(\S*)\]\s+(.*)/.match(s)     # Controlled Paragraph
         
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
                                if @tempMdTable
         
     | 
| 
       72 
     | 
    
         
            -
                                    self.docItems.append(@tempMdTable)
         
     | 
| 
       73 
     | 
    
         
            -
                                    @tempMdTable = nil
         
     | 
| 
       74 
     | 
    
         
            -
                                end
         
     | 
| 
       75 
     | 
    
         
            -
                                if @tempMdList
         
     | 
| 
       76 
     | 
    
         
            -
                                    self.docItems.append(@tempMdList)
         
     | 
| 
       77 
     | 
    
         
            -
                                    @tempMdList = nil
         
     | 
| 
       78 
     | 
    
         
            -
                                end 
         
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
                                id = res[1]
         
     | 
| 
       81 
     | 
    
         
            -
                                text = res[2]
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
                                #check if it contains the uplink
         
     | 
| 
       84 
     | 
    
         
            -
                                if tmp = /(.*)\s+>\[(\S*)\]$/.match(text)
         
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
                                    text = tmp[1]
         
     | 
| 
       87 
     | 
    
         
            -
                                    up_link = tmp[2]
         
     | 
| 
       88 
     | 
    
         
            -
                                    
         
     | 
| 
       89 
     | 
    
         
            -
                                    if tmp = /^([a-zA-Z]+)[-]\d+/.match(up_link)
         
     | 
| 
       90 
     | 
    
         
            -
                                        self.up_link_key = tmp[1]
         
     | 
| 
       91 
     | 
    
         
            -
                                    end
         
     | 
| 
       92 
     | 
    
         
            -
                                end
         
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
                                item = ControlledParagraph.new( text, id )
         
     | 
| 
       95 
     | 
    
         
            -
                                item.up_link = up_link
         
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
                                self.docItems.append(item)
         
     | 
| 
       98 
     | 
    
         
            -
                                self.dictionary[ id.to_s ] = item           #for fast search
         
     | 
| 
       99 
     | 
    
         
            -
                                self.controlledParagraphs.append(item)      #for fast search
         
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
                            elsif res = /^[!]\[(.*)\]\((.*)\)/.match(s)     # Image
         
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
                                if @tempMdTable
         
     | 
| 
       104 
     | 
    
         
            -
                                    self.docItems.append(@tempMdTable)
         
     | 
| 
       105 
     | 
    
         
            -
                                    @tempMdTable = nil
         
     | 
| 
       106 
     | 
    
         
            -
                                end
         
     | 
| 
       107 
     | 
    
         
            -
                                if @tempMdList
         
     | 
| 
       108 
     | 
    
         
            -
                                    self.docItems.append(@tempMdList)
         
     | 
| 
       109 
     | 
    
         
            -
                                    @tempMdList = nil
         
     | 
| 
       110 
     | 
    
         
            -
                                end
         
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
                                img_text = res[1]
         
     | 
| 
       113 
     | 
    
         
            -
                                img_path = res[2]
         
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
                                item = Image.new( img_text, img_path )
         
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
                                self.docItems.append(item)
         
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
       119 
     | 
    
         
            -
                            elsif res = /^(\*\s?)+(.*)/.match(s)   #check if bullet list
         
     | 
| 
       120 
     | 
    
         
            -
                                
         
     | 
| 
       121 
     | 
    
         
            -
                                if @tempMdTable
         
     | 
| 
       122 
     | 
    
         
            -
                                    self.docItems.append(@tempMdTable)
         
     | 
| 
       123 
     | 
    
         
            -
                                    @tempMdTable = nil
         
     | 
| 
       124 
     | 
    
         
            -
                                end
         
     | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
       126 
     | 
    
         
            -
                                row = res[2]
         
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
                                if @tempMdList
         
     | 
| 
       129 
     | 
    
         
            -
                                    @tempMdList.addRow(row)
         
     | 
| 
       130 
     | 
    
         
            -
                                else
         
     | 
| 
       131 
     | 
    
         
            -
                                    item = MarkdownList.new(row)
         
     | 
| 
       132 
     | 
    
         
            -
                                    @tempMdList = item
         
     | 
| 
       133 
     | 
    
         
            -
                                end
         
     | 
| 
       134 
     | 
    
         
            -
             
     | 
| 
       135 
     | 
    
         
            -
                            elsif s[0] == '|'   #check if table
         
     | 
| 
       136 
     | 
    
         
            -
             
     | 
| 
       137 
     | 
    
         
            -
                                if @tempMdList
         
     | 
| 
       138 
     | 
    
         
            -
                                    self.docItems.append(@tempMdList)
         
     | 
| 
       139 
     | 
    
         
            -
                                    @tempMdList = nil
         
     | 
| 
       140 
     | 
    
         
            -
                                end
         
     | 
| 
       141 
     | 
    
         
            -
             
     | 
| 
       142 
     | 
    
         
            -
                                if res = /^[|](-{3,})[|]/.match(s) #check if it is a separator first
         
     | 
| 
       143 
     | 
    
         
            -
             
     | 
| 
       144 
     | 
    
         
            -
                                    if @tempMdTable 
         
     | 
| 
       145 
     | 
    
         
            -
                                        #separator is found after heading - just skip it
         
     | 
| 
       146 
     | 
    
         
            -
                                    else
         
     | 
| 
       147 
     | 
    
         
            -
                                        #separator out of table scope consider it just as a regular paragraph
         
     | 
| 
       148 
     | 
    
         
            -
                                        item = Paragraph.new(s)
         
     | 
| 
       149 
     | 
    
         
            -
                                        self.docItems.append(item)
         
     | 
| 
       150 
     | 
    
         
            -
                                    end
         
     | 
| 
       151 
     | 
    
         
            -
             
     | 
| 
       152 
     | 
    
         
            -
                                elsif res = /^[|](.*[|])/.match(s) #check if it looks as a table
         
     | 
| 
       153 
     | 
    
         
            -
             
     | 
| 
       154 
     | 
    
         
            -
                                    row = res[1]
         
     | 
| 
       155 
     | 
    
         
            -
             
     | 
| 
       156 
     | 
    
         
            -
                                    if @tempMdTable
         
     | 
| 
       157 
     | 
    
         
            -
                                        @tempMdTable.addRow(row)
         
     | 
| 
       158 
     | 
    
         
            -
                                    else
         
     | 
| 
       159 
     | 
    
         
            -
                                        #start table from heading
         
     | 
| 
       160 
     | 
    
         
            -
                                        @tempMdTable = MarkdownTable.new(row)
         
     | 
| 
       161 
     | 
    
         
            -
                                    end
         
     | 
| 
       162 
     | 
    
         
            -
                                end
         
     | 
| 
       163 
     | 
    
         
            -
             
     | 
| 
       164 
     | 
    
         
            -
                            elsif res = /^[>](.*)/.match(s)   #check if blockquote
         
     | 
| 
       165 
     | 
    
         
            -
             
     | 
| 
       166 
     | 
    
         
            -
                                if @tempMdTable
         
     | 
| 
       167 
     | 
    
         
            -
                                    self.docItems.append(@tempMdTable)
         
     | 
| 
       168 
     | 
    
         
            -
                                    @tempMdTable = nil
         
     | 
| 
       169 
     | 
    
         
            -
                                end
         
     | 
| 
       170 
     | 
    
         
            -
                                if @tempMdList
         
     | 
| 
       171 
     | 
    
         
            -
                                    self.docItems.append(@tempMdList)
         
     | 
| 
       172 
     | 
    
         
            -
                                    @tempMdList = nil
         
     | 
| 
       173 
     | 
    
         
            -
                                end 
         
     | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
       175 
     | 
    
         
            -
                                item = Blockquote.new(res[1])
         
     | 
| 
       176 
     | 
    
         
            -
                                self.docItems.append(item)
         
     | 
| 
       177 
     | 
    
         
            -
             
     | 
| 
       178 
     | 
    
         
            -
                            else # Reqular Paragraph
         
     | 
| 
       179 
     | 
    
         
            -
                                if @tempMdTable
         
     | 
| 
       180 
     | 
    
         
            -
                                    self.docItems.append(@tempMdTable)
         
     | 
| 
       181 
     | 
    
         
            -
                                    @tempMdTable = nil
         
     | 
| 
       182 
     | 
    
         
            -
                                end
         
     | 
| 
       183 
     | 
    
         
            -
                                if @tempMdList
         
     | 
| 
       184 
     | 
    
         
            -
                                    self.docItems.append(@tempMdList)
         
     | 
| 
       185 
     | 
    
         
            -
                                    @tempMdList = nil
         
     | 
| 
       186 
     | 
    
         
            -
                                end
         
     | 
| 
       187 
     | 
    
         
            -
             
     | 
| 
       188 
     | 
    
         
            -
                                item = Paragraph.new(s)
         
     | 
| 
       189 
     | 
    
         
            -
                                self.docItems.append(item)
         
     | 
| 
       190 
     | 
    
         
            -
                            end
         
     | 
| 
       191 
     | 
    
         
            -
                        end
         
     | 
| 
       192 
     | 
    
         
            -
                    end
         
     | 
| 
       193 
     | 
    
         
            -
                end
         
     | 
| 
       194 
     | 
    
         
            -
            end
         
     |