/cl-mediawiki

A Common Lisp wrapper around the MediaWiki api

Primary LanguageCommon LispOtherNOASSERTION

Table of Contents

CL-MediaWiki

This is a project to help make the MediaWiki API accessible and easy to use from Common Lisp. While this project is currently sparsely populated, what commands are there should work. Patches Welcome!

Project URL:

https://github.com/bobbysmith007/cl-mediawiki

Supported API

  • Edit
    • create-page - Creates a new wiki page
    • add-new-page-section - adds a new section to the specified wiki page
    • append-text-to-page / prepend-text-to-page - adds text at the top or bottom of the specified page
    • set-page-content - sets a pages content to the specified text
    • regex-replace-all - replace all instances of regex with replacement on a target-page. There is an option for passing what the page content should be if it does not exist
  • Query
    • token-bag - an object to store action tokens with a time stamp (to prevent overriding someone else's change
    • get-action-tokens - requests and returns a token-bag for an edit/move/delete
    • get-page-content - returns the content of the most recent revision of a page
    • get-page-info - returns the properties of a page as an alist
    • get-revisions - returns revision history of a page, including contents and diffs
    • get-links - returns outgoing links from a page
    • pages-that-embed - returns a list of pages that embed another page/template
    • recent-changes - a list of recent changes to the wiki
    • user-contribs - a list of contributions from a specific user
  • Conditions
    • Errors
      • media-wiki-error - signaled when media wiki returns an error

Example

 ;; Gets the content of page "Pigment" from wikipedia
 (with-mediawiki ("http://en.wikipedia.org/w")
    (get-page-content "Pigment"))

 ;; Gets the content of page "Pigment" from a private mediawiki that requires authentication
 (with-mediawiki ((make-instance 'mediawiki
				 :url "http://wiki.yourdomain.net"
				 :auth (list "user" "pass")))
    (get-page-content "Pigment"))

 ;; Sets the content of page "Pigment" to be "This is the new content"
 (with-mediawiki (...)
    (set-page-content "Pigment" "This is the new content"))

 ;; Get the ids, user, and size of the last 10 revisions 
 (with-mediawiki ("http://en.wikipedia.org/w")
    (get-revisions "Pigment" :rvprop "ids|user|size" :rvlimit 10))

Dependencies

Optional Dependencies

  • CL-PPCRE - If you have this installed, there will be a couple more functions available

News

Authors

;; Copyright (c) 2011 Russ Tyndall , Acceleration.net http://www.acceleration.net
;; All rights reserved.
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are
;; met:
;;
;;  - Redistributions of source code must retain the above copyright
;;    notice, this list of conditions and the following disclaimer.
;;
;;  - Redistributions in binary form must reproduce the above copyright
;;    notice, this list of conditions and the following disclaimer in the
;;    documentation and/or other materials provided with the distribution.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
;; A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
;; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
;; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
;; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
k