Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to make bib parser #272

Closed
wants to merge 2 commits into from
Closed

Conversation

alexey-pronkin
Copy link
Collaborator

@alexey-pronkin alexey-pronkin commented Nov 10, 2021

Тут можно помочь с решением #271
Решено писать на pybtex
Задачи:
[] Удаление дубликатов (допустим, выбираем тот вариант, который длинее по символам)
[] Сортировка записей в алфавитном порядке по лейблам
[] Одинаковое форматирование
[] Добавить в прекоммит

@alexey-pronkin
Copy link
Collaborator Author

alexey-pronkin commented Nov 10, 2021

Вот такое решение есть https://github.com/pkgw/bibtools с непонятной лицензией
И чужие велосипеды https://tex.stackexchange.com/questions/76420/cleaning-up-a-bib-file
Если есть идеи - говорите, желательно на чистом python, чтобы добавить в pre-commit без боли

@SemyonSinchenko
Copy link
Collaborator

А этот чем плох?
https://docs.pybtex.org/api/parsing.html

@vvssttkk
Copy link
Member

https://docs.pybtex.org/api/parsing.html

c этим для своего велосипеда лучше использовать, чем полностью свой собирать

Copy link
Member

@vvssttkk vvssttkk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

хорошо бы ещё и пару тестов написать на это дело

# entry = "{" + entry attepmt to use json.loads()
else:
entry+=line
print(bib_list)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

давай для такого лучше https://github.com/Delgan/loguru использовать если сильно нужно, долой print

else:
entry+=line
print(bib_list)
with open("qmlcourseRU/_bibliography/references2.bib", "w") as bibfile:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут создается новый bib-файл, но как на него будет смотреть jb, не особо понял этот случай?

@vvssttkk
Copy link
Member

@alexey-pronkin а как в pre-commit файл собираешь добавлять?

@alexey-pronkin
Copy link
Collaborator Author

alexey-pronkin commented Nov 13, 2021

Да это просто черновик был надо было отметить, что в код пока не смотреть) Да, наверное, разумнее все-таки добавить либу для парсинга, (я ее не нагуглил, выглядит огонь) довольно сложный свой парсер получается. Пока подождите отслеживать ветку до следующей недели

@alexey-pronkin
Copy link
Collaborator Author

Для себя:
https://docs.pybtex.org/api/plugins.html#id8

@vvssttkk vvssttkk added this to in progress in qmlc board Dec 16, 2021
@vvssttkk
Copy link
Member

vvssttkk commented Feb 20, 2022

кажется что неактуально, @alexey-pronkin мб закроем?

@vvssttkk vvssttkk moved this from in progress to to do in qmlc board Jun 4, 2022
@vvssttkk vvssttkk closed this Jun 12, 2022
qmlc board automation moved this from to do to done Jun 12, 2022
@alexey-pronkin
Copy link
Collaborator Author

Да, закрывай. На это времени пока нет

@vvssttkk vvssttkk deleted the feature/pre-commit-bib branch June 12, 2022 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Сортировка по лейблу и удаление дубликов в библиографии
3 participants