File: HtmlRspLanguage.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 (53 lines) | stat: -rw-r--r-- 1,218 bytes parent folder | download | duplicates (2)
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
###########################################################################/**
# @RdocClass HtmlRspLanguage
#
# @title "The HtmlRspLanguage class"
#
# \description{
#  @classhierarchy
# }
#
# @synopsis
#
# \arguments{
#   \item{...}{Arguments passed to the constructor of the @see "RspLanguage".}
# }
#
# \section{Fields and Methods}{
#  @allmethods
# }
#
# @author
#
# @keyword internal
#*/###########################################################################
setConstructorS3("HtmlRspLanguage", function(...) {
  extend(RspLanguage(language="html", ...), "HtmlRspLanguage")
})


setMethodS3("getComment", "HtmlRspLanguage", function(object, ...) {
  s <- paste(..., collapse="\n", sep="")
  s <- paste("<!-- ", s, " -->", sep="")
  s
})


setMethodS3("escape", "HtmlRspLanguage", function(object, ...) {
  s <- paste(..., collapse="\n", sep="")
  s <- gsub("<", "&lt;", s)
  s <- gsub(">", "&gt;", s)
  s
})


setMethodS3("getVerbatim", "HtmlRspLanguage", function(object, ..., newline=NULL) {
  s <- NextMethod("getVerbatim", newline="")
  if (is.null(newline))
    newline <- getNewline(object)
  if (is.character(newline)) {
    s <- gsub("\n\r|\r\n|\r", "\n", s)
    s <- gsub("\n", newline, s)
  }
  s
})