Skip to content

Commit

Permalink
rename project to "md2man": better reflect purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
sunaku committed Dec 7, 2011
1 parent 316846b commit fb220e4
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 41 deletions.
36 changes: 22 additions & 14 deletions README.markdown
@@ -1,8 +1,8 @@
Redman - UNIX man pages in Markdown
md2man - write UNIX man pages in Markdown
==============================================================================

Redman is a Ruby library for converting [Markdown] documents into UNIX man
pages ([Roff] documents) using the awesome [Redcarpet2] library.
md2man is a Ruby library and command-line program that converts [Markdown]
documents into UNIX man pages (really [Roff] documents) using [Redcarpet2].

[Roff]: http://troff.org
[Markdown]: http://daringfireball.net/projects/markdown/
Expand All @@ -14,29 +14,37 @@ Installation

As a Ruby gem:

gem install redman
gem install md2man

As a Git clone:

git clone git://github.com/sunaku/redman
cd redman
git clone git://github.com/sunaku/md2man
cd md2man
bundle install

------------------------------------------------------------------------------
Usage
Command Usage
------------------------------------------------------------------------------

Read the manual page:

md2man --help

------------------------------------------------------------------------------
Library Usage
------------------------------------------------------------------------------

Use the default renderer:

require 'redman'
markdown = Redcarpet::Markdown.new(Redman::Roff, your_options_hash)
require 'md2man'
markdown = Redcarpet::Markdown.new(Md2man::Roff, your_options_hash)
your_roff_output = markdown.render(your_markdown_input)

Or extend it for yourself:

require 'redman'
require 'md2man'

class YourManpageRenderer < Redman::Roff
class YourManpageRenderer < Md2man::Roff
# ... your stuff here ...
# See Redcarpet::Render::Base documentation for more information:
# http://rdoc.info/github/tanoku/redcarpet/master/Redcarpet/Render/Base
Expand All @@ -46,10 +54,10 @@ Or extend it for yourself:
your_roff_output = markdown.render(your_markdown_input)

------------------------------------------------------------------------------
Specification
Document Format
------------------------------------------------------------------------------

Redman introduces the following additions to the core [Markdown] language:
md2man introduces the following additions to the core [Markdown] language:

* If a paragraph's first or subsequent lines are uniformly indented by two
spaces, then it is considered to be a "tagged paragraph" and its body is
Expand Down Expand Up @@ -117,7 +125,7 @@ Redman introduces the following additions to the core [Markdown] language:
Limitations
------------------------------------------------------------------------------

At present, Redman does not translate the following [Redcarpet2] node types:
At present, md2man does not translate the following [Redcarpet2] node types:

* `block_html`
* `strikethrough`
Expand Down
20 changes: 10 additions & 10 deletions bin/redman → bin/md2man
@@ -1,25 +1,25 @@
#!/usr/bin/env ruby
=begin
REDMAN 1 "2011-12-06" "1.0.0" "Ruby User Manuals"
=================================================
MD2MAN 1 "2011-12-06" "1.0.0"
=============================
NAME
----
redman - transforms markdown(7) into roff(7)
md2man - convert markdown(7) into roff(7)
SYNOPSIS
--------
`redman` [*OPTION*]... [*FILE*]
`md2man` [*OPTION*]... [*FILE*]
DESCRIPTION
-----------
Transforms markdown(7) input from the given *FILE* into roff(7) using
[Redcarpet2] and then prints the result to the standard output stream.
If *FILE* is not given, the standard input stream is read in its place.
This program converts markdown(7) input from the given *FILE* into roff(7)
using [Redcarpet2] and then prints the result to the standard output stream.
If *FILE* is not given, then the standard input stream is read in its place.
### Document Format
Expand Down Expand Up @@ -51,17 +51,17 @@ SEE ALSO
markdown(7), roff(7)
[Redman]: https://github.com/sunaku/redman
[md2man]: https://github.com/sunaku/md2man
[Redcarpet2]: https://github.com/tanoku/redcarpet
=end =========================================================================

require 'binman'
BinMan.help

require 'redman'
require 'md2man'
puts Redcarpet::Markdown.new(
Redman::Roff,
Md2man::Roff,
:tables => true,
:autolink => true,
:superscript => true,
Expand Down
2 changes: 2 additions & 0 deletions lib/md2man.rb
@@ -0,0 +1,2 @@
require 'md2man/version'
require 'md2man/roff'
14 changes: 7 additions & 7 deletions lib/redman/roff.rb → lib/md2man/roff.rb
@@ -1,6 +1,6 @@
require 'redcarpet'

module Redman
module Md2man
class Roff < Redcarpet::Render::Base

#-------------------------------------------------------------------------
Expand Down Expand Up @@ -57,7 +57,7 @@ def block_quote quote
end

def block_html html
warn "redman/roff: block_html not implemented: #{html.inspect}"
warn "md2man/roff: block_html not implemented: #{html.inspect}"
end

def header text, level
Expand Down Expand Up @@ -149,11 +149,11 @@ def triple_emphasis text
end

def strikethrough text
warn "redman/roff: strikethrough not implemented: #{text.inspect}"
warn "md2man/roff: strikethrough not implemented: #{text.inspect}"
end

def superscript text
warn "redman/roff: superscript not implemented: #{text.inspect}"
warn "md2man/roff: superscript not implemented: #{text.inspect}"
end

def codespan code
Expand All @@ -180,11 +180,11 @@ def autolink link, link_type
end

def image link, title, alt_text
warn "redman/roff: image not implemented: #{link.inspect}"
warn "md2man/roff: image not implemented: #{link.inspect}"
end

def raw_html html
warn "redman/roff: raw_html not implemented: #{html.inspect}"
warn "md2man/roff: raw_html not implemented: #{html.inspect}"
end

#-------------------------------------------------------------------------
Expand All @@ -199,7 +199,7 @@ def entity text
if unicode = entity_to_unicode(text)
unicode_to_glyph unicode
else
warn "redman/roff: entity not implemented: #{text.inspect}"
warn "md2man/roff: entity not implemented: #{text.inspect}"
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/redman/version.rb → lib/md2man/version.rb
@@ -1,3 +1,3 @@
module Redman
module Md2man
VERSION = "1.0.0"
end
2 changes: 0 additions & 2 deletions lib/redman.rb

This file was deleted.

8 changes: 4 additions & 4 deletions redman.gemspec → md2man.gemspec
@@ -1,14 +1,14 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "redman/version"
require "md2man/version"
require "binman/gemspec"

Gem::Specification.new do |s|
s.name = "redman"
s.version = Redman::VERSION
s.name = "md2man"
s.version = Md2man::VERSION
s.authors,
s.email = File.read('LICENSE').scan(/Copyright \d+ (.+) <(.+?)>/).transpose
s.homepage = "http://github.com/sunaku/redman"
s.homepage = "http://github.com/sunaku/md2man"
s.summary = "UNIX man pages using Redcarpet2"
s.description = nil

Expand Down
6 changes: 3 additions & 3 deletions test/redman/roff_test.rb → test/md2man/roff_test.rb
Expand Up @@ -7,12 +7,12 @@
# man 7 groff

require 'test_helper'
require 'redman/roff'
require 'md2man/roff'

describe Redman::Roff do
describe Md2man::Roff do
before do
@markdown = Redcarpet::Markdown.new(
Redman::Roff,
Md2man::Roff,
:tables => true,
:autolink => true,
:superscript => true,
Expand Down

0 comments on commit fb220e4

Please sign in to comment.