123456789_123456789_123456789_123456789_123456789_

Class: RDoc::Markup::ToJoinedParagraph

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Formatter
Instance Chain:
self, Formatter
Inherits: RDoc::Markup::Formatter
Defined in: lib/rdoc/markup/to_joined_paragraph.rb

Overview

Joins the parts of an Paragraph into a single String.

This allows for easier maintenance and testing of ::RDoc::Markdown support.

This formatter only works on Paragraph instances. Attempting to process other markup syntax items will not work.

Class Method Summary

Formatter - Inherited

.gen_relative_url

Converts a target url to one that is relative to a given path.

.new

Creates a new Formatter.

Instance Attribute Summary

Formatter - Inherited

#in_tt?

Are we currently inside tt tags?

Instance Method Summary

Formatter - Inherited

#accept_document

Adds document to the output.

#add_special_RDOCLINK

Adds a special for links of the form rdoc-…:

#add_special_TIDYLINK

Adds a special for links of the form <text> and <#add_tag

Add a new set of tags for an attribute.

#annotate

Allows tag to be decorated with additional information.

#convert

Marks up content

#convert_flow

Converts flow items flow

#convert_special

Converts added specials.

#convert_string

Converts a string to be fancier if desired.

#ignore

Use ignore in your subclass to ignore the content of a node.

#off_tags

Turns off tags for item on res

#on_tags

Turns on tags for item on res

#parse_url

Extracts and a scheme, url and an anchor id from url and returns them.

#tt?

Is tag a tt tag?

Constructor Details

This class inherits a constructor from RDoc::Markup::Formatter

Instance Method Details

#accept_block_quote(*node)

[ GitHub ]

  
# File 'lib/rdoc/markup/to_joined_paragraph.rb', line 60

alias accept_block_quote     ignore

#accept_heading(*node)

[ GitHub ]

  
# File 'lib/rdoc/markup/to_joined_paragraph.rb', line 61

alias accept_heading         ignore

#accept_list_end(*node)

[ GitHub ]

  
# File 'lib/rdoc/markup/to_joined_paragraph.rb', line 62

alias accept_list_end        ignore

#accept_list_item_end(*node)

[ GitHub ]

  
# File 'lib/rdoc/markup/to_joined_paragraph.rb', line 63

alias accept_list_item_end   ignore

#accept_list_item_start(*node)

[ GitHub ]

  
# File 'lib/rdoc/markup/to_joined_paragraph.rb', line 64

alias accept_list_item_start ignore

#accept_list_start(*node)

[ GitHub ]

  
# File 'lib/rdoc/markup/to_joined_paragraph.rb', line 65

alias accept_list_start      ignore

#accept_paragraph(paragraph)

Converts the parts of paragraph to a single entry.

[ GitHub ]

  
# File 'lib/rdoc/markup/to_joined_paragraph.rb', line 24

def accept_paragraph paragraph
  parts = []
  string = false

  paragraph.parts.each do |part|
    if String === part then
      if string then
        string << part
      else
        parts << part
        string = part
      end
    else
      parts << part
      string = false
    end
  end

  parts = parts.map do |part|
    if String === part then
      part.rstrip
    else
      part
    end
  end

  # TODO use Enumerable#chunk when Ruby 1.8 support is dropped
  #parts = paragraph.parts.chunk do |part|
  #  String === part
  #end.map do |string, chunk|
  #  string ? chunk.join.rstrip : chunk
  #end.flatten

  paragraph.parts.replace parts
end

#accept_raw(*node)

[ GitHub ]

  
# File 'lib/rdoc/markup/to_joined_paragraph.rb', line 66

alias accept_raw             ignore

#accept_rule(*node)

[ GitHub ]

  
# File 'lib/rdoc/markup/to_joined_paragraph.rb', line 67

alias accept_rule            ignore

#accept_verbatim(*node)

[ GitHub ]

  
# File 'lib/rdoc/markup/to_joined_paragraph.rb', line 68

alias accept_verbatim        ignore