Module Webgen::Configuration::Helpers
In: lib/webgen/configuration.rb
Error RenderError CommandNotFoundError LoadError NodeCreationError ::Rake::TaskLib WebgenTask Node Context\n[lib/webgen/context.rb\nlib/webgen/context/nodes.rb\nlib/webgen/context/render.rb\nlib/webgen/context/tags.rb] Tree FileSystem Sitemap Feed Copy Virtual Sitemap Directory Page Fragment Template Memory Metainfo Coderay Sitemap IncludeFile BreadcrumbTrail Langbar TikZ Menu Tags Fragments Resource Website Tidy Head Less Kramdown Xmllint Blocks Helpers Configuration Comparable Language Path StandardError CmdParse::CommandParser CommandParser CmdParse::Command RunCommand CreateCommand WebguiCommand ApplyCommand WebsiteAccess Main Loggable OutputPathHelpers ExecuteCommand Link Date Relocatable Metainfo ::Kramdown::Converter::Html KramdownHtmlConverter Cache Blackboard WebsiteManager Logger Page ProxyNode Utils Scss RDoc Sass Erb RDiscount Erubis Haml Maruku Builder RedCloth AccessHash TarArchive Stacked FileSystem lib/webgen/cache.rb lib/webgen/error.rb lib/webgen/languages.rb lib/webgen/website.rb lib/webgen/blackboard.rb lib/webgen/tree.rb lib/webgen/websitemanager.rb lib/webgen/logger.rb lib/webgen/context/tags.rb lib/webgen/configuration.rb lib/webgen/path.rb lib/webgen/webgentask.rb lib/webgen/page.rb lib/webgen/node.rb lib/webgen/cli/run_command.rb lib/webgen/cli/utils.rb lib/webgen/cli/apply_command.rb lib/webgen/cli/webgui_command.rb lib/webgen/cli.rb lib/webgen/cli/create_command.rb Color CLI ClassMethods WebsiteAccess LanguageManager lib/webgen/output/filesystem.rb Output lib/webgen/common/sitemap.rb Common lib/webgen/sourcehandler/metainfo.rb lib/webgen/sourcehandler/memory.rb lib/webgen/sourcehandler/copy.rb lib/webgen/sourcehandler/directory.rb lib/webgen/sourcehandler.rb lib/webgen/sourcehandler/page.rb lib/webgen/sourcehandler/template.rb lib/webgen/sourcehandler/fragment.rb lib/webgen/sourcehandler/sitemap.rb lib/webgen/sourcehandler/virtual.rb lib/webgen/sourcehandler/feed.rb OutputPathHelpers Base SourceHandler lib/webgen/tag/coderay.rb lib/webgen/tag/relocatable.rb lib/webgen/tag/menu.rb lib/webgen/tag/langbar.rb lib/webgen/tag/executecommand.rb lib/webgen/tag/breadcrumbtrail.rb lib/webgen/tag/metainfo.rb lib/webgen/tag/link.rb lib/webgen/tag/includefile.rb lib/webgen/tag/date.rb lib/webgen/tag/tikz.rb lib/webgen/tag/sitemap.rb Base Tag lib/webgen/contentprocessor/less.rb lib/webgen/contentprocessor/scss.rb lib/webgen/contentprocessor/blocks.rb lib/webgen/contentprocessor/rdoc.rb lib/webgen/contentprocessor/sass.rb lib/webgen/contentprocessor/erb.rb lib/webgen/contentprocessor/rdiscount.rb lib/webgen/contentprocessor/tags.rb lib/webgen/contentprocessor/erubis.rb lib/webgen/contentprocessor/kramdown/html.rb lib/webgen/contentprocessor/haml.rb lib/webgen/contentprocessor/maruku.rb lib/webgen/contentprocessor/xmllint.rb lib/webgen/contentprocessor/kramdown.rb lib/webgen/contentprocessor/head.rb lib/webgen/contentprocessor/builder.rb lib/webgen/contentprocessor/tidy.rb lib/webgen/contentprocessor/redcloth.rb lib/webgen/contentprocessor/fragments.rb lib/webgen/contentprocessor.rb ContentProcessor lib/webgen/source/tararchive.rb lib/webgen/source/stacked.rb lib/webgen/source/resource.rb lib/webgen/source/filesystem.rb Source Loggable Webgen dot/m_81_0.png

This module provides methods for setting more complex configuration options. It is mixed into Webgen::Configuration so that its methods can be used. Detailed information on the use of the methods can be found in the "User Manual" in the "Configuration File" section.

All public methods defined in this module are available for direct use in the configuration file, e.g. the method named default_meta_info can be used like this:

  default_meta_info:
    Webgen::SourceHandler::Page:
      in_menu : true
      :action : replace

All methods have to take exactly one argument, a Hash.

The special key :action should be used for specifying how the configuration option should be set:

replace
Replace the configuration option with the new values.
modify
Replace old values with new values and add missing ones (useful for hashes and normally the default value)

Methods

Public Instance methods

Set the default meta information for source handlers.

[Source]

    # File lib/webgen/configuration.rb, line 64
64:       def default_meta_info(args)
65:         args.each do |sh_name, mi|
66:           raise ArgumentError, 'Invalid argument for configuration helper default_meta_info' unless mi.kind_of?(Hash)
67:           action = mi.delete(:action) || 'modify'
68:           mi_hash = (self['sourcehandler.default_meta_info'][complete_source_handler_name(sh_name)] ||= {})
69:           case action
70:           when 'replace' then mi_hash.replace(mi)
71:           else mi_hash.update(mi)
72:           end
73:         end
74:       end

Set the default processing pipeline for a source handler.

[Source]

     # File lib/webgen/configuration.rb, line 94
 94:       def default_processing_pipeline(args)
 95:         args.each do |sh_name, pipeline|
 96:           raise ArgumentError, 'Invalid argument for configuration helper pipeline' unless pipeline.kind_of?(String)
 97:           mi_hash = (self['sourcehandler.default_meta_info'][complete_source_handler_name(sh_name)] ||= {})
 98:           ((mi_hash['blocks'] ||= {})['default'] ||= {})['pipeline'] = pipeline
 99:         end
100:       end

Set the path patterns used by source handlers.

[Source]

    # File lib/webgen/configuration.rb, line 78
78:       def patterns(args)
79:         args.each do |sh_name, data|
80:           pattern_arr = (self['sourcehandler.patterns'][complete_source_handler_name(sh_name)] ||= [])
81:           case data
82:           when Array then pattern_arr.replace(data)
83:           when Hash
84:             (data['del'] || []).each {|pat| pattern_arr.delete(pat)}
85:             (data['add'] || []).each {|pat| pattern_arr << pat}
86:           else
87:             raise ArgumentError, 'Invalid argument for configuration helper patterns'
88:           end
89:         end
90:       end

Private Instance methods

Complete sh_name by checking if a source handler called Webgen::SourceHandler::SH_NAME exists.

[Source]

     # File lib/webgen/configuration.rb, line 105
105:       def complete_source_handler_name(sh_name)
106:         (Webgen::SourceHandler.constants.map {|c| c.to_s}.include?(sh_name) ? 'Webgen::SourceHandler::' + sh_name : sh_name)
107:       end

[Validate]