Sha256: c660352954299fda8716d4ab06075ffae81625839bebf0462e65cd1a60b71990

Contents?: true

Size: 1.03 KB

Versions: 8

Compression:

Stored size: 1.03 KB

Contents

require 'set'

class ListPluginParametersTag < Tags::DefaultTag

  infos( :name => 'WebgenDocu/PluginParameterRefTag',
         :summary => "Lists all available plugin parameters"
         )

  register_tag 'listPluginParameters'

  def initialize( plugin_manager )
    super
    @process_output = false
  end

  def process_tag( tag, chain )
    plugins = @plugin_manager.plugins.select {|k,v| k !~ /^WebgenDocu/ }

    mydata = {}
    plugins.each do |name, plugin|
      next if plugin.class.config.params.empty?
      (mydata[name[/^.*?(?=\/)/].gsub(/([A-Z][a-z])/, ' \1').strip] ||= []) << plugin
    end

    output = "<dl>\n"
    mydata.sort.each do |cat, plugins|
      output << "<dt>#{cat}</dt><dd><dl>"
      plugins.sort {|a,b| a.class.plugin_name <=> b.class.plugin_name}.each do |data|
        output << "<dt>#{data.class.plugin_name}</dt>\n"
        output << "<dd>#{@plugin_manager['WebgenDocu/DescribeTag'].format_params( data.class.config.params )}</dd>\n"
      end
      output << "</dl></dd>"
    end
    output << "</dl>\n"
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
webgen-0.4.2 doc/plugin/listpluginparameters.rb
webgen-0.4.0 doc/plugin/listpluginparameters.rb
webgen-0.4.1 doc/plugin/listpluginparameters.rb
webgen-0.4.5 doc/plugin/listpluginparameters.rb
webgen-0.4.3 doc/plugin/listpluginparameters.rb
webgen-0.4.4 doc/plugin/listpluginparameters.rb
webgen-0.4.6 doc/plugin/listpluginparameters.rb
webgen-0.4.7 doc/plugin/listpluginparameters.rb