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.
Object of \code{\link{R6Class}} with methods to interact with mediawiki instance
}
\description{
Uses \link{Mediawikir} to create/edit a batch of mediawiki pages
}
\section{Fields}{
\describe{
\item{\code{author}}{the mediawiki user who will be the author of the pages/modifications}
\item{\code{wiki}}{a mediawikir object}
\item{\code{page_name_pattern}}{a pattern to name the pages generated}
\item{\code{template}}{the content of a text file with the template for the wikitext of the pages to create in a batch}
\item{\code{field_list}}{the list of symbols that will be replaced (the first line of the csv file that will be sent to the Batchator)}
\item{\code{content}}{a matrix of the words that will replace the symbols in the templates (both content and page names — the next lines of the csv file)}
}}
\section{Methods}{
\describe{
...
...
@@ -38,6 +19,7 @@ Uses \link{Mediawikir} to create/edit a batch of mediawiki pages
\item{\code{wiki}}{The base url to the mediawiki instance}
\item{\code{authr}}{The screen name of the user who will be credited for the changes in the wiki}
\item{\code{pass}}{The user's password}
\item{\code{dir}}{The installation directory of mediawiki, if needed}
}}
\item{\code{loadTemplate(file_path)}}{Takes the path of a text file containing a template that will serve as base
for all the pages generated. The template should contain occurrences of the fields defined in the content file.}
...
...
@@ -82,3 +64,97 @@ Uses \link{Mediawikir} to create/edit a batch of mediawiki pages
#"Help:full/page/Name","New value for att1","New value for att2"
}
\keyword{mediawiki}
\section{Public fields}{
\if{html}{\out{<div class="r6-fields">}}
\describe{
\item{\code{author}}{the mediawiki user who will be the author of the pages/modifications}
\item{\code{wiki}}{a mediawikir object}
\item{\code{page_name_pattern}}{a pattern to name the pages generated}
\item{\code{template}}{the content of a text file with the template for the wikitext of the pages to create in a batch}
\item{\code{field_list}}{the list of symbols that will be replaced (the first line of the csv file that will be sent to the Batchator)}
\item{\code{content}}{a matrix of the words that will replace the symbols in the templates (both content and page names — the next lines of the csv file)}
\item{\code{initialize(instance_url, user, pass)}}{Creates a new \pkg{Mediawikir} object out of:
\describe{
\item{\code{instance_url}}{The base url to the mediawiki instance}
\item{\code{user}}{The screen name of the user who will be credited for the changes in the wiki}
\item{\code{pass}}{The user's password}
}}
\item{\code{setPage(pageNameOrId)}}{To set the page for the next post
\describe{
\item{\code{pageNameOrId}}{The name (or id) of the wiki page which contains the changes}
}}
\item{\code{connect(pass)}}{Should not be called directly (see \code{initialize} for detail)}
\item{\code{resetContent(baseContent="")}}{To reset the content of the page for the next post
\describe{
\item{\code{baseContent}}{The wikitext base for the next post}
}}
\item{\code{addContent(theContent, type="p")}}{To add content that will later on be posted to mediawiki. This is where structuring elements are provided
\describe{
\item{\code{theContent}}{Either text (using mediawiki syntax) or path to a file}
\item{\code{type}}{\describe{
\item{\code{p} → A plain paragraph.}{}
\item{\code{h2} → Level 2 title}{}
\item{\code{h3} → Level 3 title}{}
\item{\code{h4} → Level 4 title}{}
\item{\code{h5} → Level 5 title}{}
\item{\code{raw} → No editing of the 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}
\item{\code{file_name}}{Name under which to store it}
\item{Returns the title of the wiki page containing the file or \code{FALSE} on error}{}
}}
\item{\code{getContent()}}{Returns the \emph{wikitext} of the selected page (cf. \code{setPage})}
\item{\code{replaceSingleLineTemplateField(template, field, newValue)}}{To replace a field of a template in the selected \code{page}.
This method does not work with numbered parameters.
Right now it works only for pages that only contain one occurence of the parameter (it does not take outer context into account)
Additionnally, this function is not meat for templates the value of which spans accross multiple lines.
\describe{
\item{\code{template}}{The template to look for}
\item{\code{field}}{The name of the field concerned}
\item{\code{newValue}}{The new value of the field}
}}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-new"></a>}}
\subsection{Method \code{new()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{Mediawikir$new(instance_url, user, pass, dir = "")}\if{html}{\out{</div>}}