From 54ec1c4fe81672ca66f327ef6ae170f458cd79e5 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Wed, 15 Aug 2007 20:57:30 +0000 Subject: sorry. I made wrong tags. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_8_5_54@13009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- .../lib/rdoc/markup/simple_markup/preprocess.rb | 73 ---------------------- 1 file changed, 73 deletions(-) delete mode 100644 ruby_1_8_5/lib/rdoc/markup/simple_markup/preprocess.rb (limited to 'ruby_1_8_5/lib/rdoc/markup/simple_markup/preprocess.rb') diff --git a/ruby_1_8_5/lib/rdoc/markup/simple_markup/preprocess.rb b/ruby_1_8_5/lib/rdoc/markup/simple_markup/preprocess.rb deleted file mode 100644 index 101c9bdeb1..0000000000 --- a/ruby_1_8_5/lib/rdoc/markup/simple_markup/preprocess.rb +++ /dev/null @@ -1,73 +0,0 @@ -module SM - - ## - # Handle common directives that can occur in a block of text: - # - # : include : filename - # - - class PreProcess - - def initialize(input_file_name, include_path) - @input_file_name = input_file_name - @include_path = include_path - end - - # Look for common options in a chunk of text. Options that - # we don't handle are passed back to our caller - # as |directive, param| - - def handle(text) - text.gsub!(/^([ \t#]*):(\w+):\s*(.+)?\n/) do - prefix = $1 - directive = $2.downcase - param = $3 - - case directive - when "include" - filename = param.split[0] - include_file(filename, prefix) - - else - yield(directive, param) - end - end - end - - ####### - private - ####### - - # Include a file, indenting it correctly - - def include_file(name, indent) - if (full_name = find_include_file(name)) - content = File.open(full_name) {|f| f.read} - # strip leading '#'s, but only if all lines start with them - if content =~ /^[^#]/ - content.gsub(/^/, indent) - else - content.gsub(/^#?/, indent) - end - else - $stderr.puts "Couldn't find file to include: '#{name}'" - '' - end - end - - # Look for the given file in the directory containing the current - # file, and then in each of the directories specified in the - # RDOC_INCLUDE path - - def find_include_file(name) - to_search = [ File.dirname(@input_file_name) ].concat @include_path - to_search.each do |dir| - full_name = File.join(dir, name) - stat = File.stat(full_name) rescue next - return full_name if stat.readable? - end - nil - end - - end -end -- cgit v1.2.3