Top Level Namespace

Defined Under Namespace

Modules: AESCrypt, LgPodPlugin, SQLite3, Sqlite3 Classes: String, TC_Database_Integration, TC_Integration_Aggregate, TC_Integration_Pending, TC_OpenClose, TC_ResultSet, TC_Statement

Constant Summary collapse

API_OBJECTS =
[ "Database", "Statement", "ResultSet",
"ParsedStatement", "Pragmas", "Translator" ].inject( "(" ) { |acc,name|
  acc << "|" if acc.length > 1
  acc << name
  acc
} + ")"

Instance Method Summary collapse

Instance Method Details



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/sqlite3-1.5.3-arm64-darwin/faq/faq.rb', line 59

def add_api_links( text )
  text.gsub( /#{API_OBJECTS}(#(\w+))?/ ) do
    disp_obj = obj = $1

    case obj
      when "Pragmas"; disp_obj = "Database"
    end

    method = $3
    s = "<a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/#{obj}.html'>#{disp_obj}"
    s << "##{method}" if method
    s << "</a>"
    s
  end
end

#process_faq_description(faq, path) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/sqlite3-1.5.3-arm64-darwin/faq/faq.rb', line 35

def process_faq_description( faq, path )
  question = faq.keys.first
  path = ( path ? path + " " : "" ) + question
  answer = faq.values.first

  if answer.is_a?( Array )
    process_faq_descriptions( answer, path )
  else
    title = RedCloth.new( path ).to_html.gsub( %r{</?p>}, "" )
    answer = RedCloth.new( answer || "" )

    puts "<a name='#{question.object_id}'></a>"
    puts "<div class='faq-title'>#{title}</div>"
    puts "<div class='faq-answer'>#{add_api_links(answer.to_html)}</div>"
  end
end

#process_faq_descriptions(faqs, path = nil) ⇒ Object



29
30
31
32
33
# File 'lib/sqlite3-1.5.3-arm64-darwin/faq/faq.rb', line 29

def process_faq_descriptions( faqs, path=nil )
  faqs.each do |faq|
    process_faq_description faq, path
  end
end

#process_faq_list(faqs) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/sqlite3-1.5.3-arm64-darwin/faq/faq.rb', line 4

def process_faq_list( faqs )
  puts "<ul>"
  faqs.each do |faq|
    process_faq_list_item faq
  end
  puts "</ul>"
end

#process_faq_list_item(faq) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/sqlite3-1.5.3-arm64-darwin/faq/faq.rb', line 12

def process_faq_list_item( faq )
  question = faq.keys.first
  answer = faq.values.first

  print "<li>"

  question_text = RedCloth.new(question).to_html.gsub( %r{</?p>},"" )
  if answer.is_a?( Array )
    puts question_text
    process_faq_list answer
  else
    print "<a href='##{question.object_id}'>#{question_text}</a>"
  end

  puts "</li>"
end