Class: Kramdown::Man::Task
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Kramdown::Man::Task
- Defined in:
- lib/kramdown/man/task.rb
Overview
Defines a man
rake task that generates man-pages within the man/
directory from .md
files.
Constant Summary collapse
- FILES =
Markdown file glob pattern
'man/{**/}*.{markdown,mkd,md}'
Instance Attribute Summary collapse
-
#options ⇒ Hash
readonly
Additional options.
Instance Method Summary collapse
-
#define ⇒ Object
protected
Defines the
man
tasks. -
#initialize(options = {}) ⇒ Task
constructor
Initializes the tasks.
-
#render(markdown, man_page) ⇒ Object
protected
Renders a man_page from a markdown file.
Constructor Details
Instance Attribute Details
#options ⇒ Hash (readonly)
Additional options
22 23 24 |
# File 'lib/kramdown/man/task.rb', line 22 def @options end |
Instance Method Details
#define ⇒ Object (protected)
Defines the man
tasks.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/kramdown/man/task.rb', line 43 def define desc 'Build UNIX manual pages from Markdown files in man/' task 'man' => @man_pages @markdown.zip(@man_pages).each do |markdown,man_page| file(man_page => markdown) do render(markdown,man_page) end end end |
#render(markdown, man_page) ⇒ Object (protected)
Renders a man_page from a markdown file.
63 64 65 66 67 68 69 |
# File 'lib/kramdown/man/task.rb', line 63 def render(markdown,man_page) doc = Kramdown::Document.new(File.read(markdown),@options) File.open(man_page,'w') do |output| output.write doc.to_man end end |