@@ -532,7 +532,9 @@ deNote (Note bs:rest) =
532 = Cite cs (concatMap noteInParens ils) : go zs
532 = Cite cs (concatMap noteInParens ils) : go zs
533 go (x:xs) = x : go xs
533 go (x:xs) = x : go xs
534 needsPeriod [] = True
534 needsPeriod [] = True
535− needsPeriod (Str t:_) = not (T.null t) && isUpper (T.head t)
535+ needsPeriod (Str t:_) = case T.uncons t of
537+ Just (c,_) -> isUpper c
536 needsPeriod (Space:zs) = needsPeriod zs
538 needsPeriod (Space:zs) = needsPeriod zs
537 needsPeriod _ = False
539 needsPeriod _ = False
538 noteInParens (Note bs')
540 noteInParens (Note bs')
@@ -555,6 +557,25 @@ deNote (x:xs) = x : deNote xs
555removeFinalPeriod :: [Inline] -> [Inline]
557removeFinalPeriod :: [Inline] -> [Inline]
556removeFinalPeriod ils =
558removeFinalPeriod ils =
557 case lastMay ils of
559 case lastMay ils of
560+ Just (Span attr ils')
561+ -> initSafe ils ++ [Span attr (removeFinalPeriod ils')]
563+ -> initSafe ils ++ [Emph (removeFinalPeriod ils')]
565+ -> initSafe ils ++ [Strong (removeFinalPeriod ils')]
566+ Just (SmallCaps ils')
567+ -> initSafe ils ++ [SmallCaps (removeFinalPeriod ils')]
558 Just (Str t)
568 Just (Str t)
559 | T.takeEnd 1 t == "." -> initSafe ils ++ [Str (T.dropEnd 1 t)]
569 | T.takeEnd 1 t == "." -> initSafe ils ++ [Str (T.dropEnd 1 t)]
570+ | isRightQuote (T.takeEnd 1 t)
571+ -> removeFinalPeriod
572+ (initSafe ils ++ [Str tInit | not (T.null tInit)]) ++ [Str tEnd]
574+ tEnd = T.takeEnd 1 t
575+ tInit = T.dropEnd 1 t
578+ isRightQuote "\8221" = True
579+ isRightQuote "\8217" = True
580+ isRightQuote "\187" = True
581+ isRightQuote _ = False