class Caramelize::InputWiki::WikkaWiki

Constants

FUNCTION_PAGES
SQL_AUTHORS
SQL_PAGES

Public Class Methods

new(options = {}) click to toggle source
Calls superclass method Caramelize::InputWiki::Wiki::new
# File lib/caramelize/input_wiki/wikka_wiki.rb, line 16
def initialize(options = {})
  super(options)
  @options[:markup] = :wikka
  @options[:filters] << ::Caramelize::AddNewlineToPageEnd
  @options[:filters] << ::Caramelize::WikkaToMarkdown
  @options[:filters] << ::Caramelize::CamelCaseToWikiLinks
end

Public Instance Methods

excluded_pages() click to toggle source
# File lib/caramelize/input_wiki/wikka_wiki.rb, line 41
def excluded_pages
  FUNCTION_PAGES
end
read_authors() click to toggle source
# File lib/caramelize/input_wiki/wikka_wiki.rb, line 34
def read_authors
  results = database.query(authors_query)
  results.each do |row|
    authors[row['name']] = { name: row['name'], email: row['email'] }
  end
end
read_pages() click to toggle source

after calling this action, titles and @revisions are expected to be filled

# File lib/caramelize/input_wiki/wikka_wiki.rb, line 25
def read_pages
  pages.each do |row|
    titles << row['tag']
    revisions << Page.new(build_properties(row))
  end
  titles.uniq!
  revisions
end

Private Instance Methods

authors_query() click to toggle source
# File lib/caramelize/input_wiki/wikka_wiki.rb, line 51
def authors_query
  SQL_AUTHORS
end
build_properties(row) click to toggle source
# File lib/caramelize/input_wiki/wikka_wiki.rb, line 59
def build_properties(row)
  author = authors[row['user']]
  {
    id: row['id'],
    title: row['tag'],
    body: row['body'],
    markup: :wikka,
    latest: row['latest'] == 'Y',
    time: row['time'],
    message: row['note'],
    author:
  }
end
pages() click to toggle source
# File lib/caramelize/input_wiki/wikka_wiki.rb, line 55
def pages
  @pages ||= database.query(pages_query)
end
pages_query() click to toggle source
# File lib/caramelize/input_wiki/wikka_wiki.rb, line 47
def pages_query
  SQL_PAGES
end