diff --git a/lib/ruby-rtf/document.rb b/lib/ruby-rtf/document.rb index b6f209a..5c28067 100644 --- a/lib/ruby-rtf/document.rb +++ b/lib/ruby-rtf/document.rb @@ -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? @@ -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 diff --git a/lib/ruby-rtf/parser.rb b/lib/ruby-rtf/parser.rb index 0d19095..e7145a6 100644 --- a/lib/ruby-rtf/parser.rb +++ b/lib/ruby-rtf/parser.rb @@ -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) @@ -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) @@ -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)