@@ -361,6 +361,34 @@ createRedirects <- function(file, Rdobj)
361361}
362362
363363
364+ 
365+ # ## Helper function to find a suitable package logo (logo.png, logo.svg); otherwise return R logo
366+ 
367+ # # For an installed package, we can use system.file(). This is what is
368+ # # needed for dynamic help. To interpret 'package' as a source
369+ # # directory, specify 'dir = TRUE'
370+ 
371+ 
372+ staticLogoPath  <-  function (package , relative  =  FALSE , Rhome  =  " ../../.."  , dir  =  FALSE ) {
373+     if  (dir ) {
374+         file  <-  file.path(package , " man"  , " figures"  , " logo.png"  )
375+         if  (! file.exists(file )) file  <-  file.path(package , " man"  , " figures"  , " logo.svg"  )
376+         if  (! file.exists(file )) file  <-  R.home(" doc/html/Rlogo.svg"  )
377+     } else  {
378+         file  <-  system.file(" help"  , " figures"  , " logo.png"  , package  =  package )
379+         if  (! nzchar(file )) file  <-  system.file(" help"  , " figures"  , " logo.svg"  , package  =  package )
380+         if  (! nzchar(file )) file  <-  R.home(" doc/html/Rlogo.svg"  )
381+     }
382+     if  (relative ) {
383+         file  <-  if  (endsWith(file , " /logo.png"  )) " figures/logo.png" 
384+                 else  if  (endsWith(file , " /logo.svg"  )) " figures/logo.svg" 
385+                 else  file.path(Rhome , " doc/html/Rlogo.svg"  )
386+     }
387+     file 
388+ }
389+ 
390+ 
391+ 
364392# # This gets used two ways:
365393
366394# # 1) With dynamic = TRUE from tools:::httpd()
@@ -1198,6 +1226,8 @@ Rd2HTML <-
11981226
11991227        of0(' <nav class="topic" aria-label="Section Navigation">\n '  ,
12001228            ' <div class="dropdown-menu">\n '  ,
1229+             if  (dynamic ) ' <img class="toplogo" src="../logo" alt="[logo]">' 
1230+             else  sprintf(' <img class="toplogo" src="%s" alt="[logo]">'  , staticLogoPath(package , relative  =  TRUE )),
12011231            ' <h1>Contents</h1>\n '  ,
12021232            ' <ul class="menu">\n '  )
12031233
@@ -1294,10 +1324,11 @@ Rd2HTML <-
12941324        # # Create HTML header and footer
12951325        if  (standalone ) {
12961326            hfcomps  <-  #  should we be able to specify static URLs here?
1297-                 HTMLcomponents(title  =  headtitle , logo  =  FALSE ,
1327+                 HTMLcomponents(title  =  " "  , logo  =  FALSE ,
12981328                               up  =  NULL ,
12991329                               top  =  NULL ,
13001330                               css  =  stylesheet ,
1331+                                headerTitle  =  headtitle ,
13011332                               outputEncoding  =  outputEncoding ,
13021333                               dynamic  =  dynamic , prism  =  enhancedHTML ,
13031334                               doTexMath  =  doTexMath , texmath  =  texmath ,
0 commit comments