diff --git a/jekyll-assets/_templates/helpers.rb b/jekyll-assets/_templates/helpers.rb index ee63e28e2f..b19e6b9622 100644 --- a/jekyll-assets/_templates/helpers.rb +++ b/jekyll-assets/_templates/helpers.rb @@ -6,12 +6,19 @@ def book_link when 'buy' %(You can buy this book on the Raspberry Pi Press site.) when 'donate' - %(You can download this book for an optional donation on the Raspberry Pi Press site.) + %(You can download this book for an optional donation on the Raspberry Pi Press site.) else return end end + def book_image + src = (self.attr 'image').dup + src = src.gsub(/^image::/, "") + src = src.gsub(/\[.*?\]$/, "") + return src + end + def section_title if caption captioned_title diff --git a/jekyll-assets/_templates/section.html.slim b/jekyll-assets/_templates/section.html.slim index 80a1a20847..a642c90c8a 100644 --- a/jekyll-assets/_templates/section.html.slim +++ b/jekyll-assets/_templates/section.html.slim @@ -21,10 +21,30 @@ =section_title - if level == 1 .sectionbody + - if role? 'booklink' + div class="openblock float-group" + div class="content" + - if attr 'image' + div class="imageblock related thumb right" + div class="content" + a href=(attr 'link') target='_blank' class='image' + img src=(book_image) + =content + div class="paragraph" + p =book_link + - else =content - - if role? 'booklink' - p =book_link - else - =content - if role? 'booklink' - p =book_link + div class="openblock float-group" + div class="content" + - if attr 'image' + div class="imageblock related thumb right" + div class="content" + a href=(attr 'link') target='_blank' class='image' + img src=(book_image) + =content + div class="paragraph" + p =book_link + - else + =content