self.parseChildPagesFromParent

in _plugins/page_structure.rb [144:186]


    def self.parseChildPagesFromParent(page)
      
      $baseFile = Dir.pwd+"/"+(Pathname(page['path']).dirname.to_s)
      
      $listings = Dir[$baseFile+"/*"]
      
      $listings = $listings.select{ |i| i[/[\d\.]\_.*\.md/] }
      
      $listings = $listings.sort{ |x,y| Gem::Version.new((File.basename x).partition('_').first) <=> Gem::Version.new((File.basename y).partition('_').first)  }
      
      $allPages = []

      for $listing in $listings
        $textContent = ""
        yamlContent = nil
                
        
        $fileContent = IO.read($listing)
        
        $partitionedFileContent = $fileContent.split('---');
        
        if $partitionedFileContent.size > 2
          
          yamlContent = YAML.load($partitionedFileContent[1])
          
          if yamlContent != nil && yamlContent != false
            $textContent = $partitionedFileContent[2..-1].join('---')
          end
        end
        
        
        if $textContent == ""
          
          $textContent = $fileContent
        end
        
        ($allPages ||= []) << ChildPage.new(yamlContent, $textContent)
                
      end
      
      $allPages
    end