Skip to content

Commit

Permalink
adding image to book link
Browse files Browse the repository at this point in the history
  • Loading branch information
nelliemckesson committed Aug 9, 2023
1 parent 06de0d7 commit f76c424
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
9 changes: 8 additions & 1 deletion jekyll-assets/_templates/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ def book_link
when 'buy'
%(You can <a href="#{self.attr 'link'}" target="_blank">buy this book</a> on the Raspberry Pi Press site.)
when 'donate'
%(You can <a href="#{document.attr 'link'}" target="_blank">download this book</a> for an optional donation on the Raspberry Pi Press site.)
%(You can <a href="#{self.attr 'link'}" target="_blank">download this book</a> 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
Expand Down
28 changes: 24 additions & 4 deletions jekyll-assets/_templates/section.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f76c424

Please sign in to comment.