@@ -269,10 +269,14 @@ tweak_citation = function(x) {
269
269
x
270
270
}
271
271
272
+ # ' @param overview Whether to include the package overview page, i.e., the
273
+ # ' `{name}-package.Rd` page.
272
274
# ' @return `pkg_manual()` returns all manual pages of the package in HTML.
273
275
# ' @rdname pkg_desc
274
276
# ' @export
275
- pkg_manual = function (name = detect_pkg(), toc = TRUE , number_sections = TRUE ) {
277
+ pkg_manual = function (
278
+ name = detect_pkg(), toc = TRUE , number_sections = TRUE , overview = TRUE
279
+ ) {
276
280
links = tools :: findHTMLlinks(' ' )
277
281
# resolve internal links (will assign IDs of the form sec:man-ID to all h2)
278
282
r = sprintf(' ^[.][.]/[.][.]/(%s)/html/(.+)[.]html$' , name )
@@ -285,14 +289,15 @@ pkg_manual = function(name = detect_pkg(), toc = TRUE, number_sections = TRUE) {
285
289
links = sub(r , ' https://rdrr.io/cran/\\ 1/man/' , links )
286
290
287
291
db = tools :: Rd_db(name ) # all Rd pages
292
+ intro = paste0(name , ' -package' ) # the name-package entry (package overview)
293
+ entries = setdiff(names(db ), intro )
294
+ db = db [c(if (overview && intro %in% names(db )) intro , entries )]
288
295
al = lapply(db , Rd_aliases )
289
296
290
297
cl = header_class(toc , number_sections , FALSE )
291
298
r1 = ' <code class="reqn">\\ s*([^<]+?)\\ s*</code>' # inline math
292
299
r2 = sprintf(' <p[^>]*>\\ s*%s\\ s*</p>' , r1 ) # display math
293
- # show the page name-package first
294
- idx = vapply(al , is.element , el = paste0(name , ' -package' ), FALSE )
295
- res = uapply(names(db )[order(! idx )], function (i ) {
300
+ res = uapply(names(db ), function (i ) {
296
301
txt = ' '
297
302
con = textConnection(' txt' , ' w' , local = TRUE , encoding = ' UTF-8' )
298
303
tryCatch(
0 commit comments