Class: Trac::Wiki
- Inherits:
-
Object
- Object
- Trac::Wiki
- Defined in:
- lib/trac4r/wiki.rb
Instance Method Summary collapse
-
#attachments(page) ⇒ Object
returns a list of all attachments of a page.
-
#delete(name) ⇒ Object
deletes page with given name, returning true on success.
-
#delete_attachment(path) ⇒ Object
deletes attachment with given ‘path’.
-
#get_attachment(path) ⇒ Object
returns the content of an attachment.
-
#get_html(name) ⇒ Object
returns a whole page in HTML.
-
#get_raw(name) ⇒ Object
returns a whole page in raw format.
-
#initialize(trac) ⇒ Wiki
constructor
A new instance of Wiki.
-
#list ⇒ Object
returns a list of all pages.
-
#put(name, content, attributes = { }) ⇒ Object
sends a page.
-
#put_attachment(page, filename, description, data, replace = false) ⇒ Object
uploads given ‘data’ as an attachment to given ‘page’.
-
#raw_to_html(content) ⇒ Object
convert a raw page to html (e.g. for preview).
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
64 65 66 |
# File 'lib/trac4r/wiki.rb', line 64 def page @trac.query("wiki.listAttachments",page) end |
#delete(name) ⇒ Object
deletes page with given name, returning true on success.
59 60 61 |
# File 'lib/trac4r/wiki.rb', line 59 def delete name @trac.query('wiki.deletePage',name) end |
#delete_attachment(path) ⇒ Object
deletes attachment with given ‘path’
82 83 84 |
# File 'lib/trac4r/wiki.rb', line 82 def path @trac.query("wiki.deleteAttachment",path) end |
#get_attachment(path) ⇒ Object
returns the content of an attachment
69 70 71 |
# File 'lib/trac4r/wiki.rb', line 69 def 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_raw(name) ⇒ Object
returns a whole page in raw format
48 49 50 |
# File 'lib/trac4r/wiki.rb', line 48 def get_raw name @trac.query('wiki.getPage',name) end |
#list ⇒ Object
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.
54 55 56 |
# File 'lib/trac4r/wiki.rb', line 54 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.
77 78 79 |
# File 'lib/trac4r/wiki.rb', line 77 def 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 |