summaryrefslogtreecommitdiffhomepage
path: root/resources/pug/include/mixins.pug
blob: 5c595f171d1ea551a91d045c15d3977c7a6d5f50 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
mixin githubIconLink(repo)
	a(href='https://github.com/' + repo, target='_blank', title='Source on GitHub')
		i.fab.fa-2x.fa-github(title='GitHub')

mixin pub(year, title)
	if attributes.lingbuzz
		- attributes.url = 'https://lingbuzz.net/lingbuzz/' + attributes.lingbuzz
		- attributes.oa = true
	td.icon
		if attributes.type
			if attributes.type == 'phd-thesis'
				i.fa.fa-graduation-cap(title="PhD thesis")
			else if attributes.type == 'master-thesis'
				i.fa.fa-graduation-cap(title="Master thesis")
			else if attributes.type == 'bachelor-thesis'
				i.fa.fa-graduation-cap(title="Bachelor thesis")
			else if attributes.type == 'review'
				i.far.fa-comment(title="Book review")
			else if attributes.type == 'chapter'
				i.fa.fa-book-open(title="Book chapter")
			else
				- throw 'pub: unknown type'
		else
			i.far.fa-file-lines(title="Journal article")
	td.icon
		if attributes.oa
			if attributes.url
				- var oaurl = attributes.url
			else if attributes.doi
				- var oaurl = 'https://doi.org/'+attributes.doi
			else
				- throw 'pub: oa set but no doi or url'
			a.oa(href!=oaurl, target='_blank')
				i.ai.ai-lg.ai-open-access(title="Open Access")

	td
		p
			if !attributes.authors
				- attributes.authors = 'Staps, Camil'
			| !{attributes.authors}. #{year}. 
			|
			if attributes.url
				a(href!=attributes.url, target='_blank')!= title
			else if attributes.publisher && !attributes.pages
				i!= title
			else
				| !{title}
			|
			if attributes.journal
				|. !{attributes.prejournal}#[em!=attributes.journal]
				if attributes.volume
					|  #{attributes.volume}
					if attributes.issue
						| (#{attributes.issue})
			else if attributes.booktitle
				| . In !{attributes.editors} (eds.), #[em!=attributes.booktitle]
			else if attributes.misc
				| . #{attributes.misc}
			if attributes.pages
				- attributes.pages = attributes.pages.replace('-', '–')
				if attributes.journal
					| :!{attributes.pages}
				else
					| , !{attributes.pages}
			| .
			if attributes.address
				|  #{attributes.address}:
			if attributes.publisher
				|  #{attributes.publisher}.
			if attributes.doi
				|  #[span.sc doi]: 
				- var doiurl = 'https://doi.org/'+attributes.doi
				a(href!=doiurl, target='_blank')!= attributes.doi
				| .
			if attributes.errata
				|  (There are #[a(href!=attributes.errata) errata].)

mixin review(year, author, title)
	- attributes.type = 'review'
	+pub(year, 'Review of: ' + author + ', ' + title)&attributes(attributes)