racket / racket/scribble

bibtex parse-pages may be a little too restrictive

Open
#302 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
250
Forks
102
Avg merge
11d 11h
Merged PRs (30d)
1

Description

The regex matching in parse-pages restricts BibTeX pages field to two numbers separated by one or more hyphens. However, I occasionally encounter journals that use a single number or identifier in the pages field, or those that use letters in the page numbers, or those that use an en-dash instead of two hyphens as the separator. These edge cases would all cause Scribble to fail.

https://github.com/racket/scribble/blob/beb2d9834169665121d34b5f3195ddf252c3c998/scribble-lib/scriblib/bibtex.rkt#L439

(define (parse-pages ps)
  (match ps
    [(regexp #rx"^([0-9]+)\\-+([0-9]+)$" (list _ f l))
     (list f l)]
    [#f
     #f]
    [_
     (error 'parse-pages "Invalid page format ~e" ps)]))

I'm not sure if it would be in the best interest of the developers to spend time fixing these edge cases. Would it be possible to have an option to override parse-pages (or make it a warning instead of an error)?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at parse-pages in scribble-lib/scriblib/bibtex.rkt around line 439 and inspect how its result is used for BibTeX pages fields. Compare the current behavior with the single-number, lettered, and en-dash cases described; done means the handling policy is defined and those cases no longer cause the reported failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
tex
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.