Skip to content

Commit

Permalink
some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dj2 committed Feb 22, 2011
1 parent 66ef293 commit 04c0a9f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/ruby-rtf/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def initialize
@sections = [{:text => '', :modifiers => {}}]
end

# Add a new section to the document
# @note If there is no text added to the current section this does nothing
#
# @return [Nil]
def add_section!
return if current_section[:text].empty?

Expand All @@ -38,10 +42,16 @@ def add_section!
@sections << {:text => '', :modifiers => mods}
end

# Reset the current section to default settings
#
# @return [Nil]
def reset_section!
current_section[:modifiers] = {}
end

# Retrieve the current section for the document
#
# @return [Hash] The document section data
def current_section
@sections.last
end
Expand Down
24 changes: 24 additions & 0 deletions lib/ruby-rtf/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ def self.parse_colour_table(src, current_pos, doc)
current_pos
end

# Parses the stylesheet group
#
# @param src [String] The source document
# @param current_pos [Integer] The starting position
# @param doc [RubyRTF::Document] The document
# @return [Integer] The new current position
#
# @api private
def self.parse_stylesheet(src, current_pos, doc)
group = 1
while (true)
Expand All @@ -242,6 +250,14 @@ def self.parse_stylesheet(src, current_pos, doc)
current_pos
end

# Parses the info group
#
# @param src [String] The source document
# @param current_pos [Integer] The starting position
# @param doc [RubyRTF::Document] The document
# @return [Integer] The new current position
#
# @api private
def self.parse_info(src, current_pos, doc)
group = 1
while (true)
Expand All @@ -257,6 +273,14 @@ def self.parse_info(src, current_pos, doc)
current_pos
end

# Parses a comment group
#
# @param src [String] The source document
# @param current_pos [Integer] The starting position
# @param doc [RubyRTF::Document] The document
# @return [Integer] The new current position
#
# @api private
def self.parse_skip(src, current_pos, doc)
group = 1
while (true)
Expand Down

0 comments on commit 04c0a9f

Please sign in to comment.