Skip to content

Commit bc2dfe6

Browse files
committed
up
1 parent 5fad1f4 commit bc2dfe6

File tree

7 files changed

+445
-0
lines changed

7 files changed

+445
-0
lines changed

_extensions/cito/_extension.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
title: cito
2+
author: Albert Krewinkel
3+
version: 0.0.1
4+
contributes:
5+
filters:
6+
- cito.lua

_extensions/cito/cito.lua

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
-- Copyright © 2017–2022 Albert Krewinkel, Robert Winkler,
2+
--+ © 2023-2024 Albert Krewinkel, Egon Willighagen
3+
--
4+
-- This library is free software; you can redistribute it and/or modify it
5+
-- under the terms of the MIT license. See LICENSE for details.
6+
7+
local _version = '1.1.0'
8+
local properties_and_aliases = {
9+
agreesWith = {
10+
'agreeWith',
11+
'agree_with',
12+
'agrees_with',
13+
},
14+
citation = {
15+
},
16+
cites = {
17+
},
18+
citesAsAuthority = {
19+
'asAuthority',
20+
'cites_as_authority',
21+
'as_authority',
22+
'authority'
23+
},
24+
citesAsDataSource = {
25+
"asDataSource",
26+
"dataSource",
27+
'cites_as_data_source',
28+
"as_data_source",
29+
"data_source"
30+
},
31+
citesAsEvidence = {
32+
'asEvidence',
33+
'cites_as_evidence',
34+
'as_evidence',
35+
'evidence'
36+
},
37+
citesAsMetadataDocument = {
38+
'asMetadataDocument',
39+
'metadataDocument',
40+
'cites_as_metadata_document',
41+
'as_metadata_document',
42+
'metadata_document',
43+
'metadata'
44+
},
45+
citesAsPotentialSolution = {
46+
'cites_as_potential_solution',
47+
'potentialSolution',
48+
'potential_solution',
49+
'solution'
50+
},
51+
citesAsRecommendedReading = {
52+
'asRecommendedReading',
53+
'recommendedReading',
54+
'cites_as_recommended_reading',
55+
'as_recommended_reading',
56+
'recommended_reading'
57+
},
58+
citesAsRelated = {
59+
'cites_as_related',
60+
'related',
61+
},
62+
citesAsSourceDocument = {
63+
'cites_as_source_document',
64+
'sourceDocument',
65+
'source_document'
66+
},
67+
citesForInformation = {
68+
'cites_for_information',
69+
'information',
70+
},
71+
compiles = {
72+
},
73+
confirms = {
74+
},
75+
containsAssertionFrom = {
76+
},
77+
corrects = {
78+
},
79+
credits = {
80+
},
81+
critiques = {
82+
},
83+
derides = {
84+
},
85+
describes = {
86+
},
87+
disagreesWith = {
88+
'disagrees_with',
89+
'disagree',
90+
'disagrees'
91+
},
92+
discusses = {
93+
},
94+
disputes = {
95+
},
96+
documents = {
97+
},
98+
extends = {
99+
},
100+
includesExcerptFrom = {
101+
'excerptFrom',
102+
'excerpt',
103+
'excerpt_from',
104+
'includes_excerpt_from',
105+
},
106+
includesQuotationFrom = {
107+
'quotationFrom',
108+
'includes_quotation_from',
109+
'quotation',
110+
'quotation_from'
111+
},
112+
linksTo = {
113+
'links_to',
114+
'link'
115+
},
116+
obtainsBackgroundFrom = {
117+
'backgroundFrom',
118+
'obtains_background_from',
119+
'background',
120+
'background_from'
121+
},
122+
providesDataFor = {
123+
},
124+
obtainsSupportFrom = {
125+
},
126+
qualifies = {
127+
},
128+
parodies = {
129+
},
130+
refutes = {
131+
},
132+
repliesTo = {
133+
'replies_to',
134+
},
135+
retracts = {
136+
},
137+
reviews = {
138+
},
139+
ridicules = {
140+
},
141+
speculatesOn = {
142+
},
143+
supports = {
144+
},
145+
updates = {
146+
},
147+
usesConclusionsFrom = {
148+
'uses_conclusions_from'
149+
},
150+
usesDataFrom = {
151+
'dataFrom',
152+
'uses_data_from',
153+
'data',
154+
'data_from'
155+
},
156+
usesMethodIn = {
157+
'methodIn',
158+
'uses_method_in',
159+
'method',
160+
'method_in'
161+
},
162+
}
163+
164+
local default_cito_property = 'citation'
165+
166+
--- Map from cito aliases to the actual cito property.
167+
local properties_by_alias = {}
168+
for property, aliases in pairs(properties_and_aliases) do
169+
-- every property is an alias for itself
170+
properties_by_alias[property] = property
171+
for _, alias in pairs(aliases) do
172+
properties_by_alias[alias] = property
173+
end
174+
end
175+
176+
--- Split citation ID into cito property and the actual citation ID. If
177+
--- the ID does not seem to contain a CiTO property, the
178+
--- `default_cito_property` will be returned, together with the
179+
--- unchanged input ID.
180+
local function split_cito_from_id (citation_id)
181+
local pattern = '^([^:]+):(.+)$'
182+
local prop_alias, split_citation_id = citation_id:match(pattern)
183+
184+
if properties_by_alias[prop_alias] then
185+
return properties_by_alias[prop_alias], split_citation_id
186+
end
187+
188+
return default_cito_property, citation_id
189+
end
190+
191+
--- Citations by CiTO properties.
192+
local function store_cito (cito_cites, prop, cite_id)
193+
if not prop then
194+
return
195+
end
196+
if not cito_cites[prop] then
197+
cito_cites[prop] = {}
198+
end
199+
table.insert(cito_cites[prop], cite_id)
200+
end
201+
202+
--- Returns a Cite filter function which extracts CiTO information and
203+
--- add it to the given collection table.
204+
local function extract_cito (cito_cites)
205+
return function (cite)
206+
local placeholder = cite.content
207+
for _, citation in pairs(cite.citations) do
208+
local cito_prop, cite_id = split_cito_from_id(citation.id)
209+
store_cito(cito_cites, cito_prop, cite_id)
210+
cite.content = cite.content:walk {
211+
-- replace in placeholder
212+
Str = function (str)
213+
return str.text:gsub(citation.id, cite_id)
214+
end
215+
}
216+
citation.id = cite_id
217+
end
218+
219+
return cite
220+
end
221+
end
222+
223+
return {
224+
{
225+
Pandoc = function (doc)
226+
--- Lists of citation IDs, indexed by CiTO properties.
227+
local citations_by_property = {}
228+
doc = doc:walk{Cite = extract_cito(citations_by_property)}
229+
doc.meta.cito_cites = citations_by_property
230+
return doc
231+
end
232+
}
233+
}

_quarto.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
project:
33
type: website
4+
pre-render:
5+
- scripts/prerender.py
46
render:
57
- 404.qmd
68
- index.qmd
@@ -10,6 +12,7 @@ project:
1012
- articles/first/*.qmd
1113
- articles/shared/*.qmd
1214
- articles/thesis.qmd
15+
- posts/*.qmd
1316
- talks.qmd
1417
- talks/*.qmd
1518
- teaching.qmd

posts/2025-08-04_rogue-scholar.qmd

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
author:
3+
- name:
4+
given: Adriano
5+
family: Rutz
6+
orcid: 0000-0003-0443-9902
7+
number: 1
8+
affiliations:
9+
- ref: imsb
10+
affiliations:
11+
- id: imsb
12+
number: 1
13+
name: ETH Zürich
14+
department: Institute for Molecular Systems Biology
15+
group: Zamboni
16+
address: Otto-Stern-Weg, 3
17+
city: Zürich
18+
country: Switzerland
19+
postal-code: 8093
20+
ror: https://ror.org/03j5gm982
21+
categories:
22+
- Open Science
23+
citation: true
24+
# description: TODO
25+
filters:
26+
- cito
27+
format: html
28+
google-scholar: true
29+
license: CC BY-SA
30+
title: "Open Science Upgrade: Now Adding DOIs through Rogue Scholar"
31+
bibliography: references.bib
32+
---
33+
34+
I have finally set up **Rogue Scholar** on my Quarto-based website!
35+
Every post should now automatically get a DOI.
36+
37+
This is something I have wanted to do for a long time, largely inspired by the tireless and consistent example set by [Egon Willighagen](https://scholia.toolforge.org/author/Q20895241) [@cites:willighagen2024; @cites:willighagen2024a; @cites:willighagen2025].
38+
39+
It was today's post of [@cites_as_related:fenner2025] that finally motivated me to look into it again.
40+
That led me down a productive rabbit hole: first landing on [@obtains_background_from:voncsefalvay2023]'s excellent guide, and then [@uses_method_in:fruehwald2025]’s clear write-up, both of which made the process of integrating Rogue Scholar into a Quarto-based site surprisingly smooth.
41+
42+
All the changes are documented in the following commit:
43+
44+
<!-- INSERT LINK -->
45+
46+
If you're using Quarto and care about attribution, long-term archiving, and DOIs and metadata, I highly recommend looking into [Rogue Scholar](https://rogue-scholar.org/).

posts/_metadata.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
date: '2025-08-04'
2+
doi: 10.59350/38tz1-47k08

posts/references.bib

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
@misc{willighagen2025,
3+
title = {Blog updates},
4+
author = {Willighagen, Egon},
5+
year = {2025},
6+
month = {01},
7+
date = {2025-01-19},
8+
url = {http://dx.doi.org/10.59350/cf885-kee54}
9+
}
10+
11+
@misc{willighagen2024a,
12+
title = {FAIR blog-to-blog citations},
13+
author = {Willighagen, Egon},
14+
year = {2024},
15+
month = {12},
16+
date = {2024-12-30},
17+
url = {http://dx.doi.org/10.59350/er1mn-m5q69}
18+
}
19+
20+
@misc{willighagen2024,
21+
title = {GoatCounter, Rogue Scholar and more new things},
22+
author = {Willighagen, Egon},
23+
year = {2024},
24+
month = {07},
25+
date = {2024-07-21},
26+
url = {http://dx.doi.org/10.59350/8x2f1-h6d21}
27+
}
28+
29+
@misc{fruehwald2025,
30+
title = {Setting Up Rogue Scholar},
31+
author = {Fruehwald, Josef},
32+
year = {2025},
33+
month = {07},
34+
date = {2025-07-31},
35+
url = {http://dx.doi.org/10.59350/3fp6d-e6z90}
36+
}
37+
38+
@misc{voncsefalvay2023,
39+
title = {Auto-DOI for Quarto posts via Rogue Scholar},
40+
author = {von Csefalvay, Chris},
41+
year = {2023},
42+
month = {11},
43+
date = {2023-11-13},
44+
url = {http://dx.doi.org/10.59350/5hxdg-fz574}
45+
}
46+
47+
@misc{fenner2025,
48+
title = {Rogue Scholar citation tracking launches to production},
49+
author = {Fenner, Martin},
50+
year = {2025},
51+
month = {08},
52+
date = {2025-08-04},
53+
url = {http://dx.doi.org/10.53731/zyg15-qv911}
54+
}

0 commit comments

Comments
 (0)