python-bibtexparser icon indicating copy to clipboard operation
python-bibtexparser copied to clipboard

Add option to adjust alignment of text of multi-line values.

Open michaelfruth opened this issue 3 years ago • 6 comments
trafficstars

A new option align_multiline_values is added to BibTexWriter to enable whether text of multiline values should be aligned on top of each other. Indentation also considered _max_field_width.

Current behaviour: BibTeX entry:

@article{test,
  title     = {Hello World. I'm a very very very
  very very very very long title. Hello Bibtex Parser!
  This is still a long title!},
}

Parsing with BibtexParser will result in:

@article{test,
 title = {Hello World. I'm a very very very
very very very very long title. Hello Bibtex Parser!
This is still a long title!}
}

When align_multiline_values is set to true, the output will be the following:

@article{test,
 title = {Hello World. I'm a very very very
          very very very very long title. Hello Bibtex Parser!
          This is still a long title!}
}

michaelfruth avatar Jan 03 '22 15:01 michaelfruth

Hi @michaelfruth

I just joined the project - sorry for the long wait.

Before I start the full review - would you mind adding some unit tests to cover this functionality? Please also make sure the already existing indentation functionality works well with this.

Also, please pull master to enable running the test suite on the PR :-)

Thanks for opening the PR!

MiWeiss avatar Jul 09 '22 18:07 MiWeiss

Thanks! I'll probably add some unit tests next week or two.

michaelfruth avatar Jul 10 '22 12:07 michaelfruth

Hi @michaelfruth Do you have any updates?

MiWeiss avatar Aug 04 '22 16:08 MiWeiss

I'm lacking behind my schedule. I didn't forget to write some tests, try to do this until the end of this week.

michaelfruth avatar Aug 09 '22 17:08 michaelfruth

No worries! Thanks for the heads up, and for your contribution.

MiWeiss avatar Aug 09 '22 17:08 MiWeiss

I've added some tests to test:

  1. the basic functionality
  2. the new functionality with align_values and indent

I have also encountered this behavior #315 , I'm not quite sure if this is expected.

michaelfruth avatar Aug 09 '22 20:08 michaelfruth