-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathcontent.bibtex.liquid
More file actions
38 lines (38 loc) · 7.87 KB
/
content.bibtex.liquid
File metadata and controls
38 lines (38 loc) · 7.87 KB
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
{%- if include.content.from_book -%}{%- assign book = site.content | where: "slug", include.content.from_book | where: "category", "monographs" | first -%}{%- else -%}{%- assign book = nil -%}{%- endif -%}
{%- assign series = site.series | find: "slug", include.content.series -%}
{%- assign journal = site.journals | find: "slug", include.content.journal -%}
{%- assign publisher = include.content.publisher | default: book.publisher | default: series.publisher | default: journal.publisher -%}{%- assign publisher = site.publishers | find: "slug", publisher | default: publisher -%}
{%- assign author = nil -%}
{%- assign curlyspace = "} " -%}
{%- assign curly = "}" -%}
{%- assign escand = "{\\\&}" -%}
{%- assign escperc = "{\%" | append: curly -%}
@{% case include.content.category %}{% when "monographs" %}book{% when "booklets" %}{% if include.content.subcat == "thesis" %}phdthesis{% else %}book{% unless include.content.publisher or publisher %}let{% endunless %}{% endif %}{% when "articles" %}article{% when "papers" %}inproceedings{% when "canon" %}{% if include.content.authors and include.content.publisher %}book{% else %}misc{% endif %}{% when "excerpts" %}incollection{% else %}{% if include.content.journal %}article{% else %}misc{% endif %}{% endcase %}{% raw %}{{% endraw %}{% assign fname = include.content.slug | replace: ".", "-" | split: "_" %}{{ fname[1] | default: include.content.translator | slugify: 'latin' }}{{ include.content.year }}{% if include.content.year or fname[1] or include.content.translator %}-{% endif %}{{ fname | first }},
{% if site.data.bibtex.displaycats contains include.content.category %} category={% raw %}{{% endraw %}{{ include.content.category }}},
{% endif %} title={% raw %}{{% endraw %}{% assign title = include.content.title | replace: "_", "*" | replace: "&", escand | replace: "%", escperc %}{% assign fc = title | slice: 0 %}{% assign lc = title | slice: -1 %}{% if fc == '*' %}{% assign title = title | replace_first: '*', "\textit{" %}{% endif %}{% if lc == '*' %}{% assign title = title | split: "*" | join: "*" | append: curly %}{% endif %}{% assign chars = title | replace: " **", " \textbf{" | replace: "** ", curlyspace | replace: " *", " \textit{" | replace: "(*", "(\textit{" | replace: "*", curly | split: "" %}{% assign title = "" %}{% assign insidecurl = 0 %}{% for char in chars %}{% if char == "{" %}{% assign insidecurl = insidecurl | plus: 1 %}{% elsif char == curly %}{% assign insidecurl = insidecurl | minus: 1 %}{% endif %}{% assign dwn = char | downcase %}{% if dwn != char and insidecurl == 0 %}{% assign title = title | append: "{" | append: char | append: "}" %}{% else %}{% assign title = title | append: char %}{% endif %}{% endfor %}{{ title }}},
{% if include.content.authors and include.content.authors.size > 0 %} author={% assign authors = '' | split: '' %}{% if include.useslugs %}{% for aslug in include.content.authors %}{% if aslug contains " " %}{% capture a %}"{{ aslug | replace: "&", escand }}"{% endcapture %}{% assign authors = authors | push: a %}{% else %}{% assign authors = authors | push: aslug %}{% endif %}{% endfor %}{{ authors | join: ' # " and " # ' }}{% else %}{% raw %}{{% endraw %}{% for aslug in include.content.authors %}{% if aslug contains " " %}{% assign authors = authors | push: aslug %}{% else %}{% assign author = site.authors | find: 'slug', aslug %}{% assign authors = authors | push: author.title %}{% endif %}{% endfor %}{{ authors | join: " and " | replace: "&", escand }}}{% endif %},
{% elsif include.content.reader %} author={% if include.content.reader contains " " %}{% raw %}{{% endraw %}{{ include.content.reader }}}{% else %}{% if include.useslugs %}{{ include.content.reader }}{% else %}{% raw %}{{% endraw %}{% assign author = site.authors | find: 'slug', include.content.reader %}{% if author %}{{ author.title }}{% else %}{{ include.content.reader }}{% endif %}}{% endif %}{% endif %},
{% endif %}{% if include.content.translator %} translator={% assign translators = include.content.translator | split: " and " %}{% if include.useslugs %}{% for t in translators %}{% if t contains " " %}"{{ t }}"{% else %}{{ t }}{% endif %}{% unless forloop.last %} # " and " # {% endunless %}{% endfor %}{% else %}{% raw %}{{% endraw %}{% capture t %}{% include_cached content_authors_string.html authors=translators %}{% endcapture %}{{ t | strip | replace: ", and ", " and " | replace: ", ", " and " }}}{% endif %},
{% endif %}{% if include.content.booktitle %} booktitle={% raw %}{{% endraw %}{{ include.content.booktitle }}},
{% elsif book %} booktitle={% raw %}{{% endraw %}{{ book.title | replace: "_", "" | replace: "*", "" }}},
{% endif %}{% if include.content.editor %} editor={% assign editors = include.content.editor | split: " and " %}{% if include.useslugs %}{% for t in editors %}{% if t contains " " %}"{{ t }}"{% else %}{{ t }}{% endif %}{% unless forloop.last %} # " and " # {% endunless %}{% endfor %}{% else %}{% raw %}{{% endraw %}{% capture t %}{% include_cached content_authors_string.html authors=editors %}{% endcapture %}{{ t | strip | replace: ", and ", " and " | replace: ", ", " and " }}}{% endif %},
{% endif %}{% if include.content.publisher or publisher %} publisher={% raw %}{{% endraw %}{% if publisher %}{{ publisher.title | default: publisher | replace: "&", escand }}{% else %}{{ include.content.publisher | replace: "&", escand }}{% endif %}},
{% endif %}{% if include.content.school %} school={% raw %}{{% endraw %}{{ include.content.school }}},
{% endif %}{% if include.content.address or publisher.address or journal.address %} address={% raw %}{{% endraw %}{{ include.content.address | default: journal.address | default: publisher.address }}},
{% endif %}{% if include.content.year %} year={{ include.content.year }},
{% endif %}{% if include.content.month %} month={{ include.content.month }},
{% endif %}{% if include.content.journal %} journal={% raw %}{{% endraw %}{% if journal %}{{ journal.title | replace: "&", escand }}{% else %}{{ include.content.journal | replace: "&", escand }}{% endif %}},
{% endif %}{% if include.content.volume %} volume={{ include.content.volume }},
{% endif %}{% if include.content.series %} series={% raw %}{{% endraw %}{% if series %}{{ series.title }}{% else %}{{ include.content.series }}{% endif %}},
{% endif %}{% if include.content.number %} number={{ include.content.number }},
{% endif %}{% if include.content.pages %} page{% if include.content.pages contains "--" %}s{% else %}count{% endif %}={% if include.content.pages contains "--" %}{% raw %}{{% endraw %}{% endif %}{{ include.content.pages }}{% if include.content.pages contains "--" %}{% raw %}}{% endraw %}{% endif %},
{% endif %}{% if include.content.minutes %} minutes={{ include.content.minutes }},
{% endif %}{% if include.content.chapter %} chapter={{ include.content.chapter }},
{% endif %}{% if include.content.course or include.content.tags.size > 0 %} keywords={% raw %}{{% endraw %}{% assign tags = include.content.tags %}{% if include.content.course %}{% assign tags = tags | unshift: include.content.course %}{% endif %}{{ tags | join: "," }}},
{% endif %}{% if include.content.oclc %} oclc={% raw %}{{% endraw %}{{ include.content.oclc }}},
{% endif %}{% if include.content.olid %} olid={% raw %}{{% endraw %}{{ include.content.olid }}},
{% endif %}{% if include.content.source_url contains "doi.org/" %} doi={% raw %}{{% endraw %}{{ include.content.source_url | split: "doi.org/" | last }}},
{% endif %}{% if include.content.openalexid %} openalex_id={% raw %}{{% endraw %}{{ include.content.openalexid }}},
{% endif %} ranking={% raw %}{{% endraw %}rank{{ include.content.stars }}},
url={% raw %}{{% endraw %}{% if include.content.external_url %}{% unless include.content.external_url contains "archive.org/details/" %}{{ include.content.external_url }}{% else %}{{ include.content.url | absolute_url }}{% endunless %}{% else %}{{ include.content.url | absolute_url }}{% endif %}}
}