Class: Caramelize::InputWiki::WikkaWiki

Inherits:
Wiki
  • Object
show all
Includes:
DatabaseConnector
Defined in:
lib/caramelize/input_wiki/wikkawiki.rb

Constant Summary collapse

SQL_PAGES =
'SELECT id, tag, body, time, latest, user, note FROM wikka_pages ORDER BY time;'
SQL_AUTHORS =
'SELECT name, email FROM wikka_users;'
FUNCTION_PAGES =
%w[AdminBadWords AdminPages AdminUsers AdminSpamLog Callbacks CategoryAdmin CategoryCategory CategoryWiki DatabaseInfo FormattingRules HighScores InterWiki MyChanges MyPages OrphanedPages OwnedPages PageIndex PasswordForgotten RecentChanges RecentlyCommented Sandbox SysInfo TextSearch TextSearchExpanded UserSettings WantedPages WikiCategory WikkaInstaller WikkaConfig WikkaDocumentation WikkaMenulets WikkaReleaseNotes].freeze

Instance Attribute Summary

Attributes inherited from Wiki

#description, #namespaces, #options, #revisions, #titles, #wiki_title

Instance Method Summary collapse

Methods included from DatabaseConnector

#database

Methods inherited from Wiki

#authors, #convert_markup?, #filters, #latest_revisions, #markup, #revisions_by_title

Constructor Details

#initialize(options = {}) ⇒ WikkaWiki

Returns a new instance of WikkaWiki.



17
18
19
20
21
22
23
# File 'lib/caramelize/input_wiki/wikkawiki.rb', line 17

def initialize(options = {})
  super(options)
  @options[:markup] = :wikka
  @options[:filters] << Caramelize::AddNewlineOnPageEnd
  @options[:filters] << Caramelize::Wikka2Markdown
  @options[:filters] << Caramelize::CamelCaseToWikiLinks
end

Instance Method Details

#excluded_pagesObject



45
46
47
# File 'lib/caramelize/input_wiki/wikkawiki.rb', line 45

def excluded_pages
  FUNCTION_PAGES
end

#read_authorsObject



38
39
40
41
42
43
# File 'lib/caramelize/input_wiki/wikkawiki.rb', line 38

def read_authors
  results = database.query(authors_query)
  results.each do |row|
    authors[row['name']] = { name: row['name'], email: row['email'] }
  end
end

#read_pagesObject

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



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/caramelize/input_wiki/wikkawiki.rb', line 26

def read_pages
  pages.each do |row|
    titles << row['tag']
    page = Page.new(build_properties(row))
    revisions << page
  end
  titles.uniq!
  # revisions.sort! { |a,b| a.time <=> b.time }

  revisions
end