Class: Giblish::HtmlLayoutConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/giblish/configurator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource_paths, config_opts) ⇒ HtmlLayoutConfig

Returns a new instance of HtmlLayoutConfig.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/giblish/configurator.rb', line 16

def initialize(resource_paths, config_opts)
  @adoc_api_opts = {backend: "html"}
  @pre_builders = []
  @post_builders = []
  @adoc_extensions = {}
  @docattr_providers = []

  if resource_paths.src_resource_dir_abs && resource_paths.dst_style_path_rel
    # copy local resources to dst and link the generated html with
    # the given css
    @pre_builders << CopyResourcesPreBuild.new(resource_paths)

    # make sure generated html has relative link to the copied css
    @docattr_providers << RelativeCssDocAttr.new(resource_paths.dst_style_path_rel)
  elsif config_opts.server_css
    # do not copy any local resources, use the given web path to link to css
    @docattr_providers << AbsoluteLinkedCss.new(config_opts.server_css)
  end

  if config_opts.make_searchable
    # enabling text search
    search_provider = HeadingIndexer.new(config_opts.srcdir)
    @adoc_extensions[:tree_processor] = search_provider
    @post_builders << search_provider

    # add search form to all docs
    @adoc_extensions[:docinfo_processor] = AddSearchForm.new(config_opts.search_action_path)
  end
end

Instance Attribute Details

#adoc_api_optsObject (readonly)

Returns the value of attribute adoc_api_opts.



14
15
16
# File 'lib/giblish/configurator.rb', line 14

def adoc_api_opts
  @adoc_api_opts
end

#adoc_extensionsObject (readonly)

Returns the value of attribute adoc_extensions.



14
15
16
# File 'lib/giblish/configurator.rb', line 14

def adoc_extensions
  @adoc_extensions
end

#docattr_providersObject (readonly)

Returns the value of attribute docattr_providers.



14
15
16
# File 'lib/giblish/configurator.rb', line 14

def docattr_providers
  @docattr_providers
end

#post_buildersObject (readonly)

Returns the value of attribute post_builders.



14
15
16
# File 'lib/giblish/configurator.rb', line 14

def post_builders
  @post_builders
end

#pre_buildersObject (readonly)

Returns the value of attribute pre_builders.



14
15
16
# File 'lib/giblish/configurator.rb', line 14

def pre_builders
  @pre_builders
end