Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gabricolaje authored Oct 24, 2024
0 parents commit a426b4e
Show file tree
Hide file tree
Showing 30 changed files with 817 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
workflow_dispatch:
push:
branches: main

name: Quarto Publish

jobs:
build-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2

- name: Render and Publish
uses: quarto-dev/quarto-actions/publish@v2
with:
target: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
/.quarto/
.httr-oauth
/docs/
/_site/
Empty file added .nojekyll
Empty file.
11 changes: 11 additions & 0 deletions Blog.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: "Blog"
listing:
contents: posts
type: default
sort: "date desc"
categories: true
feed: true
---


10 changes: 10 additions & 0 deletions Projects.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "Projects"
listing:
contents: projects
type: grid
categories: false
---



15 changes: 15 additions & 0 deletions Publications.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: "Publications"
toc: true
---

### Articles

- Quintero, Rodríguez‐Sánchez, Jordano (2022) [Reciprocity and interaction effectiveness in generalised mutualisms among free‐living species](https://doi.org/10.1111/ele.14141). *Ecology Letters* 26 (1): 132-146. [[PDF](https://onlinelibrary.wiley.com/doi/pdf/10.1111/ele.14141)]

- Rodríguez-Sanchez, Pérez-Luque, Bartomeus, Varela (2016) [Ciencia reproducible: ¿qué, por qué, cómo?](https://doi.org/10.7818/ECOS.2016.25-2.11). *Ecosistemas* 25 (2): 83-92

### Book chapters



30 changes: 30 additions & 0 deletions R/doi2md.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
doi2md <- function(doi = NULL, style = NULL) {

doi <- gsub("https://doi.org/", "", doi)

dt <- rcrossref::cr_works(doi)$data

if (!is.null(style)) {
out <- rcrossref::cr_cn(doi, format = "text", style = "ecology-letters")
} else {

out <- paste(
paste(dt$author[[1]]$family, collapse = ", "),
paste0("(", substr(dt$created, start = 1, stop = 4), ")"),
paste0("[", dt$title, "](", "https://doi.org/", doi, ")."),
paste0("*", dt$container.title, "*"),
dt$volume,
paste0("(", dt$issue, "):"),
dt$page,
collapse = " "
)

}

cat(out)

}




23 changes: 23 additions & 0 deletions R/scholar_pubs.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
scholar_pubs <- function(id = NULL, file = "publications.qmd") {

scholar.df <- scholar::get_publications(id) |>
sort_by(~ list(-year))

pubs <- do.call("rbind", lapply(split(scholar.df, f = 1:nrow(scholar.df)), format_pub))

pubs <- paste("- ", format_pubs, collapse = "\n\n")

writeLines(c("---",
"title: Publications",
"---",
pubs),
con = "pubs.qmd")


}

format_pub <- function(pub) {
paste(pub$author, pub$year, pub$title, paste0("*", pub$journal, "*"), pub$number, sep = ". ")
}


33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Template for academic website made with Quarto

A template for academic websites made with [Quarto](https://quarto.org) and hosted on GitHub.

This is all configured so you only need to edit the source files in Quarto (.qmd). The website is generated and hosted automatically by GitHub.

Example website: https://pakillo.github.io/academic-website-template-Quarto/

## Using this template

1. Click on green button "Use this template" -> "Create a new repository"

2. Important: check 'Include all branches' when creating the repository (because we will need the 'gh-pages' branch to host the website).

3. Choose a name for your repository

4. Once your repo is created, remember to update the links and info in `_quarto.yml`, `index.qmd`, etc.

5. With every new commit pushed to the 'main branch' the website will be updated automatically (using GitHub Actions). If that is not working, go to Settings -> GitHub Pages and check that it is configured as explained [here](https://quarto.org/docs/publishing/github-pages.html#source-branch). Otherwise the Quarto rendering might be failing. Try running 'quarto render' locally in your computer for debugging.


### Tips

In the 'R' folder there are a couple of R functions to help you populate the Publications page.

- `doi2md` will take a DOI (e.g. from a published paper) and produce the Markdown text ready to paste into `Publications.qmd`. For example, running `doi2md("10.1111/ele.14141")` returns this text that you can directly paste into `Publications.qmd` (requires internet connection for retrieving the publication metadata):

Quintero, Rodríguez‐Sánchez, Jordano (2022) [Reciprocity and interaction effectiveness in generalised mutualisms among free‐living species](https://doi.org/10.1111/ele.14141). *Ecology Letters* 26 (1): 132-146

- `scholar_pubs` will take a Google Scholar ID (e.g. mine is "LQQrHeEAAAAJ") and will generate a Quarto file (named "publications.qmd" by default) with your full publication list as available in your Google Scholar profile. Note you could of course write similar functions to retrieve publications dynamically from your ORCID profile, Zotero database, etc.



21 changes: 21 additions & 0 deletions _extensions/mcanouil/iconify/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Mickaël Canouil

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 7 additions & 0 deletions _extensions/mcanouil/iconify/_extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title: Iconify support
author: Mickaël Canouil
version: 2.1.2
quarto-required: ">=1.2.280"
contributes:
shortcodes:
- iconify.lua
13 changes: 13 additions & 0 deletions _extensions/mcanouil/iconify/iconify-icon.min.js

Large diffs are not rendered by default.

156 changes: 156 additions & 0 deletions _extensions/mcanouil/iconify/iconify.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
--[[
# MIT License
#
# Copyright (c) Mickaël Canouil
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
]]

local function ensure_html_deps()
quarto.doc.add_html_dependency({
name = 'iconify',
version = '2.1.0',
scripts = {"iconify-icon.min.js"}
})
end

local function is_empty(s)
return s == nil or s == ''
end

local function is_valid_size(size)
if is_empty(size) then
return ''
end
local size_table = {
["tiny"] = "0.5em",
["scriptsize"] = "0.7em",
["footnotesize"] = "0.8em",
["small"] = "0.9em",
["normalsize"] = "1em",
["large"] = "1.2em",
["Large"] = "1.5em",
["LARGE"] = "1.75em",
["huge"] = "2em",
["Huge"] = "2.5em",
["1x"] = "1em",
["2x"] = "2em",
["3x"] = "3em",
["4x"] = "4em",
["5x"] = "5em",
["6x"] = "6em",
["7x"] = "7em",
["8x"] = "8em",
["9x"] = "9em",
["10x"] = "10em",
["2xs"] = "0.625em",
["xs"] = "0.75em",
["sm"] = "0.875em",
["lg"] = "1.25em",
["xl"] = "1.5em",
["2xl"] = "2em"
}
for key, value in pairs(size_table) do
if key == size then
return 'font-size: ' .. value .. ';'
end
end
return 'font-size: ' .. size .. ';'
end

return {
["iconify"] = function(args, kwargs)
-- detect html (excluding epub which won't handle fa)
if quarto.doc.is_format("html:js") then
ensure_html_deps()
local icon = pandoc.utils.stringify(args[1])
local set = "fluent-emoji"

if #args > 1 and string.find(pandoc.utils.stringify(args[2]), ":") then
quarto.log.warning(
'Use "set:icon" or "set icon" syntax, not both! ' ..
'Using "set:icon" syntax and discarding first argument!'
)
icon = pandoc.utils.stringify(args[2])
end

if string.find(icon, ":") then
set = string.sub(icon, 1, string.find(icon, ":") - 1)
icon = string.sub(icon, string.find(icon, ":") + 1)
elseif #args > 1 then
set = icon
icon = pandoc.utils.stringify(args[2])
end

local attributes = ' icon="' .. set .. ':' .. icon .. '"'
local default_label = 'Icon ' .. icon .. ' from ' .. set .. ' Iconify.design set.'

local size = is_valid_size(pandoc.utils.stringify(kwargs["size"]))
if not is_empty(size) then
attributes = attributes .. ' style="' .. size .. '"'
end

local aria_label = pandoc.utils.stringify(kwargs["label"])
if is_empty(aria_label) then
aria_label = ' aria-label="' .. default_label .. '"'
else
aria_label = ' aria-label="' .. aria_label .. '"'
end

local title = pandoc.utils.stringify(kwargs["title"])
if is_empty(title) then
title = ' title="' .. default_label .. '"'
else
title = ' title="' .. title .. '"'
end

attributes = attributes .. aria_label .. title

local width = pandoc.utils.stringify(kwargs["width"])
if not is_empty(width) and is_empty(size) then
attributes = attributes .. ' width="' .. width .. '"'
end
local height = pandoc.utils.stringify(kwargs["height"])
if not is_empty(height) and is_empty(size) then
attributes = attributes .. ' height="' .. height .. '"'
end
local flip = pandoc.utils.stringify(kwargs["flip"])
if not is_empty(flip) then
attributes = attributes .. ' flip="' .. flip.. '"'
end
local rotate = pandoc.utils.stringify(kwargs["rotate"])
if not is_empty(rotate) then
attributes = attributes .. ' rotate="' .. rotate .. '"'
end

local inline = pandoc.utils.stringify(kwargs["inline"])
if is_empty(inline) or inline ~= "false" then
attributes = ' inline ' .. attributes
end


return pandoc.RawInline(
'html',
'<iconify-icon role="img"' .. attributes .. '></iconify-icon>'
)
else
return pandoc.Null()
end
end
}
15 changes: 15 additions & 0 deletions _freeze/Publications/execute-results/html.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"hash": "4c54ef892ed009981305dbb188974a63",
"result": {
"engine": "knitr",
"markdown": "---\ntitle: \"Publications\"\n---\n\n\n\nAbout this site\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n1 + 1\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n[1] 2\n```\n\n\n:::\n:::\n",
"supporting": [],
"filters": [
"rmarkdown/pagebreak.lua"
],
"includes": {},
"engineDependencies": {},
"preserve": {},
"postProcess": true
}
}
15 changes: 15 additions & 0 deletions _freeze/Team/execute-results/html.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"hash": "5af09650b9cd602b66b7d09482728273",
"result": {
"engine": "knitr",
"markdown": "---\ntitle: \"Team\"\n---\n\n\n\nAbout this site\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n1 + 1\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n[1] 2\n```\n\n\n:::\n:::\n",
"supporting": [],
"filters": [
"rmarkdown/pagebreak.lua"
],
"includes": {},
"engineDependencies": {},
"preserve": {},
"postProcess": true
}
}
Loading

0 comments on commit a426b4e

Please sign in to comment.