Skip to content

Commit bcee77a

Browse files
committed
Support volume in thesis
1 parent cb57aad commit bcee77a

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

build/src/bib_render.rs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ fn book_item_type(book: &Book) -> &'static str {
135135
}
136136
}
137137

138+
fn thesis_item_type(thesis: &Thesis) -> &'static str {
139+
if thesis.volume.is_none() {
140+
"https://schema.org/Thesis"
141+
} else {
142+
"https://schema.org/Thesis https://schema.org/PublicationVolume"
143+
}
144+
}
145+
138146
fn item_type(reference: &Reference) -> &'static str {
139147
match reference {
140148
Reference::ConferencePaper(_) | Reference::JournalArticle(_) => {
@@ -144,10 +152,10 @@ fn item_type(reference: &Reference) -> &'static str {
144152
"https://schema.org/Article"
145153
}
146154
Reference::Book(b) => book_item_type(b),
155+
Reference::Thesis(t) => thesis_item_type(t),
147156
Reference::Chapter(_) => "https://schema.org/Chapter",
148157
Reference::Patent(_) | Reference::Document(_) => "https://schema.org/CreativeWork",
149158
Reference::WebPage(_) => "https://schema.org/WebPage",
150-
Reference::Thesis(_) => "https://schema.org/Thesis",
151159
}
152160
}
153161

@@ -394,15 +402,15 @@ fn render_title(r: &Reference) -> Markup {
394402
}
395403
(title_alt)
396404
(archive_url)
397-
@if let Reference::Book(b) = r {
398-
@if let Some(vol) = &b.volume {
399-
" volume "
400-
span itemProp="volumeNumber" { (vol.to_string(true)) }
401-
@if let Some(vol_title) = &b.volume_title {
402-
": ‘" (render_lstr(vol_title, None, None, None)) "’"
403-
}
405+
@if let Reference::Book(Book { volume: Some(vol), volume_title, ..}) |
406+
Reference::Thesis(Thesis { volume: Some(vol), volume_title, .. }) = r {
407+
" volume "
408+
span itemProp="volumeNumber" { (vol.to_string(true)) }
409+
@if let Some(vol_title) = &volume_title {
410+
": ‘" (render_lstr(vol_title, None, None, None)) "’"
404411
}
405-
412+
}
413+
@if let Reference::Book(b) = r {
406414
@if let Some(edition) = &b.edition {
407415
" ("
408416
span itemprop="bookEdition" {

build/src/bibliography.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,9 @@ pub struct Thesis {
322322
pub subtitle: Option<String>,
323323
pub genre: Option<String>,
324324
pub issued: Date,
325-
pub volume: Option<u32>,
325+
pub volume: Option<NumberOrString>,
326+
#[serde(rename = "volume-title")]
327+
pub volume_title: Option<LString>,
326328
pub publisher: Option<LString>,
327329
#[serde(rename = "publisher-place")]
328330
pub publisher_place: Option<LString>,

building-pdfs.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/bibliography.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3305,7 +3305,7 @@ BasothoOralPoetry:
33053305
year: 2008
33063306
publisher: University of South Africa
33073307
publisher-place: Pretoria, South Africa
3308-
URL: http://uir.unisa.ac.za/handle/10500/1362
3308+
URL: https://uir.unisa.ac.za/handle/10500/1362
33093309
UltraStrongMorris:
33103310
type: article-journal
33113311
title: Calculating Ultrastrong and Extended Solutions for Nine Men’s Morris,

0 commit comments

Comments
 (0)