Class: MemoRack::PageInfoMarkdown
- Defined in:
- lib/memorack/plugins/formats/markdown.rb
Instance Attribute Summary
Attributes inherited from PageInfo
Class Method Summary collapse
-
.extnames ⇒ Object
ファイル拡張子.
Instance Method Summary collapse
Methods inherited from PageInfo
#app, define_keys, #git?, #initialize, #log, #parse, #parse_end?, #value_to_time, #values
Methods included from Plugin
#<=>, #[], #extnames, #inherited, #member?, #plugins, #priority
Methods inherited from Locals
#[], #context, #context=, define_key, #define_key, #has_key?, #merge, #super_has_key?, #value, value_method, #value_method?
Constructor Details
This class inherits a constructor from MemoRack::PageInfo
Class Method Details
.extnames ⇒ Object
ファイル拡張子
10 11 12 |
# File 'lib/memorack/plugins/formats/markdown.rb', line 10 def self.extnames ['md', 'mkd', 'markdown'] end |
Instance Method Details
#accept_title(line, prev = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/memorack/plugins/formats/markdown.rb', line 14 def accept_title(line, prev = nil) case line when /^(\#{1,6}?)\s+(.+)$/ level = $1.length headline = $2.gsub(/\#+\s*$/, '').strip return headline when /^\s*([=\-])+\s*$/ return nil unless prev prev = prev.strip unless prev.empty? level = ($1 == '=') ? 1 : 2 return prev end end end |