#30 — Wrapped bibtex entries have too many blanks
by
Bernd Rellermeyer
—
last modified
Jan 08, 2009 02:37 PM
| State | Unconfirmed |
|---|---|
| Version: | 0.9.0 |
| Area | Functionality |
| Issue type | Bug |
| Severity | Medium |
| Submitted by | Bernd Rellermeyer |
| Submitted on | May 12, 2007 |
| Responsible |
—
|
| Target release: |
—
|
When importing a bibtex entry with a value wrapped into more than one line, the result has too many blanks. The following patch in bibtex.py seems to help:
def parseEntry(self, entry):
"""
parses a single entry
returns a dictionary to be passed to
BibliographyEntry's edit method
"""
...
# remove newlines and <CR>s, and remove the last '}'
entry = entry.replace('\r', '').rstrip().rstrip('}')
entry = re.sub('\s+', ' ', entry)
tokens = self.pattern.split(entry)
...
- Steps to reproduce:
- Import the following entry and look at the publisher entry:
@Book{stammen92:_das_schwere_erbe,
editor = {Theo Stammen},
title = {Das schwere Erbe: 1918{\textendash}1923},
publisher = {Bayerische Landeszentrale f{\"u}r politische
Bildungsarbeit},
year = 1992,
volume = 1,
series = {Die Weimarer Republik},
address = {M{\"u}nchen},
edition = {Zweite}
}
Added by
Tim Hicks
on
May 20, 2007 11:33 AM
Can you provide a test that fails before your patch is applied, and passes after?
Added by
Bernd Rellermeyer
on
May 28, 2007 11:12 AM
The example above is a test. I used emacs to write my bibtex file. The emacs mode has the ability to wrap long lines with an indent to match the previous line (pressing meta-q). That means, for a long title I get two lines with the second line indented with several blanks. The parser simply concatenated these lines without eliminating the blanks at the beginning of the second line.
Added by
Tim Hicks
on
Jun 04, 2007 04:10 PM
Sorry, I'm still not totally clear on what you say the correct behaviour should be. That's why I asked if you could provide a test.
By a test, I mean a "unit test" of the sort that we have already for bibtex parsing. See http://dev.plone.org/[…]/testBibtexParsing.py. If you can provide a method that tests the specific functionality that you want - one that fails with current CMFBib code and passes with your proposed patch - then we can probably apply your change straight away.
No responses can be added.
If you can, please log in before submitting a reaction.
