Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mediawikiR
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mathieu Loiseau
mediawikiR
Commits
069cefe8
Commit
069cefe8
authored
5 years ago
by
Mathieu Loiseau
Browse files
Options
Downloads
Patches
Plain Diff
individual documentation of 1 method
parent
9727bb2e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
DESCRIPTION
+1
-1
1 addition, 1 deletion
DESCRIPTION
R/class.R
+16
-2
16 additions, 2 deletions
R/class.R
man/Mediawikir.Rd
+40
-5
40 additions, 5 deletions
man/Mediawikir.Rd
with
57 additions
and
8 deletions
DESCRIPTION
+
1
−
1
View file @
069cefe8
Package: Mediawikir
Type: Package
Title: Connects to a mediawiki instance and writes in it what you want. Provides classes Mediawikir and Batchator.
Version: 0.1.1
2
Version: 0.1.1
3
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.
...
...
This diff is collapsed.
Click to expand it.
R/class.R
+
16
−
2
View file @
069cefe8
...
...
@@ -289,9 +289,23 @@ Mediawikir <- R6Class("Mediawikir",
},
######
# replaceSingleLineTemplateField
#' Replaces a field of a template in the selected \code{page}.
#'
#' This method does not work with numbered parameters. If the sought field does not exist, adds it at the beginning of the template.
#'
#' 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 made for templates the value of which spans accross multiple lines.
#' @param field The name of the field concerned
#' @param newValue The new value of the field
#' @return A message logging operations
#' @examples
#' obj <- Mediawikir$new("http://wiki.lezinter.net", "user","pass","installDir")
#' obj$setPage("Title of the page to modify (or its ID)")
#' obj$replaceSingleLineTemplateField("attribute","new value")
#' #Will replace |attribute=* by |attribute=new value (or create it)
######
replaceSingleLineTemplateField
=
function
(
field
=
""
,
newValue
=
""
,
template
=
""
){
replaceSingleLineTemplateField
=
function
(
field
=
""
,
newValue
=
""
){
success
<-
self
$
getContent
()
if
(
success
!=
FALSE
){
search
<-
paste
(
"\\|"
,
field
,
"\\=[^\\|\\}\\n]*"
,
sep
=
""
)
...
...
This diff is collapsed.
Click to expand it.
man/Mediawikir.Rd
+
40
−
5
View file @
069cefe8
...
...
@@ -65,6 +65,13 @@ A Mediawikir controller serves to connect to a mediawiki API as a registered use
\item{\code{newValue}}{The new value of the field}
}}
}
Replaces a field of a template in the selected \code{page}.
This method does not work with numbered parameters. If the sought field does not exist, adds it at the beginning of the template.
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 made for templates the value of which spans accross multiple lines.
}
\examples{
...
...
@@ -77,6 +84,15 @@ A Mediawikir controller serves to connect to a mediawiki API as a registered use
mwHandler$addContent(paste("[[",fileName,"]]",sep=""))
mwHandler$postContent()
mwHandler$replaceSingleLineTemplateField("attribute", "newValue")
## ------------------------------------------------
## Method `Mediawikir$replaceSingleLineTemplateField`
## ------------------------------------------------
obj <- Mediawikir$new("http://wiki.lezinter.net", "user","pass","installDir")
obj$setPage("Title of the page to modify (or its ID)")
obj$replaceSingleLineTemplateField("attribute","new value")
#Will replace |attribute=* by |attribute=new value (or create it)
}
\keyword{mediawiki}
\section{Public fields}{
...
...
@@ -171,11 +187,30 @@ A Mediawikir controller serves to connect to a mediawiki API as a registered use
\if{html}{\out{<a id="method-replaceSingleLineTemplateField"></a>}}
\subsection{Method \code{replaceSingleLineTemplateField()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{Mediawikir$replaceSingleLineTemplateField(
field = "",
newValue = "",
template = ""
)}\if{html}{\out{</div>}}
\if{html}{\out{<div class="r">}}\preformatted{Mediawikir$replaceSingleLineTemplateField(field = "", newValue = "")}\if{html}{\out{</div>}}
}
\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{field}}{The name of the field concerned}
\item{\code{newValue}}{The new value of the field}
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
A message logging operations
}
\subsection{Examples}{
\if{html}{\out{<div class="r example copy">}}
\preformatted{obj <- Mediawikir$new("http://wiki.lezinter.net", "user","pass","installDir")
obj$setPage("Title of the page to modify (or its ID)")
obj$replaceSingleLineTemplateField("attribute","new value")
#Will replace |attribute=* by |attribute=new value (or create it)
}
\if{html}{\out{</div>}}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment