From bebcb42fec959919aaff71296fbc5eadad8e4f2c Mon Sep 17 00:00:00 2001 From: Romain Lesur Date: Mon, 16 Mar 2020 16:47:58 +0100 Subject: [PATCH] detect whether an icon is already supplied by the user before adding a new one fix #168 --- NEWS.md | 3 +++ inst/resources/html/resume.html | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 282829aa..1e2cd8e0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # CHANGES IN pagedown VERSION 0.9 +## BUG FIXES + +- In `html_resume()` template, an icon inserted using inline HTML in a section title takes precedence over the default icon and the `data-icon` property (thanks, @Tazinho, #168). # CHANGES IN pagedown VERSION 0.8 diff --git a/inst/resources/html/resume.html b/inst/resources/html/resume.html index bbf8b7ab..dec81920 100644 --- a/inst/resources/html/resume.html +++ b/inst/resources/html/resume.html @@ -85,8 +85,11 @@ if (i === 0 && el.id === 'title') continue; el.className += ' main-block'; if (el.dataset['concise']) el.className += ' concise'; - s = el.dataset['icon'] || 'bookmark'; - el.firstElementChild.insertBefore(create_el('i', 'fa fa-' + s), el.firstElementChild.firstChild); + // if there is no icon, add an icon: + if (el.firstElementChild.firstChild && el.firstElementChild.firstChild.nodeName !== 'I') { + s = el.dataset['icon'] || 'bookmark'; + el.firstElementChild.insertBefore(create_el('i', 'fa fa-' + s), el.firstElementChild.firstChild); + } } // tweak class names of blocks in sections