請確定你的願望或預料的標記。
CRANberries已經這樣做了近十年 - 下面是一個「新」包的代碼。我只是解析DESCRIPTION
文件,然後遍歷它,設置以粗體顯示的字段和普通文本的價值。
writeNewBlogEntry <- function(curPkg, curVer, reposurl) {
blogpost <- file.path(blogInputDir, "new",
paste(curPkg, "_", curVer, ".txt", sep=""))
con <- file(blogpost, "wt")
cat("New package", curPkg, "with initial version", curVer,"\n\n", file=con)
dcf <- read.dcf(url(getDescriptionUrl(curPkg, reposurl)))
for (i in 1:ncol(dcf)) {
cat("<strong>", colnames(dcf)[i], "</strong>: ",
htmlEscape(dcf[1,i]), "<br>\n", sep="", file=con)
}
closeBlogPost(con, reposurl, curPkg)
}
這是舊代碼,它在我使用的html/rss渲染器的特定(靜態)文本的上下文中。