cocoadex 1.4 → 1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. data/bin/cdex_completion +7 -0
  2. data/bin/cocoadex +5 -3
  3. data/changelog.md +5 -0
  4. data/lib/cocoadex/docset_helper.rb +8 -4
  5. data/lib/cocoadex/extensions.rb +4 -0
  6. data/lib/cocoadex/keyword.rb +30 -103
  7. data/lib/cocoadex/model.rb +56 -0
  8. data/lib/cocoadex/models/callback.rb +12 -0
  9. data/lib/cocoadex/models/class.rb +2 -2
  10. data/lib/cocoadex/models/constant.rb +41 -0
  11. data/lib/cocoadex/models/data_type.rb +47 -0
  12. data/lib/cocoadex/models/element.rb +14 -1
  13. data/lib/cocoadex/models/entity.rb +6 -0
  14. data/lib/cocoadex/models/function.rb +28 -0
  15. data/lib/cocoadex/models/generic_ref.rb +88 -0
  16. data/lib/cocoadex/models/method.rb +21 -70
  17. data/lib/cocoadex/models/nested_node_element.rb +17 -0
  18. data/lib/cocoadex/models/parameter.rb +20 -0
  19. data/lib/cocoadex/models/property.rb +3 -18
  20. data/lib/cocoadex/models/result_code.rb +17 -0
  21. data/lib/cocoadex/models/seq_node_element.rb +53 -0
  22. data/lib/cocoadex/parser.rb +22 -18
  23. data/lib/cocoadex/serializer.rb +18 -8
  24. data/lib/cocoadex/tokenizer.rb +123 -0
  25. data/lib/cocoadex/tools/completion_helper.rb +84 -0
  26. data/lib/cocoadex/version.rb +1 -1
  27. data/lib/cocoadex.rb +12 -10
  28. data/lib/ext/nil.rb +3 -0
  29. data/lib/ext/string.rb +9 -0
  30. data/lib/ext/template_helpers.rb +20 -0
  31. data/lib/ext/xml_element.rb +10 -0
  32. data/readme.md +36 -8
  33. data/views/class.erb +35 -0
  34. data/views/constant.erb +10 -0
  35. data/views/constant_group.erb +28 -0
  36. data/views/data_type.erb +47 -0
  37. data/views/generic_ref.erb +28 -0
  38. data/views/method.erb +34 -0
  39. data/views/multiple.erb +4 -0
  40. data/views/property.erb +14 -0
  41. data/views/result_code.erb +7 -0
  42. metadata +50 -10
  43. data/bin/cocoadex_completion.sh +0 -36
  44. data/lib/cocoadex/templates.rb +0 -114
@@ -0,0 +1,17 @@
1
+
2
+ module Cocoadex
3
+ # An element of a section where each item
4
+ # is divided into its own div element
5
+ class NestedNodeElement < Element
6
+
7
+ def parse_properties node
8
+ @abstract = node.css(".abstract").first.text
9
+ @declaration = node.css(".declaration").first.text
10
+ @declared_in = node.css(".declaredIn code.HeaderFile").first.text
11
+ @discussion = node.css(".discussion > p").first.text
12
+ @return_value = node.css(".return_value p").first.text
13
+ @return_value = nil if @return_value.empty?
14
+ @availability = node.css(".availability > ul > li").first.text
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+
2
+ module Cocoadex
3
+ class Parameter
4
+ include Comparable
5
+
6
+ attr_reader :name, :description
7
+
8
+ def initialize name, description
9
+ @name, @description = name, description
10
+ end
11
+
12
+ def to_s
13
+ "#{name} - #{description}"
14
+ end
15
+
16
+ def <=> other
17
+ name <=> other.name if other.respond_to? :name
18
+ end
19
+ end
20
+ end
@@ -1,8 +1,8 @@
1
1
 
2
2
  module Cocoadex
3
3
  # A Cocoa API class property
4
- class Property < Element
5
- TEMPLATE=Cocoadex::Templates::PROPERTY_DESCRIPTION
4
+ class Property < NestedNodeElement
5
+ TEMPLATE_NAME=:property
6
6
 
7
7
  attr_reader :abstract, :declaration, :discussion,
8
8
  :availability, :parent
@@ -10,23 +10,8 @@ module Cocoadex
10
10
  def initialize parent_class, node
11
11
  @parent = parent_class
12
12
  @name = node.css("h3.method_property").first.text
13
- logger.debug("Adding property: #{@name}")
14
13
 
15
- if abs = node.css(".abstract") and abs.length > 0
16
- @abstract = abs.first.text
17
- end
18
-
19
- if decl = node.css(".declaration") and decl.length > 0
20
- @declaration = decl.first.text
21
- end
22
-
23
- if disc = node.css(".discussion > p") and disc.length > 0
24
- @discussion = disc.first.text
25
- end
26
-
27
- if ava_nodes = node.css(".availability > ul > li") and ava_nodes.size > 0
28
- @availability = ava_nodes.first.text
29
- end
14
+ parse_properties(node)
30
15
  end
31
16
 
32
17
  def origin
@@ -0,0 +1,17 @@
1
+
2
+ module Cocoadex
3
+ class ResultCode < Element
4
+ TEMPLATE_NAME=:result_code
5
+
6
+ attr_reader :value, :description
7
+
8
+ def initialize origin, name, value, description
9
+ @origin = origin
10
+ @name, @value, @description = name, value, description
11
+ end
12
+
13
+ def origin
14
+ @origin
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,53 @@
1
+
2
+ module Cocoadex
3
+ # An element of a section where each item
4
+ # is divided by anchor tags
5
+ class SequentialNodeElement < Element
6
+ Abstract = ->(node) { node.classes.include? "abstract" }
7
+ Declaration = ->(node) { node.classes.include? "declaration" }
8
+ ReturnValue = ->(node) { node.classes.include? "return_value" }
9
+ Discussion = ->(node) { node.classes.include? "discussion" }
10
+ Availability = ->(node) { node.classes.include? "availability" }
11
+ DeclaredIn = ->(node) { node.classes.include? "declaredIn" }
12
+ Special = ->(node) { node.classes.include? "specialConsiderations" }
13
+
14
+ def initialize origin, title_node
15
+ @origin = origin
16
+ @name = title_node.text
17
+ parse(title_node)
18
+ end
19
+
20
+ def origin
21
+ @origin
22
+ end
23
+
24
+ def parse title_node
25
+ prev_node = title_node
26
+ while node = prev_node.next and node.name != "a"
27
+ case node
28
+ when Abstract
29
+ @abstract = node.text
30
+ when Declaration
31
+ @declaration = node.text
32
+ when Availability
33
+ @availability = node.text.sub("Availability","")
34
+ when ReturnValue
35
+ @return_value = node.text.sub("Return Value","")
36
+ when Discussion
37
+ @discussion = node.text.sub("Discussion","")
38
+ when DeclaredIn
39
+ @declared_in = node.text.sub("Declared In","")
40
+ when Special
41
+ @considerations = node.text.sub("Special Considerations","")
42
+ else
43
+ handle_node(node)
44
+ end
45
+ prev_node = node
46
+ end
47
+ end
48
+
49
+ def handle_node node
50
+ logger.debug("Unhandled #{self.class} property: #{classes} => #{node.text}")
51
+ end
52
+ end
53
+ end
@@ -1,6 +1,12 @@
1
1
 
2
2
  module Cocoadex
3
+
4
+ # DocSet index and html documentation file parser
3
5
  class Parser
6
+ GenericReference = ->(title) { title.include?("Reference") }
7
+ DeprecatedMethods = ->(title) { title =~ /^Deprecated ([A-Za-z]+) Methods$/ }
8
+ ClassReference = ->(title) {
9
+ title.include?("Class Reference") or title.include?("Protocol Reference") }
4
10
 
5
11
  IGNORED_DIRS = [
6
12
  'codinghowtos', 'qa',
@@ -21,27 +27,22 @@ module Cocoadex
21
27
  (File.basename(path) == 'index.html' && File.exist?(File.join(File.dirname(path),'Reference')))
22
28
  end
23
29
 
24
- def self.class_ref? title
25
- title.include? "Class Reference" or title.include? "Protocol Reference"
26
- end
27
-
28
- def self.deprecated? title
29
- title =~ /^Deprecated ([A-Za-z]+) Methods$/
30
- end
31
-
32
30
  def self.parse docset_path
33
31
  plist = File.join(docset_path,"Contents", "Info.plist")
34
32
  if File.exist? plist
35
33
  docset = DocSet.new(plist)
36
34
  logger.info "Parsing docset tokens in #{docset.name}. This may take a moment..."
37
35
 
38
- files = Dir.glob(docset_path+"/**/*.html")
39
- files.reject! {|f| ignored?(f) }
36
+ files = Dir.glob(docset_path+"/**/*.html").select {|f| not ignored?(f) }
37
+
38
+ pbar = ProgressBar.new("#{docset.platform} #{docset.version}",files.size)
40
39
  files.each_with_index do |f,i|
41
40
  index_html(docset,f,i)
41
+ pbar.inc
42
42
  end
43
+ pbar.finish
43
44
 
44
- logger.info " Tokens Indexed: #{Keyword.datastore.size}"
45
+ logger.info " Tokens Indexed: #{Tokenizer.tokens.size}"
45
46
  docset
46
47
  end
47
48
  end
@@ -50,13 +51,16 @@ module Cocoadex
50
51
  logger.debug " Parsing path: #{path}"
51
52
 
52
53
  doc = Nokogiri::HTML(IO.read(path))
53
- title_nodes = doc.css("#IndexTitle")
54
- unless title_nodes.size == 0
55
- title = title_nodes.first['content']
56
-
57
- if class_ref? title
58
- logger.debug "Caching #{title}"
59
- Keyword.tokenize_class docset.name, path, index
54
+ if title = doc.css("#IndexTitle").first['content']
55
+ case title
56
+ when ClassReference
57
+ Tokenizer.tokenize_class(docset.name, path, index)
58
+ when GenericReference
59
+ Tokenizer.tokenize_ref(docset.name, path, index)
60
+ when DeprecatedMethods
61
+ # TODO
62
+ else
63
+ # TODO
60
64
  end
61
65
  end
62
66
  end
@@ -1,5 +1,7 @@
1
1
 
2
2
  module Cocoadex
3
+
4
+ # Move data to and from disk
3
5
  class Serializer
4
6
  SEPARATOR = "--__--"
5
7
 
@@ -13,6 +15,7 @@ module Cocoadex
13
15
  array
14
16
  end
15
17
 
18
+ # Ensure parent paths exist
16
19
  def self.check_path path
17
20
  unless File.exists? File.dirname(path)
18
21
  FileUtils.mkdir_p File.dirname(path)
@@ -20,23 +23,21 @@ module Cocoadex
20
23
  end
21
24
 
22
25
  # Write text to a file
23
- def self.write_text path, text
26
+ def self.write_text path, text, style=:overwrite
24
27
  check_path path
28
+
29
+ mode = style_to_mode(style)
30
+
25
31
  File.open(path, 'w') do |file|
26
32
  file.print text
27
33
  end
28
34
  end
29
35
 
30
36
  # Write a cache Array as a serialized file
31
- def self.write path, array, style
37
+ def self.write_array path, array, style
32
38
  check_path path
33
39
 
34
- mode = case style
35
- when :append then 'a'
36
- when :overwrite then 'w'
37
- else
38
- raise "Unknown file mode: #{style}"
39
- end
40
+ mode = style_to_mode(style)
40
41
 
41
42
  File.open(path, mode) do |file|
42
43
  array.each do |object|
@@ -45,5 +46,14 @@ module Cocoadex
45
46
  end
46
47
  end
47
48
  end
49
+
50
+ def self.style_to_mode style
51
+ case style
52
+ when :append then 'a'
53
+ when :overwrite then 'w'
54
+ else
55
+ raise "Unknown file mode: #{style}"
56
+ end
57
+ end
48
58
  end
49
59
  end
@@ -0,0 +1,123 @@
1
+
2
+ module Cocoadex
3
+ class Tokenizer
4
+
5
+ # Cache storage location
6
+ def self.data_path
7
+ Cocoadex.config_file("data/store.blob")
8
+ end
9
+
10
+ # All indexed searchable keys
11
+ def self.tokens
12
+ @store ||= loaded? ? Serializer.read(data_path) : []
13
+ end
14
+
15
+ # Find all tokens with a term identical to a string
16
+ def self.match text
17
+ subset_match(tokens, text)
18
+ end
19
+
20
+ # Find all tokens in a subset with a term identical
21
+ # to a string
22
+ def self.subset_match subset, text
23
+ subset.detect {|t| t.term == text }
24
+ end
25
+
26
+ # Find all tokens with a term at least starting with
27
+ # a text string. If there is an exact match, return
28
+ # it instead of the entire list
29
+ def self.fuzzy_match text
30
+ subset = tokens.select {|t| t.term.start_with? text }
31
+ if token = subset_match(subset, text)
32
+ [token]
33
+ else
34
+ subset
35
+ end
36
+ end
37
+
38
+ def self.persist
39
+ Serializer.write_array(data_path, tokens, :overwrite)
40
+ end
41
+
42
+ def self.loaded?
43
+ File.exists?(data_path)
44
+ end
45
+
46
+ # Find all searchable keywords in a class and
47
+ # add to cache
48
+ def self.tokenize_class docset, path, id
49
+ klass = Cocoadex::Class.new(path)
50
+ properties = {
51
+ :method => klass.methods,
52
+ :property => klass.properties
53
+ }
54
+ tokenize(docset, klass, :class, id, properties)
55
+ end
56
+
57
+ # Find all searchable keywords in a reference
58
+ # and add to cache
59
+ def self.tokenize_ref docset, path, id
60
+ ref = Cocoadex::GenericRef.new(path)
61
+ properties = {
62
+ :constant => ref.constants,
63
+ :data_type => ref.data_types,
64
+ :result_code => ref.result_codes,
65
+ :const_group => ref.const_groups,
66
+ :function => ref.functions,
67
+ :callback => ref.callbacks
68
+ }
69
+ tokenize(docset, ref, :ref, id, properties)
70
+ end
71
+
72
+ # Create Cocoadex model objects from
73
+ # tokenized keywords references
74
+ def self.untokenize keys
75
+ keys.map do |key|
76
+ case key.type
77
+ when :class
78
+ Cocoadex::Class.new(key.url)
79
+ when :ref
80
+ Cocoadex::GenericRef.new(key.url)
81
+ when :data_type, :result_code, :function,
82
+ :const_group, :constant, :callback
83
+
84
+ if class_key = tokens.detect {|k| k.id == key.fk}
85
+ ref = Cocoadex::GenericRef.new(class_key.url)
86
+ list = case key.type
87
+ when :result_code then ref.result_codes
88
+ when :data_type then ref.data_types
89
+ when :const_group then ref.const_groups
90
+ when :constant then ref.constants
91
+ when :function then ref.functions
92
+ when :callback then ref.callbacks
93
+ end
94
+ list.detect {|m| m.name == key.term}
95
+ end
96
+ when :method, :property
97
+ if class_key = tokens.detect {|k| k.id == key.fk}
98
+ klass = Cocoadex::Class.new(class_key.url)
99
+ list = key.type == :method ? klass.methods : klass.properties
100
+ list.detect {|m| m.name == key.term}
101
+ end
102
+ end
103
+ end
104
+ end
105
+
106
+ private
107
+
108
+ # Convert all elements into keyword tokens
109
+ def self.tokenize docset, entity, type, id, properties
110
+ key = Keyword.new(entity.name, type, docset, entity.path)
111
+ key.id = id
112
+ tokens << key
113
+
114
+ properties.each do |type, list|
115
+ list.each do |item|
116
+ item_key = Keyword.new(item.name, type, docset, entity.path)
117
+ item_key.fk = id
118
+ tokens << item_key
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end
@@ -0,0 +1,84 @@
1
+
2
+ module Cocoadex
3
+ class CompletionHelper
4
+ attr_reader :command
5
+
6
+ def initialize(command)
7
+ @command = command
8
+ end
9
+
10
+ def matches
11
+ scope = Keyword.get_scope(command)
12
+
13
+ CompletionHelper.tags.select do |tag|
14
+ tag[0, command.length] == command && Keyword.get_scope(tag) == scope
15
+ end
16
+ end
17
+
18
+ def scope_matches
19
+ scope = Keyword.get_scope(command)
20
+
21
+ CompletionHelper.tags.select do |tag|
22
+ Keyword.get_scope(tag) == scope
23
+ end
24
+ end
25
+
26
+ # Tags file location
27
+ def self.tags_path
28
+ Cocoadex.config_file("tags")
29
+ end
30
+
31
+ # Tags loaded from file
32
+ def self.tags
33
+ @tags ||= begin
34
+ if File.exists?(tags_path)
35
+ IO.read(tags_path, :mode => 'rb').split("\n")
36
+ else
37
+ []
38
+ end
39
+ end
40
+ end
41
+
42
+ # Clear all tags in file
43
+ def self.clear_tags
44
+ Serializer.write_text(tags_path, "")
45
+ end
46
+
47
+ # Build a tags file from existing kewords
48
+ def self.generate_tags!
49
+ logger.info "Generating tags file..."
50
+
51
+ datastore = Tokenizer.tokens.sort_by {|k| k.term }
52
+ text = datastore.map {|k| k.term }.join("\n") + "\n"
53
+
54
+ # Parse class elements and store tags for scope delimiters
55
+ datastore.select {|k| k.type == :class }.each_slice(50).to_a.each do |batch|
56
+ Tokenizer.untokenize(batch).each do |klass|
57
+ logger.debug("Tagging #{klass.name} properties")
58
+ text << tagify(
59
+ klass.name,
60
+ (klass.properties+klass.methods.to_a),
61
+ Keyword::CLASS_PROP_DELIM)
62
+ text << tagify(
63
+ klass.name,
64
+ klass.class_methods,
65
+ Keyword::CLASS_METHOD_DELIM)
66
+ text << tagify(
67
+ klass.name,
68
+ klass.instance_methods,
69
+ Keyword::INST_METHOD_DELIM)
70
+ end
71
+ end
72
+
73
+ Serializer.write_text(tags_path, text.strip)
74
+ end
75
+
76
+ private
77
+
78
+ def self.tagify class_name, properties, delimiter
79
+ properties.map {|p|
80
+ "#{class_name}#{delimiter}#{p.name}"
81
+ }.join("\n") + "\n"
82
+ end
83
+ end
84
+ end
@@ -1,3 +1,3 @@
1
1
  module Cocoadex
2
- VERSION = "1.4"
2
+ VERSION = "1.5"
3
3
  end
data/lib/cocoadex.rb CHANGED
@@ -1,20 +1,17 @@
1
1
 
2
2
  require 'erb'
3
3
  require 'bri'
4
+ require 'nokogiri'
4
5
  require 'cocoadex/docset_helper'
6
+ require 'cocoadex/tokenizer'
5
7
  require 'cocoadex/serializer'
6
8
  require 'cocoadex/version'
7
- require 'cocoadex/templates'
8
- require 'cocoadex/models/docset'
9
- require 'cocoadex/models/element'
10
- require 'cocoadex/models/entity'
11
- require 'cocoadex/models/method'
12
- require 'cocoadex/models/property'
13
- require 'cocoadex/models/class'
9
+ require 'cocoadex/model'
14
10
  require 'cocoadex/parser'
15
11
  require 'cocoadex/keyword'
16
- require 'ext/nil'
17
- require 'nokogiri'
12
+ require 'cocoadex/tools/completion_helper'
13
+ require 'extensions'
14
+ require 'progressbar'
18
15
  require 'term/ansicolor'
19
16
 
20
17
  module Cocoadex
@@ -31,7 +28,7 @@ module Cocoadex
31
28
  elsif objects.size == 1 or load_first
32
29
  puts objects.first.print
33
30
  else
34
- template = Cocoadex::Templates::MULTIPLE_CHOICES
31
+ template = IO.read(view_path('multiple'))
35
32
  puts ERB.new(template, nil, '<>').result(binding)
36
33
  end
37
34
  end
@@ -46,6 +43,11 @@ module Cocoadex
46
43
  Bri.width = width
47
44
  end
48
45
 
46
+ # retrieve a view template by name
47
+ def self.view_path name
48
+ File.join(File.dirname(__FILE__),'..','views',"#{name}.erb")
49
+ end
50
+
49
51
  # path to a file in the default configuration directory
50
52
  def self.config_file subpath
51
53
  File.expand_path(File.join(Cocoadex::CONFIG_DIR,subpath))
data/lib/ext/nil.rb CHANGED
@@ -16,6 +16,9 @@ class NilClass
16
16
  []
17
17
  end
18
18
 
19
+ def each
20
+ end
21
+
19
22
  def next
20
23
  nil
21
24
  end
data/lib/ext/string.rb ADDED
@@ -0,0 +1,9 @@
1
+ class String
2
+ def underscore
3
+ self.gsub(/::/, '/').
4
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
5
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
6
+ tr("-", "_").
7
+ downcase
8
+ end
9
+ end
@@ -0,0 +1,20 @@
1
+ module Bri
2
+ module Templates
3
+ module Helpers
4
+ def wrap text
5
+ Bri::Renderer.wrap_row(text, Cocoadex.width)
6
+ end
7
+
8
+ def h3 text
9
+ Term::ANSIColor::blue + text + Term::ANSIColor::reset + "\n"
10
+ end
11
+
12
+ def inline_title title, value, alignment=0
13
+ length = alignment - title.length
14
+ buffer = length > 0 ? " "*length : ""
15
+ Term::ANSIColor::bold + title + ": " + Term::ANSIColor::reset + "#{buffer}#{value}\n"
16
+ end
17
+ module_function :h3, :inline_title, :wrap
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,10 @@
1
+
2
+ module Nokogiri
3
+ module XML
4
+ class Element
5
+ def classes
6
+ (self['class'] || "").split(" ")
7
+ end
8
+ end
9
+ end
10
+ end
data/readme.md CHANGED
@@ -11,6 +11,10 @@ Cocoadex parses Cocoa documentation files and creates a keyword index. Queries c
11
11
 
12
12
  gem install cocoadex
13
13
 
14
+ ## Update
15
+
16
+ gem update cocoadex && cocoadex --configure
17
+
14
18
  ## Configuration
15
19
 
16
20
  Load any DocSets in known locations:
@@ -33,20 +37,44 @@ Load any DocSets in known locations:
33
37
 
34
38
  cocoadex [query]
35
39
 
36
- Valid search terms are Class, method, and property names. Search scope can also be focused using delimiters, such as `ClassName-method` to find instance methods, `Class+method` to find class methods, or `Class.method` to find any matching method or property in `Class`.
40
+ #### Class Reference
41
+
42
+ Valid search terms are Class, method, and property names. Search scope can also be focused using delimiters, such as `Class-method` to find instance methods, `Class+method` to find class methods, or `Class.method` to find any matching method or property in `Class`.
37
43
 
44
+ #### Functions, Constants, Data Types, Callbacks, Structs...
45
+
46
+ Valid search terms are function, constant, data type, callback and struct names, as well as constant groups (e.g. `cocoadex "Social Profile Keys"`).
38
47
 
39
48
  ## Enabling Tab Completion
40
49
 
41
- Cocoadex generates a tags file of all indexed search terms during configuration. Enable tab completion for bash by linking/saving `bin/cocoadex_completion.sh` and adding the following to your .bash_profile (or similar):
50
+ Cocoadex generates a tags file of all indexed search terms during configuration.
51
+
52
+ ### Bash
53
+
54
+ Enable tab completion for bash by linking/saving `tools/bash_completion.sh` and adding the following to your .bash_profile (or similar):
42
55
 
43
56
  complete -C /path/to/cocoadex_completion.sh -o default cocoadex
44
57
 
58
+ ### Z Shell
59
+
60
+ Add the following to your `.zshrc` to enable tab completion for zsh:
61
+
62
+ ```sh
63
+
64
+ _cocoadex() {
65
+ local cocoa_prefix
66
+ read -l cocoa_prefix
67
+ reply=(`cdex_completion "$cocoa_prefix"`)
68
+ }
69
+
70
+ compctl -K _cocoadex cocoadex
71
+ ```
72
+
45
73
  ## Example Output
46
74
 
47
75
  ### Property Lookup Example
48
76
 
49
- <pre>
77
+ ```sh
50
78
  $ cocoadex tableView
51
79
 
52
80
  -------------------------------------------------------------- tableView
@@ -57,12 +85,12 @@ $ cocoadex tableView
57
85
  Returns the table view managed by the controller object.
58
86
 
59
87
  Available in iOS 2.0 and later.
60
- </pre>
88
+ ```
61
89
 
62
90
 
63
91
  ### Method Lookup Example
64
92
 
65
- <pre>
93
+ ```sh
66
94
  $ cocoadex tableView:viewForFoo
67
95
 
68
96
  -------------------------------------- tableView:viewForFooterInSection:
@@ -84,11 +112,11 @@ Parameters:
84
112
  An index number identifying a section of tableView .
85
113
 
86
114
  Available in iOS 2.0 and later.
87
- </pre>
115
+ ```
88
116
 
89
117
  ### Class Lookup Example (Clipped for brevity)
90
118
 
91
- <pre>
119
+ ```sh
92
120
  $ cocoadex UILabel
93
121
 
94
122
  --------------------------------------------------------- Class: UILabel
@@ -110,4 +138,4 @@ Properties:
110
138
  numberOfLines, shadowColor, shadowOffset, text, textAlignment,
111
139
  textColor, userInteractionEnabled
112
140
 
113
- </pre>
141
+ ```