Skip to content

Commit bdc2089

Browse files
committed
closes #112
1 parent e491767 commit bdc2089

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## Unreleased
44

5-
Fixed bug whereby sections with empty content were dropped by `markup.iter_markdown_sections`.
5+
- Fixed bug whereby sections with empty content were dropped by `markup.iter_markdown_sections`.
6+
- Fixed bug whereby the "booktitle" field was not rendered in the linearization of a `Source` of genre "inbook".
67

78

89
## 3.24.1

src/clldutils/source.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def italicized(s):
288288
if self.get('doi'):
289289
res.append('doi: {}'.format(
290290
'[{0}](https://doi.org/{0})'.format(self['doi']) if markdown else self['doi']))
291-
elif genre == 'incollection' or genre == 'inproceedings':
291+
elif genre in {'incollection', 'inproceedings', 'inbook'}:
292292
prefix = 'In'
293293
atom = ''
294294
if editors:
@@ -299,7 +299,8 @@ def italicized(s):
299299
atom += " %s" % italicized(self.get_with_translation('booktitle'))
300300
if self.get('pages'):
301301
atom += ", %s" % self.norm_pages
302-
res.append(prefix + atom)
302+
if atom:
303+
res.append(prefix + atom)
303304
else:
304305
# check for author to make sure we haven't included the editors yet.
305306
if editors and self.get('author'):
@@ -315,7 +316,7 @@ def italicized(s):
315316
if self.get('issue'):
316317
res.append("(%s)" % self['issue'])
317318

318-
if not pages_at_end and self.get('pages'):
319+
if not pages_at_end and self.get('pages'): # pragma: no cover
319320
res.append(self.norm_pages)
320321

321322
thesis_handled = False

tests/test_source.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,17 @@ def test_striptex():
116116
volume = {2}
117117
}""",
118118
"Healey, Alan. n.d. History of research in Austronesian languages: "
119-
"Admiralty Islands area. 2. 223-232."),
119+
"Admiralty Islands area. In New Guinea area languages and language study, 223-232."),
120+
(
121+
"""@misc{316361,
122+
author = {Healey, Alan},
123+
booktitle = {New Guinea area languages and language study},
124+
pages = {223-232},
125+
title = {History of research in Austronesian languages: Admiralty Islands area},
126+
volume = {2}
127+
}""",
128+
"Healey, Alan. n.d. History of research in Austronesian languages: "
129+
"Admiralty Islands area. 2. 223-232pp."),
120130
(
121131
"""@incollection{316361,
122132
author = {Healey, Alan},

0 commit comments

Comments
 (0)