Method: Deplate::Core#add_index
- Defined in:
- lib/deplate/core.rb
#add_index(container, names, level_as_string = '') ⇒ Object
Register a new index entry.
2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 |
# File 'lib/deplate/core.rb', line 2988 def add_index(container, names, level_as_string='') @index_last_idx += 1 id = "idx00#{@index_last_idx}" words = names.split(/\s*\|\s*/) lname = Deplate::Core.remove_backslashes(words[0]) if container # container = container.top_container || container level_as_string = container.level_as_string end if @options.dont_index.delete(lname) return nil else i = @index[lname] unless i i = @index.find do |k, a| a.find do |i| i.synonymes.find {|j| words.include?(j)} end end if i lname = i[0] i = @index[lname] end end if @options.each f = file_with_suffix(File.basename(@current_source), @options.suffix, true) elsif @options.multi_file_output f = nil else f = @dest end d = Deplate::IndexEntry.new(container) do |idx| idx.name = lname idx.synonymes = words idx.label = id idx.file = f idx.level_as_string = level_as_string end if i i << d else @index[lname] = [d] end return d end end |