Class: Intranet::Pandoc::Responder
- Inherits:
-
AbstractResponder
- Object
- AbstractResponder
- Intranet::Pandoc::Responder
- Includes:
- Core::HamlWrapper
- Defined in:
- lib/intranet/pandoc/responder.rb
Overview
The responder for the Pandoc module of the Intranet.
Instance Attribute Summary collapse
-
#title ⇒ String
readonly
The title of the module instance, as displayed on the web page.
Class Method Summary collapse
-
.module_homepage ⇒ String
The homepage of the module.
-
.module_name ⇒ String
Returns the name of the module.
-
.module_version ⇒ String
The version of the module, according to semantic versionning.
Instance Method Summary collapse
-
#generate_page(path, query) ⇒ Integer, String
Generates the HTML content associated to the given
path
andquery
. -
#in_menu? ⇒ Boolean
Specifies if the responder instance should be displayed in the main navigation menu or not.
-
#initialize(logger, title, rootdir, template = nil, in_menu = true) ⇒ Responder
constructor
Initializes a new Pandoc responder instance.
-
#resources_dir ⇒ String
Specifies the absolute path to the resources directory for that module.
Constructor Details
#initialize(logger, title, rootdir, template = nil, in_menu = true) ⇒ Responder
Initializes a new Pandoc responder instance.
38 39 40 41 42 43 44 |
# File 'lib/intranet/pandoc/responder.rb', line 38 def initialize(logger, title, rootdir, template = nil, = true) @logger = logger @title = title @rootdir = rootdir @template = template @in_menu = end |
Instance Attribute Details
#title ⇒ String (readonly)
The title of the module instance, as displayed on the web page.
73 74 75 |
# File 'lib/intranet/pandoc/responder.rb', line 73 def title @title end |
Class Method Details
.module_homepage ⇒ String
The homepage of the module.
29 30 31 |
# File 'lib/intranet/pandoc/responder.rb', line 29 def self.module_homepage HOMEPAGE_URL end |
.module_name ⇒ String
Returns the name of the module.
17 18 19 |
# File 'lib/intranet/pandoc/responder.rb', line 17 def self.module_name NAME end |
.module_version ⇒ String
The version of the module, according to semantic versionning.
23 24 25 |
# File 'lib/intranet/pandoc/responder.rb', line 23 def self.module_version VERSION end |
Instance Method Details
#generate_page(path, query) ⇒ Integer, String
Generates the HTML content associated to the given path
and query
.
63 64 65 66 67 68 69 |
# File 'lib/intranet/pandoc/responder.rb', line 63 def generate_page(path, query) case path when %r{^/.+\.html$} then serve_page(path.gsub(%r{^/(.+)\.html$}, '\\1')) when %r{^/.+\.(jpg|png|svg)$} then serve_media(path.gsub(%r{^/(.+)$}, '\\1')) else super(path, query) end end |
#in_menu? ⇒ Boolean
Specifies if the responder instance should be displayed in the main navigation menu or not.
49 50 51 |
# File 'lib/intranet/pandoc/responder.rb', line 49 def @in_menu end |
#resources_dir ⇒ String
Specifies the absolute path to the resources directory for that module.
55 56 57 |
# File 'lib/intranet/pandoc/responder.rb', line 55 def resources_dir File.absolute_path(File.join('..', 'resources'), __dir__) end |