fiduswriter / biblatex-csl-converter

A set of JavaScript converters: bib(la)tex => json, json => csl, and json => biblatex
GNU Lesser General Public License v3.0
34 stars 10 forks source link

Preserve the formatting of the source file on exporting #132

Open DmitrySharabin opened 1 month ago

DmitrySharabin commented 1 month ago

Thank you so much for this tool!

I'm trying to add the support for .bib files to Madata, but I'm facing an issue I don't know how to solve.

Suppose the source .bib file looks like this (mind the indentation):

@article{connell2013content,
  title={Content management systems: trends in academic libraries},
  author={Connell, Ruth Sara},
  journal={Information Technology and Libraries (Online)},
  volume={32},
  number={2},
  pages={42},
  year={2013},
  publisher={American Library Association}
}

After modifying it and writing back (with BibLatexExporter().parse()), I lose the indentation:

@article{connell2013content,
title={Content management systems: trends in academic libraries},
author={Connell, Ruth Sara},
journal={Information Technology and Libraries (Online)},
volume={32},
number={2},
pages={42},
year={2013},
publisher={American Library Association}
}

Is there a way to preserve the formatting of the source file after modifying it and writing back?

johanneswilm commented 1 month ago

Hey, no the indentation is not seen as containing relevant information so it is not preserved and there would be no simple way of doing that. In many cases, it's not wanted either as the whitespace of many input files can be quite chaotic.

What we should be able to do though is to allow to specify an indentation setting to be used for the export mechanism. That would then not necessarily be the same amount as the indentation on input, but it would produce better looking output.

What that be something you would be interested in, @DmitrySharabin ?

DmitrySharabin commented 1 month ago

Hey there,

Thank you so much for your quick response.

What we should be able to do though is to allow to specify an indentation setting to be used for the export mechanism.

That would be nice!

What that be something you would be interested in, @DmitrySharabin ?

I am not sure if I'm skilled enough to help here, but I'll try. 🙂