Skip to content

Commit

Permalink
update quarto template
Browse files Browse the repository at this point in the history
  • Loading branch information
tavareshugo committed Dec 6, 2023
1 parent a9a4fc5 commit 07c4784
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 5 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/publish_site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ jobs:
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: 1.2.112
version: 1.3.450

- name: Render Site
uses: quarto-dev/quarto-actions/render@v2
run: |
quarto render
- name: No Jekyll
run: |
Expand Down
6 changes: 4 additions & 2 deletions _extensions/cambiotraining/courseformat/_extension.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
title: Course Page Format
author: Cambridge Informatics Training
version: 1.0.5
version: 1.0.6
contributes:
formats:
html:
Expand All @@ -11,4 +11,6 @@ contributes:
code-link: true
code-copy: true
shortcodes:
- star_levels.lua
- star_levels.lua
filters:
- callout_exercise.lua
45 changes: 45 additions & 0 deletions _extensions/cambiotraining/courseformat/callout_exercise.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
function Div(div)
-- process exercise
if div.classes:includes("callout-exercise") then
-- default title
local title = "Exercise"
-- Use first element of div as title if this is a header
if div.content[1] ~= nil and div.content[1].t == "Header" then
title = pandoc.utils.stringify(div.content[1])
div.content:remove(1)
end
-- return a callout instead of the Div
return quarto.Callout({
type = "exercise",
content = { pandoc.Div(div) },
title = title,
collapse = false
})
end

-- process answer
if div.classes:includes("callout-answer") then
-- default title
local title = "Answer"
-- return a callout instead of the Div
return quarto.Callout({
type = "answer",
content = { pandoc.Div(div) },
title = title,
collapse = true
})
end

-- process hint
if div.classes:includes("callout-hint") then
-- default title
local title = "Hint"
-- return a callout instead of the Div
return quarto.Callout({
type = "hint",
content = { pandoc.Div(div) },
title = title,
collapse = true
})
end
end
5 changes: 4 additions & 1 deletion _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ project:

format: courseformat-html

filters:
- courseformat

execute:
freeze: auto

Expand All @@ -41,7 +44,7 @@ book:
logo: "_extensions/cambiotraining/courseformat/img/university_crest_reversed.png"
right:
- icon: github
href: https://github.com/cambiotraining/
href: https://github.com/cambiotraining/bacterial-genomics
aria-label: Bioinformatics Training Facility GitHub
- icon: twitter
href: https://twitter.com/bioinfocambs
Expand Down

0 comments on commit 07c4784

Please sign in to comment.