Skip to content

Commit

Permalink
Make the PDF buttons more robust to presence of other header elements
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchelloharawild committed Jan 20, 2025
1 parent 0243ed0 commit f2d810c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions inst/rjdistill.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@

// adds Abstract: in front of the first <p> in the title section --
// unless it happens to be the subtitle (FIXME: this is a bad hack - can't distill do this?)
var tpar = $("d-title p:not(:empty)").first();
if (tpar && ! tpar.hasClass("subtitle")) {
var tpar = $("d-title p:not(:empty)").filter(function() {
return !$(this).hasClass("subtitle");
}).first();
if (tpar) {
const abstract = $('<d-abstract>')
abstract.append('<b>Abstract:</b><br>')
abstract.append($("d-title p:not(:empty)").first()) // Move description to d-abstract
abstract.append(tpar) // Move description to d-abstract
$("d-title p:empty").remove() // Remove empty paragraphs after title
abstract.append(buttons)
abstract.insertAfter($('d-title')) // Add abstract section after title */
Expand Down

0 comments on commit f2d810c

Please sign in to comment.