0
Rスタティック・ドックを使って、どのようにデモの名前を定義するのですか?作成されたhtmlファイル内のタイトルは、デモ00Indexファイルに含まれている内容を反映していませんか?Rスタティック・ドック、デモのタイトル
Rスタティック・ドックを使って、どのようにデモの名前を定義するのですか?作成されたhtmlファイル内のタイトルは、デモ00Indexファイルに含まれている内容を反映していませんか?Rスタティック・ドック、デモのタイトル
デモビルディングルーチンに何か不足があると考えてください。以下は、標準的なstaticdocsに含まれるsligtly modifiedルーチンです。基本的には、pgk $ title属性を設定する必要があります。これは、以下で強調しようとしたものです:
build_demos = function (pkg = ".") {
pkg <- staticdocs::as.sd_package(pkg)
demo_dir <- file.path(pkg$path, "demo")
if (!file.exists(demo_dir))
return()
message("Rendering demos")
demos <- readLines(file.path(demo_dir, "00Index"))
pieces <- stringr::str_split_fixed(demos, "\\s+", 2)
in_path <- stringr::str_c(pieces[, 1], ".r")
filename <- stringr::str_c("demo-", pieces[, 1], ".html")
title <- pieces[, 2]
for (i in seq_along(title)) {
demo_code <- readLines(file.path(demo_dir, in_path[i]))
demo_expr <- evaluate::evaluate(demo_code, new.env(parent = globalenv()), new_device = FALSE)
#NH: replay_html is not exported...
replay_html <- getFromNamespace('replay_html','staticdocs')
pkg$demo <- replay_html(demo_expr, pkg = pkg, name = stringr::str_c(pieces[i],"-"))
pkg$pagetitle <- title[i]
#---------------------------------------------------
#NH: Need to set the title attribute...
#---------------------------------------------------
pkg$title <- pkg$pagetitle
#---------------------------------------------------
staticdocs::render_page(pkg, "demo", pkg, file.path(pkg$site_path, filename[i]))
}
invisible(list(demo = unname(apply(cbind(filename,title), 1, as.list))))
}
'demo(package =" staticdocs ")'はdemo_nameについて通知します。次に、あなたは 'demo(demo_name、package =" staticdocs ")' – cuttlefish44
を実行します。いいえ、これを使ってstaticdocsドキュメントの生成について話しています:https://github.com/hadley/staticdocsデモページのタイトル(
の中のあるタイトル
)は、デモファイルの場合、00Indexファイルにリストされているタイトルと同じではありません。 –私は完全に間違いました。申し訳ありません、私はあなたを助けることができませんでした。 – cuttlefish44