Changeset 282

Show
Ignore:
Timestamp:
03/18/2008 10:14:04 (8 months ago)
Author:
jgarber
Message:

Some very basic RDoc comments.

Location:
trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/README

    r272 r282  
    1 = RedCloth - Textile and Markdown Hybrid for Ruby 
     1= RedCloth - Textile parser for Ruby 
    22 
    33Homepage::  http://whytheluckystiff.net/ruby/redcloth/ 
    44Author::    why the lucky stiff (http://whytheluckystiff.net/) 
    5 Copyright:: (cc) 2004 why the lucky stiff (and his puppet organizations.) 
    6 License::   BSD 
     5Copyright:: (c) 2006 why the lucky stiff 
    76 
    8 (see http://hobix.com/textile/ for a Textile Reference.) 
    9  
    10 Based on (and also inspired by) both: 
    11  
    12 PyTextile: http://diveintomark.org/projects/textile/textile.py.txt 
    13 Textism for PHP: http://www.textism.com/tools/textile/ 
     7(See http://hobix.com/textile/ for a Textile reference.) 
    148 
    159= RedCloth 
    1610 
    17 RedCloth is a Ruby library for converting Textile and/or Markdown 
    18 into HTML.  You can use either format, intermingled or separately. 
    19 You can also extend RedCloth to honor your own custom text stylings. 
    20  
    21 RedCloth users are encouraged to use Textile if they are generating 
    22 HTML and to use Markdown if others will be viewing the plain text. 
     11RedCloth is a Ruby library for converting Textile into HTML. 
    2312 
    2413== What is Textile? 
     
    4332to the beginning of the paragraph. 
    4433 
    45  h[n].   Header of size [n]. 
     34 h3.     Header 3. 
    4635 bq.     Blockquote. 
    4736 #       Numeric list. 
     
    7362 
    7463Optional: text in (parentheses) following the link text,  
    75 but before the closing quotation mark, will become a Title  
     64but before the closing quotation mark, will become a title  
    7665attribute for the link, visible as a tool tip when a cursor is above it. 
    7766 
    7867Example: 
    7968 
    80  "This is a link (This is a title) ":http://www.textism.com 
     69 "This is a link (This is a title)":http://www.textism.com 
    8170 
    8271Will become: 
     
    131120== Adding Tables 
    132121 
    133 In Textile, simple tables can be added by seperating each column by 
     122In Textile, simple tables can be added by separating each column by 
    134123a pipe. 
    135124 
     
    137126    |And|Another|table|row| 
    138127 
    139 Attributes are defined by style definitions in parentheses. 
     128Styles are applied with curly braces. 
    140129 
    141     table(border:1px solid black). 
    142     (background:#ddd;color:red). |{}| | | | 
     130    table{border:1px solid black}. 
     131    {background:#ddd;color:red}. |a|red|row| 
    143132 
    144133== Using RedCloth 
     
    156145 puts doc.to_html 
    157146 
    158 By default, RedCloth uses both Textile and Markdown formatting, with 
    159 Textile formatting taking precedence.  If you want to turn off Markdown 
    160 formatting, to boost speed and limit the processor: 
    161  
    162  class RedCloth::Textile.new( str ) 
  • trunk/Rakefile

    r280 r282  
    7070    rdoc.main = "README" 
    7171    rdoc.title = "RedCloth Documentation" 
    72     rdoc.rdoc_files.add ['README', 'CHANGELOG', 'COPYING', 'lib/**/*.rb'] 
     72    rdoc.rdoc_files.add ['README', 'CHANGELOG', 'COPYING', 'lib/**/*.rb', 'ext/**/*.c'] 
    7373end 
    7474 
  • trunk/ext/redcloth_scan/redcloth_scan.rl

    r274 r282  
    226226} 
    227227 
     228/* 
     229 * Generates HTML from the Textile contents. 
     230 * 
     231 *   r = RedCloth.new( "And then? She *fell*!" ) 
     232 *   r.to_html 
     233 *     #=>"And then? She <strong>fell</strong>!" 
     234 */ 
    228235static VALUE 
    229236redcloth_to_html(self) 
     
    236243} 
    237244 
     245/* 
     246 * Generates LaTeX from the Textile contents. 
     247 * 
     248 *   r = RedCloth.new( "And then? She *fell*!" ) 
     249 *   r.to_latex 
     250 *     #=>"And then? She \\textbf{fell}!\n\n" 
     251 */ 
    238252static VALUE 
    239253redcloth_to_latex(self) 
     
    258272void Init_redcloth_scan() 
    259273{ 
     274 /* The RedCloth parser. See the README for Textile syntax. */ 
    260275  super_RedCloth = rb_define_class("RedCloth", rb_cString); 
    261276  rb_define_method(super_RedCloth, "to_html", redcloth_to_html, 0); 
     
    263278  rb_define_method(super_RedCloth, "to", redcloth_to, 1); 
    264279  super_ParseError = rb_define_class_under(super_RedCloth, "ParseError", rb_eException); 
     280  /* RedCloth HTML formatter. */ 
    265281  super_HTML  = rb_define_module_under(super_RedCloth, "HTML"); 
     282  /* RedCloth LaTeX formatter. */ 
    266283  super_LATEX = rb_define_module_under(super_RedCloth, "LATEX"); 
    267284  SYM_html_escape_entities = ID2SYM(rb_intern("html_escape_entities")); 
  • trunk/lib/redcloth.rb

    r281 r282  
    99  VERSION = '4.0.0' 
    1010   
    11   def initialize(input, opts=[]) 
    12     super(input) 
     11  # Returns a new RedCloth object, based on _string_. The  
     12  # _restrictions_ parameter is accepted for backwards 
     13  # compatibility but is not observed. 
     14  # 
     15  #   r = RedCloth.new( "h1. A *bold* man" ) 
     16  #   r.to_html 
     17  #     #=>"<h1>A <b>bold</b> man</h1>" 
     18  # 
     19  def initialize( string, restrictions = [] ) 
     20      super( string ) 
    1321  end 
    1422