Class: Jekyll::WikiRefs::PluginConfig
- Inherits:
-
Object
- Object
- Jekyll::WikiRefs::PluginConfig
- Defined in:
- lib/jekyll-wikirefs/config.rb
Constant Summary collapse
- ATTR_KEY =
"attributes"
- CONFIG_KEY =
"wikirefs"
- ENABLED_KEY =
"enabled"
- EXCLUDE_KEY =
"exclude"
- CSS_KEY =
css-related
"css"
- NAME_KEY =
"name"
- TYPED_KEY =
names valid
"typed"
- WEB_KEY =
"web"
- WIKI_KEY =
"wiki"
- INV_WIKI_KEY =
invalid
"invalid_wiki"
- EMBED_WRAPPER_KEY =
INV_WEB_KEY = “invalid_web” embed
"embed_wrapper"
- EMBED_TITLE_KEY =
"embed_title"
- EMBED_CONTENT_KEY =
"embed_content"
- EMBED_LINK_KEY =
"embed_wiki_link"
- EMBED_IMG_WRAPPER_KEY =
"embed_image_wrapper"
- EMBED_IMG_KEY =
"embed_image"
Instance Method Summary collapse
-
#css_name(name_key) ⇒ Object
util.
- #disabled? ⇒ Boolean
- #disabled_attributes? ⇒ Boolean
- #exclude?(type) ⇒ Boolean
- #excluded_css_names ⇒ Object
-
#initialize(config) ⇒ PluginConfig
constructor
A new instance of PluginConfig.
- #old_config_warn ⇒ Object
-
#option(key) ⇒ Object
options.
- #option_attributes(key) ⇒ Object
- #option_css(key) ⇒ Object
- #option_css_name(key) ⇒ Object
-
#option_exist?(key) ⇒ Boolean
!! deprecated !!.
Constructor Details
#initialize(config) ⇒ PluginConfig
Returns a new instance of PluginConfig.
32 33 34 35 36 |
# File 'lib/jekyll-wikirefs/config.rb', line 32 def initialize(config) @config ||= config self.old_config_warn() Jekyll.logger.debug("Jekyll-WikiRefs: Excluded jekyll types: #{option(EXCLUDE_KEY)}") unless disabled? end |
Instance Method Details
#css_name(name_key) ⇒ Object
util
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/jekyll-wikirefs/config.rb', line 40 def css_name(name_key) return option_css_name(name_key) if option_css_name(name_key) return "typed" if name_key == TYPED_KEY # valid return "wiki-link" if name_key == WIKI_KEY # invalid return "invalid-wiki-link" if name_key == INV_WIKI_KEY # return "invalid-web-link" if name_key == INV_WEB_KEY # embeds return "embed-wrapper" if name_key == EMBED_WRAPPER_KEY return "embed-title" if name_key == EMBED_TITLE_KEY return "embed-content" if name_key == EMBED_CONTENT_KEY return "embed-wiki-link" if name_key == EMBED_LINK_KEY # img return "embed-image-wrapper" if name_key == EMBED_IMG_WRAPPER_KEY return "embed-image" if name_key == EMBED_IMG_KEY end |
#disabled? ⇒ Boolean
58 59 60 |
# File 'lib/jekyll-wikirefs/config.rb', line 58 def disabled? option(ENABLED_KEY) == false end |
#disabled_attributes? ⇒ Boolean
62 63 64 |
# File 'lib/jekyll-wikirefs/config.rb', line 62 def disabled_attributes? option_attributes(ENABLED_KEY) == false end |
#exclude?(type) ⇒ Boolean
66 67 68 69 |
# File 'lib/jekyll-wikirefs/config.rb', line 66 def exclude?(type) return false unless option(EXCLUDE_KEY) return option(EXCLUDE_KEY).include?(type.to_s) end |
#excluded_css_names ⇒ Object
71 72 73 |
# File 'lib/jekyll-wikirefs/config.rb', line 71 def excluded_css_names return self.option_css(EXCLUDE_KEY) end |
#old_config_warn ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/jekyll-wikirefs/config.rb', line 99 def old_config_warn() if @config.include?("wikilinks_collection") Jekyll.logger.warn("Jekyll-WikiRefs: As of 0.0.3, 'wikilinks_collection' is no longer used for configs. Jekyll-WikiRefs will scan all markdown files by default. Check README for details.") end if option_exist?("assets_rel_path") Jekyll.logger.warn("Jekyll-WikiRefs: As of 0.0.5, 'assets_rel_path' is now 'path'.") end if @config.include?("d3_graph_data") Jekyll.logger.warn("Jekyll-WikiRefs: As of 0.0.6, 'd3_graph_data' and graph functionality have been moved to the 'jekyll-graph' plugin.") end end |
#option(key) ⇒ Object
options
77 78 79 |
# File 'lib/jekyll-wikirefs/config.rb', line 77 def option(key) @config[CONFIG_KEY] && @config[CONFIG_KEY][key] end |
#option_attributes(key) ⇒ Object
81 82 83 |
# File 'lib/jekyll-wikirefs/config.rb', line 81 def option_attributes(key) @config[CONFIG_KEY] && @config[CONFIG_KEY][ATTR_KEY] && @config[CONFIG_KEY][ATTR_KEY][key] end |
#option_css(key) ⇒ Object
85 86 87 |
# File 'lib/jekyll-wikirefs/config.rb', line 85 def option_css(key) @config[CONFIG_KEY] && @config[CONFIG_KEY][CSS_KEY] && @config[CONFIG_KEY][CSS_KEY][key] end |
#option_css_name(key) ⇒ Object
89 90 91 |
# File 'lib/jekyll-wikirefs/config.rb', line 89 def option_css_name(key) option_css(NAME_KEY) && @config[CONFIG_KEY][CSS_KEY][NAME_KEY][key] end |
#option_exist?(key) ⇒ Boolean
!! deprecated !!
95 96 97 |
# File 'lib/jekyll-wikirefs/config.rb', line 95 def option_exist?(key) @config[CONFIG_KEY] && @config[CONFIG_KEY].include?(key) end |