diff --git a/DESCRIPTION b/DESCRIPTION index 745e3e66c4cb40c104022ca08c59be05b76daa8f..7bc2d083a2f446544da43eddfd87f3d0a10fc920 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: Mediawikir Type: Package Title: Connects to a mediawiki instance and writes in it what you want -Version: 0.1.9 +Version: 0.1.10 Author: Mathieu Loiseau Maintainer: Mathieu Loiseau <loiseaum@univ-grenoble-alpes.fr> Description: Mediawikir class can be used to post the output of an R script directly into a mediawiki instance. Batchator class allows batch page creation. diff --git a/R/class.R b/R/class.R index 683cee570d43ef26848fae6f3fa377e71711d754..c07a25d4e1ca24e093d184191a3207ed0b4c9929 100644 --- a/R/class.R +++ b/R/class.R @@ -62,7 +62,8 @@ library(stringr) #' \item{\code{raw} → No editing of the content}{} #' }} #' }} -#' \item{\code{postContent()}}{To replace the content of \code{page} with \code{content}} +#' \item{\code{postContent(comment)}}{To replace the content of the \code{page} (attribute) with \code{content} (attribute). +#' Parameter \code{comment} specifies the description of the modification, default is \code{“R generated contentâ€}} #' \item{\code{uploadFile(file_path, file_name)}}{To upload a file to the server (will overwrite existing files) #' \describe{ #' \item{\code{file_path}}{Path to the file to upload to the server} @@ -182,7 +183,7 @@ Mediawikir <- R6Class("Mediawikir", ###### # postContent ###### - postContent = function(){ + postContent = function(comment="R generated content"){ success <- TRUE tryCatch( { #Verify that a page has been selected @@ -216,7 +217,7 @@ Mediawikir <- R6Class("Mediawikir", fields <- list(action = "edit", title = self$page, #basetimestamp = "TODO", - summary = "R generated content", + summary = comment, format = "json", text = self$content, token = response$query$tokens$csrftoken) @@ -225,7 +226,7 @@ Mediawikir <- R6Class("Mediawikir", fields <- list(action = "edit", pageid = self$page, #basetimestamp = "TODO", - summary = "R generated content", + summary = comment, format = "json", text = self$content, token = response$query$tokens$csrftoken) @@ -293,7 +294,7 @@ Mediawikir <- R6Class("Mediawikir", if(newText != formerText){ self$resetContent() self$addContent(newText, "raw") - success <- self$postContent() + success <- self$postContent(paste(field," → ", newValue, sep="")) } else{ success <- paste("No modification of ",self$page," due to setting “",field,"†to “",newValue,"â€.",sep="") diff --git a/man/Mediawikir.Rd b/man/Mediawikir.Rd index e25d1eab6968fd00fc47b6dc05f6cc1fe1cf38f9..42c661445c137a634e2e443c873c1215c3a0c919 100644 --- a/man/Mediawikir.Rd +++ b/man/Mediawikir.Rd @@ -60,7 +60,8 @@ A Mediawikir controller serves to connect to a mediawiki API as a registered use \item{\code{raw} → No editing of the content}{} }} }} - \item{\code{postContent()}}{To replace the content of \code{page} with \code{content}} + \item{\code{postContent(comment)}}{To replace the content of the \code{page} (attribute) with \code{content} (attribute). + Parameter \code{comment} specifies the description of the modification, default is \code{“R generated contentâ€}} \item{\code{uploadFile(file_path, file_name)}}{To upload a file to the server (will overwrite existing files) \describe{ \item{\code{file_path}}{Path to the file to upload to the server}