Class: Trac::Wiki

Inherits:
Object
  • Object
show all
Defined in:
lib/trac4r/wiki.rb

Instance Method Summary collapse

Constructor Details

#initialize(trac) ⇒ Wiki

Returns a new instance of Wiki.



28
29
30
# File 'lib/trac4r/wiki.rb', line 28

def initialize trac
  @trac = trac
end

Instance Method Details

#attachments(page) ⇒ Object

returns a list of all attachments of a page



69
70
71
# File 'lib/trac4r/wiki.rb', line 69

def attachments page
  @trac.query("wiki.listAttachments",page)
end

#delete(name) ⇒ Object

deletes page with given name, returning true on success.



64
65
66
# File 'lib/trac4r/wiki.rb', line 64

def delete name
  @trac.query('wiki.deletePage',name)
end

#delete_attachment(path) ⇒ Object

deletes attachment with given ‘path’



87
88
89
# File 'lib/trac4r/wiki.rb', line 87

def delete_attachment path
  @trac.query("wiki.deleteAttachment",path)
end

#get_attachment(path) ⇒ Object

returns the content of an attachment



74
75
76
# File 'lib/trac4r/wiki.rb', line 74

def get_attachment path
  @trac.query("wiki.getAttachment",path)
end

#get_html(name) ⇒ Object

returns a whole page in HTML



43
44
45
# File 'lib/trac4r/wiki.rb', line 43

def get_html name
  @trac.query('wiki.getPageHTML',name)
end

#get_info(name) ⇒ Object

returns a whole page in HTML



48
49
50
# File 'lib/trac4r/wiki.rb', line 48

def get_info name
  @trac.query('wiki.getPageInfo',name)
end

#get_raw(name) ⇒ Object

returns a whole page in raw format



53
54
55
# File 'lib/trac4r/wiki.rb', line 53

def get_raw name
  @trac.query('wiki.getPage',name)
end

#listObject

returns a list of all pages



33
34
35
# File 'lib/trac4r/wiki.rb', line 33

def list
  @trac.query('wiki.getAllPages')
end

#put(name, content, attributes = { }) ⇒ Object

sends a page. if the page doesn’t exist yet it is created otherwise it will be overwritten with the new content.



59
60
61
# File 'lib/trac4r/wiki.rb', line 59

def put name,content,attributes={ }
  @trac.query('wiki.putPage',name,content,attributes)
end

#put_attachment(page, filename, description, data, replace = false) ⇒ Object

uploads given ‘data’ as an attachment to given ‘page’. returns true on success. unlike the XMLRPC-Call this method defaults ‘replace’ to false as we don’t want to destroy anything.



82
83
84
# File 'lib/trac4r/wiki.rb', line 82

def put_attachment page,filename,description,data,replace=false
  @trac.query("wiki.putAttachmentEx",page,filename,description,data,replace)
end

#raw_to_html(content) ⇒ Object

convert a raw page to html (e.g. for preview)



38
39
40
# File 'lib/trac4r/wiki.rb', line 38

def raw_to_html content
  @trac.query('wiki.wikiToHtml',content)
end