@@ -115,7 +115,7 @@ writeBibtexString opts variant mblang ref =
115115 "motion_picture" | variant == Biblatex -> "movie"
116116 "review" | variant == Biblatex -> "review"
117117 _ -> "misc"
118−
118+
119119 mbSubtype =
120120 case referenceType ref of
121121 "article-magazine" -> Just "magazine"
@@ -149,7 +149,7 @@ writeBibtexString opts variant mblang ref =
149149 , "type"
150150 , "entrysubtype"
151151 , "note"
152− , "language"
152+ , "langid"
153153 , "abstract"
154154 , "keywords"
155155 ]
@@ -202,12 +202,19 @@ writeBibtexString opts variant mblang ref =
202202 [ (", " <>) <$> nameGiven name,
203203 nameDroppingParticle name ]
204204
205− titlecase = case mblang of
205+ mblang' = (parseLang <$> getVariableAsText "language") <|> mblang
206+
207+ titlecase = case mblang' of
206208 Just (Lang "en" _) -> titlecase'
207209 Nothing -> titlecase'
208− _ -> id
209−
210− titlecase' = addTextCase mblang TitleCase .
210+ _ ->
211+ case variant of
212+ Bibtex -> B.spanWith nullAttr
213+ -- BibTex lacks a language field, so we wrap non-English
214+ -- titles in {} to protect case.
215+ Biblatex -> id
216+
217+ titlecase' = addTextCase mblang' TitleCase .
211218 (\ils -> B.fromList
212219 (case B.toList ils of
213220 Str t : xs -> Str t : Walk.walk spanAroundCapitalizedWords xs
@@ -299,6 +306,8 @@ writeBibtexString opts variant mblang ref =
299306 getContentsFor "urldate" = getVariable "accessed" >>= toLaTeX . valToInlines
300307 getContentsFor "year" = getVariable "issued" >>= getYear
301308 getContentsFor "month" = getVariable "issued" >>= getMonth
309+ getContentsFor "pages" = getVariable "page" >>= toLaTeX . valToInlines
310+ getContentsFor "langid" = getVariable "language" >>= toLaTeX . valToInlines
302311 getContentsFor "number" = (getVariable "number"
303312 <|> getVariable "collection-number"
304313 <|> getVariable "issue") >>= toLaTeX . valToInlines