/usr/lib/R/site-library/highr/doc/highr-internals.R is in r-cran-highr 0.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | ## ------------------------------------------------------------------------
p = parse(text = " xx = 1 + 1 # a comment", keep.source = TRUE)
(d = getParseData(p))
## ------------------------------------------------------------------------
(d = d[d$terminal, ])
## ------------------------------------------------------------------------
head(highr:::cmd_latex)
tail(highr:::cmd_html)
## ------------------------------------------------------------------------
d$token
rownames(highr:::cmd_latex)
## ------------------------------------------------------------------------
(z = d[, c('col1', 'col2')]) # take out the column positions
(z = t(z)) # transpose the matrix
(z = c(z)) # turn it into a vector
(z = c(0, head(z, -1))) # append 0 in the beginning, and remove the last element
(z = matrix(z, ncol = 2, byrow = TRUE))
## ------------------------------------------------------------------------
(s = z[, 2] - z[, 1] - 1)
(s = mapply(highr:::spaces, s))
paste(s, d$text, sep = '')
## ------------------------------------------------------------------------
m = highr:::cmd_latex[d$token, ]
cbind(d, m)
# use standard markup if tokens do not exist in the table
m[is.na(m[, 1]), ] = highr:::cmd_latex['STANDARD', ]
paste(s, m[, 1], d$text, m[, 2], sep = '', collapse = '')
## ------------------------------------------------------------------------
d = getParseData(parse(text = "x = \"a character\nstring\" #hi", keep.source = TRUE))
(d = d[d$terminal, ])
## ------------------------------------------------------------------------
d$line1[d$line1 == 1] = 2
d
|