Module: Jekyll::AgentMarkdown::SourceSettings
- Defined in:
- lib/jekyll/agent_markdown/document_settings.rb
Constant Summary collapse
- SOURCE_KINDS =
%i[post page collection].freeze
Class Method Summary collapse
- .collection_name(value, source_kind, document_path) ⇒ Object
- .error(document_path, message) ⇒ Object
- .kind(value, document_path) ⇒ Object
- .normalized_section(value) ⇒ Object
Class Method Details
.collection_name(value, source_kind, document_path) ⇒ Object
156 157 158 159 160 161 |
# File 'lib/jekyll/agent_markdown/document_settings.rb', line 156 def collection_name(value, source_kind, document_path) return nil unless source_kind == :collection return value.strip if value.is_a?(String) && !value.strip.empty? error(document_path, "collection_name must be a non-empty String; got #{value.inspect}") end |
.error(document_path, message) ⇒ Object
165 166 167 |
# File 'lib/jekyll/agent_markdown/document_settings.rb', line 165 def error(document_path, ) raise Jekyll::Errors::FatalException, "#{document_path}: #{}" end |
.kind(value, document_path) ⇒ Object
149 150 151 152 153 154 |
# File 'lib/jekyll/agent_markdown/document_settings.rb', line 149 def kind(value, document_path) source_kind = value.to_sym if value.respond_to?(:to_sym) return source_kind if SOURCE_KINDS.include?(source_kind) error(document_path, "unsupported source kind: #{value.inspect}") end |
.normalized_section(value) ⇒ Object
163 |
# File 'lib/jekyll/agent_markdown/document_settings.rb', line 163 def normalized_section(value) = value&.gsub(/\s+/, " ")&.strip |