Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions src/verso-manual/VersoManual/Bibliography.lean
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,13 @@ def Citable.bibHtml [Monad m]
return {{ {{authors}} s!", {p.year}. " {{ link {{"“" {{← go p.title}} "”"}} }} ". In " <em>{{← go p.booktitle}}"."</em>{{(← p.series.mapM go).map ({{" (" {{·}} ")" }}) |>.getD .empty}} }}
| .article p =>
let authors ← andList <$> p.authors.mapM go
return {{ {{authors}} " (" {{(← p.month.mapM go).map (· ++ {{" "}}) |>.getD .empty}}s!"{p.year}" "). " {{ link {{"“" {{← go p.title}} "”"}} }} ". " <em>{{← go p.journal}}"."</em> <strong>{{← go p.volume}}</strong>" "{{← go p.number}} {{p.pages.map (fun (x, y) => s!"pp. {x}–{y}") |>.getD .empty }} "."}}
let journalDot := if (slugString p.journal).endsWith "." then "" else "."
let numberInl ← go p.number
let numberHtml : Html := if (slugString p.number).isEmpty then .empty
else {{"(" {{numberInl}} ")"}}
let pagesHtml : Html := p.pages.map (fun (x, y) => {{", pp. " s!"{x}–{y}"}})
|>.getD .empty
return {{ {{authors}} " (" {{(← p.month.mapM go).map (· ++ {{" "}}) |>.getD .empty}}s!"{p.year}" "). " {{ link {{"“" {{← go p.title}} "”"}} }} ". " <em>{{← go p.journal}}{{journalDot}}</em>" " <strong>{{← go p.volume}}</strong>{{numberHtml}}{{pagesHtml}}"."}}
| .thesis p =>
return {{ {{← go p.author}} s!", {p.year}. " <em>{{link (← go p.title)}}</em> ". " {{← go p.degree}} ", " {{← go p.university}} }}
| .arXiv p =>
Expand Down Expand Up @@ -212,15 +218,21 @@ def Citable.bibTeX (go : Doc.Inline Genre.Manual → TeXT Manual (ReaderT Extens
}
| .article p =>
let authors ← andListTeX <$> p.authors.mapM go
let journalDot := if (slugString p.journal).endsWith "." then "" else "."
let numberInl ← go p.number
let numberTeX : TeX := if (slugString p.number).isEmpty then .empty
else \TeX{"(" \Lean{numberInl} ")"}
let pagesTeX : TeX := p.pages.map (fun (x, y) => \TeX{", pp.~" \Lean{toString x} "--" \Lean{toString y} })
|>.getD .empty
return \TeX{
\Lean{authors} " ("
\Lean{ (← p.month.mapM go).map (fun x => \TeX{\Lean{x} " "}) |>.getD .empty }
\Lean{toString p.year} "). "
\Lean{ link \TeX{ "``" \Lean{← go p.title} "''" } } ". In "
\em{ \Lean{ ← go p.journal } "." }
\Lean{ ← go p.volume } " "
\Lean{ ← go p.number }
\Lean{ p.pages.map (fun (x, y) => \TeX{\Lean{toString x} "-" \Lean{toString y} }) |>.getD .empty }
\Lean{ link \TeX{ "``" \Lean{← go p.title} "''" } } ". "
\em{ \Lean{ ← go p.journal } \Lean{journalDot} }
"~" \textbf{ \Lean{ ← go p.volume } }
\Lean{numberTeX}
\Lean{pagesTeX}
"."
}
| .thesis p =>
Expand Down