racket / scribble

Other
197 stars 91 forks source link

bibtex doesn't handle escapes properly #266

Open wilbowma opened 4 years ago

wilbowma commented 4 years ago

There are three kinds of mishandled escapes below:

I suppose handling the latex escapes is non-trivial, but the bibtex escapes should probably be handled properly. Could possibly handle the latex escapes by passing them on as literal, and assuming the backend knows how to handle them.

#lang scribble/base
@(require
  racket/dict
  racket/port
  scriblib/bibtex
  scriblib/autobib
  rackunit)

@(require/expose scriblib/bibtex (generate-bib))

@(define mybibs
  (call-with-input-string
     @string-append|{@Article{bowman2018:cps-sigma,
       author   = {Bowman, William J. and Cong, Youyou and Rioux, Nick and Ahmed, Amal},
       title    = {Type-preserving {CPS} Translation of {$\Sigma$} and {$\Pi$} Types Is Not Not Possible},
       url      = {https://www.williamjbowman.com/papers\#cps-sigma},
       journal  = {PACMPL},
       year = 2018,
     }

     @Article{flueckiger2018:jit,
       author    = {Fl{\"u}ckiger, Olivier and Scherer, Gabriel and Yee, Ming-Ho and Goel, Aviral and Ahmed, Amal and Vitek, Jan},
       title     = {Correctness of speculative optimizations with dynamic deoptimization},
       year = 2018,
       journal  = {PACMPL},
       }}| bibtex-parse))

@(define-cite a~cite acitet generate-bibliography)

@(define (~cite str)
  (a~cite (generate-bib mybibs str)))

@~cite{bowman2018:cps-sigma}
@~cite{flueckiger2018:jit}

@(generate-bibliography)