File: resources.rb

package info (click to toggle)
webgen 0.3.8-3
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 1,912 kB
  • ctags: 586
  • sloc: ruby: 4,789; makefile: 9
file content (30 lines) | stat: -rw-r--r-- 985 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module WebgenDocuPlugins

  class PredefinedResourcesTag < Tags::DefaultTag

    summary "Creates a table of all predefined resources"

    tag 'predefinedResources'

    def initialize
      super
      @processOutput = false
    end

    def process_tag( tag, node, refNode )
      res = Webgen::Plugin.config[CorePlugins::ResourceManager].resources
      output = '<table style="width: 100%; border: 1px solid black" summary="List of predefined resources" rules="cols" frame="border">'
      output << '<thead><tr><th>Name</th><th>Type</th><th>Output path</th><th>Description</th></tr></thead>'
      output << '<tbody>'
      res.sort.each do |name, r|
        logger.info { "At resource #{r.name}..." }
        next unless r.predefined
        logger.info { "Describing resource #{r.name}..." }
        output << "<tr><td>#{r.name}</td><td>#{r.type.to_s}</td><td>#{r.output_path}</td><td>#{r.predefined}</td></tr>"
      end
      output << '</tbody></table>'
    end

  end

end