Skip to content
Snippets Groups Projects
Commit f3dad30d authored by Mathieu Loiseau's avatar Mathieu Loiseau
Browse files

mediawikir:postContent now allows summary

parent f6b5a501
No related branches found
No related tags found
No related merge requests found
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.
......
......@@ -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="")
......
......@@ -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}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment