Ruby Document format

From Wikipedia, the free encyclopedia

RD is a lightweight markup language for writing Ruby related documents. It can be embeded in Ruby source code. RD is an abbreviation for Ruby Document.

RD is a traditional format. In modern, Ruby developers tend to write documents in RDoc instead of RD.

Contents

[edit] Use

RD was used for many documentation in the Ruby world. The documentation of Ruby itself has been written in RD. In 2002, the documenation was re-written in RDoc format. The Japanese version of Ruby Reference Manual is still written in RD.

RD is easy to read in the raw. It is designed to read or write by hand. But, in most case, end-users read it after converted into man pages or HTML pages.

Pure RD files usually have the extension .rd. RD can be embeded in Ruby code.

[edit] Sample RD document

This document is syntactically correct RD, which attempts to follow the major conventions on section naming as well.

Source HTML result
=begin
= NAME
RD sample - A sample RD document

= SYNOPSIS
 here.is_a?(Piece::Of::Code)
 print <<"END"
 This indented block will not be scanned for formatting
 codes or directives, and spacing will be preserved.
 END

= DESCRIPTION
Here's some normal text.  It includes text that is
((*emphasized*)), ((%keyboard%)), (({code}))-formatted,
and (('never-formatted'))((-footnote-)).

== An Example List
* This is a bulleted list.
* Here's another item.
  * Nested list item.
== An ordered List
(1) This is the first item
(2) second
    * Nested unordered list.
(3) third
    (1) Nested ordered list
    (2) its second item

=end
=begin html
<img src="Example.png" align="right" alt="Figure 1." />
<p>
    Here's some embedded HTML.  In this block I can 
    include images, apply <span style="color: green">
    styles</span>, or do anything else I can do with
    HTML.  RD processors that aren't outputting HTML will
    completely ignore it.
</p>
=end
=begin

= SEE ALSO
((<RD::RDTree>)), ((<RD::Visitor#visit|RD/Visitor/visit>)),
((<Ruby|URL:http://en.wikipedia.org/wiki/Ruby_%28programming_language%29>))

= COPYRIGHT
Copyright 2005 J. Random Hacker <jrh@cpan.org>.

Permission is granted to copy, distribute and/or modify this 
document under the terms of the GNU Free Documentation 
License, Version 1.2 or any later version published by the 
Free Software Foundation; with no Invariant Sections, with 
no Front-Cover Texts, and with no Back-Cover Texts.
=end

NAME

RD sample - A sample RD document

SYNOPSIS

here.is_a?(Piece::Of::Code)
print <<"END"
This indented block will not be scanned for formatting
codes or directives, and spacing will be preserved.
END

DESCRIPTION

Here's some normal text. It includes text that is emphasized, keyboard, code-formatted, and never-formatted*1.

An Example List

  • This is a bulleted list.
  • Here's another item.
    • Nested list item.

An ordered List

  1. This is the first item
  2. second
    • Nested unordered list.
  3. third
    1. Nested ordered list
    2. its second item
Figure 1.
Figure 1.

Here's some embedded HTML. In this block I can include images, apply styles, or do anything else I can do with HTML. RD processors that aren't outputting HTML will completely ignore it.

SEE ALSO

RD::RDTree, RD::Visitor#visit, Ruby

COPYRIGHT

Copyright 2005 J. Random Hacker <jrh@cpan.org>.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts.


*1footnote

[edit] See Also

[edit] External links

  • RDtool - Framework to translate RD document into other formats.


Languages