File: RspText.R

package info (click to toggle)
r-cran-r.rsp 0.46.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,472 kB
  • sloc: javascript: 612; tcl: 304; sh: 18; makefile: 16
file content (83 lines) | stat: -rw-r--r-- 1,877 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
###########################################################################/**
# @RdocClass RspText
#
# @title "The RspText class"
#
# \description{
#  @classhierarchy
#
#  An RspText is an @see "RspConstruct" that represents a plain text
#  section, i.e. everything that is inbetween any other types of
#  @see "RspConstruct":s.
#  Its content is independent of the underlying programming language.
# }
#
# @synopsis
#
# \arguments{
#   \item{text}{A @character string.}
#   \item{escape}{If @TRUE, character sequences \code{<\%} and \code{\%>}
#                 are escaped to \code{<\%\%} and \code{\%\%>}.}
#   \item{...}{Not used.}
# }
#
# \section{Fields and Methods}{
#  @allmethods
# }
#
# @author
#
# @keyword internal
#*/###########################################################################
setConstructorS3("RspText", function(text=character(), escape=FALSE, ...) {
  if (escape) {
    text <- escapeRspTags(text)
  }
  extend(RspConstruct(text), "RspText")
})


setMethodS3("getInclude", "RspText", function(object, ...) {
  TRUE
})


#########################################################################/**
# @RdocMethod getContent
#
# @title "Gets the contents of the RSP text"
#
# \description{
#  @get "title".
# }
#
# @synopsis
#
# \arguments{
#   \item{unescape}{If @TRUE, character sequences \code{<\%\%} and
#                \code{\%\%>} are unescaped to \code{<\%} and \code{\%>}.}
#   \item{...}{Not used.}
# }
#
# \value{
#  Returns a @character string.
# }
#
# @author
#
# \seealso{
#   @seeclass
# }
#*/#########################################################################
setMethodS3("getContent", "RspText", function(text, unescape=FALSE, ...) {
  text <- as.character(text)
  if (unescape) {
    text <- unescapeRspTags(text)
  }
  text
})


setMethodS3("asRspString", "RspText", function(text, ...) {
  RspString(getContent(text))
})