[#3419] Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...>

Hello list,

19 messages 2004/09/17
[#3422] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

[#3423] Re: Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...> 2004/09/17

On Friday 17 Sep 2004 12:01, ts wrote:

[#3424] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

[#3425] Re: Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...> 2004/09/17

On Friday 17 Sep 2004 12:37, ts wrote:

[#3426] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

[#3428] Re: Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...> 2004/09/17

On Friday 17 Sep 2004 13:05, ts wrote:

[#3429] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

RDoc Formatter Simple Mode

From: Eric Hodel <drbrain@...7.net>
Date: 2004-09-11 05:38:22 UTC
List: ruby-core #3379
For rbot's ri module I needed a more compact ri format than plain to
avoid flooding the bot off the server.  I added a 'simple' format that
strips out extra newlines and reduces lines to just their labels.  When
combined with a really large line width, the formatter is perfect for
use in an IRC bot.

-- 
Eric Hodel - drbrain@segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04

Attachments (1)

rdoc_simple_formatter.patch (2.23 KB, text/x-diff)
Index: ri_formatter.rb
===================================================================
RCS file: /src/ruby/lib/rdoc/ri/ri_formatter.rb,v
retrieving revision 1.11
diff -u -9 -p -r1.11 ri_formatter.rb
--- ri_formatter.rb	24 Mar 2004 19:17:13 -0000	1.11
+++ ri_formatter.rb	11 Sep 2004 05:17:36 -0000
@@ -1,22 +1,23 @@
 module RI
   class TextFormatter
 
     def TextFormatter.list
-      "plain, html, bs, ansi"
+      "plain, html, bs, ansi, simple"
     end
 
     def TextFormatter.for(name)
       case name
-      when /plain/i then TextFormatter
-      when /html/i  then HtmlFormatter
-      when /bs/i    then OverstrikeFormatter
-      when /ansi/i  then AnsiFormatter
+      when /plain/i  then TextFormatter
+      when /html/i   then HtmlFormatter
+      when /bs/i     then OverstrikeFormatter
+      when /ansi/i   then AnsiFormatter
+      when /simple/i then SimpleFormatter
       else nil
       end
     end
 
     attr_reader :indent
     
     def initialize(options, indent)
       @options = options
       @width   = options.width
@@ -585,15 +586,57 @@ module RI
         print("</#{code}>")
     end
 
     def escape(str)
       str.
           gsub(/&/n, '&amp;').
           gsub(/\"/n, '&quot;').
           gsub(/>/n, '&gt;').
           gsub(/</n, '&lt;')
+    end
+
+  end
+
+  ##################################################
+  
+  # This formatter reduces extra lines for a simpler output.
+  # It improves way output looks for tools like IRC bots.
+
+  class SimpleFormatter < TextFormatter
+
+    ######################################################################
+
+    # No extra blank lines
+
+    def blankline
+    end
+
+    ######################################################################
+
+    # Display labels only, no lines
+
+    def draw_line(label=nil)
+      unless label.nil? then
+        bold_print(label) 
+        puts
+      end
+    end
+
+    ######################################################################
+
+    # Place heading level indicators inline with heading.
+
+    def display_heading(text, level, indent)
+      case level
+      when 1
+        puts "= " + text.upcase
+      when 2
+        puts "-- " + text
+      else
+        print indent, text, "\n"
+      end
     end
 
   end
 end
 
 

In This Thread

Prev Next