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

Sanitization of generated filenames (remove LaTeX commands) #12188

Open
pcdi opened this issue Nov 12, 2024 · 6 comments
Open

Sanitization of generated filenames (remove LaTeX commands) #12188

pcdi opened this issue Nov 12, 2024 · 6 comments
Labels
good first issue An issue intended for project-newcomers. Varies in difficulty.

Comments

@pcdi
Copy link

pcdi commented Nov 12, 2024

Is your suggestion for improvement related to a problem? Please describe.
For linked files, when they are renamed automatically according to filename format pattern, the fields that are used to generate the new filename are not stripped of LaTeX commands, so these LaTeX commands show up in the filename.

Consider the following example:

@Article{BrayBuildingCommunity,
  author       = {David Bray},
  date         = {2006},
  journaltitle = {Economy and Society},
  number       = {4},
  pages        = {530--549},
  title        = {Building \mkbibquote{Community}},
  volume       = {35},
  doi          = {10.1080/03085140600960799},
  subtitle     = {New Strategies of Governance in Urban China},
}

If the pattern is set to [bibtexkey] - [fulltitle], then the generated filename will be BrayBuildingCommunity - Building _mkbibquote_Community_.pdf. In this case, only \ and {} are sanitized to _ but the command name mkbibquote remains.

Describe the solution you'd like
The filename generation function should be able to strip fields that are used to create the filename of LaTeX commands (even if only optionally). In the above example, the generated filename should then be BrayBuildingCommunity - Building Community.pdf.

@koppor koppor added this to the 6.0 milestone Nov 12, 2024
@koppor koppor added the good first issue An issue intended for project-newcomers. Varies in difficulty. label Nov 12, 2024
@github-project-automation github-project-automation bot moved this to Free to take in Good First Issues Nov 12, 2024
@koppor
Copy link
Member

koppor commented Nov 12, 2024

Implementation hint: We have the latex-to-unicode formatter. It should be used in the filename conversion.

  1. Find code place where to add
  2. Find tests (possible simply by Ctrl+Shift+T
  3. Add refined test case
  4. See tests failing
  5. Fix code

In case latex-to-unicode does not know this command, think harder of how to do step 5. Maybe use remove-latex-commands? Check the functionality - because the parameters inside the latex command should be kept.

@Siedlerchr
Copy link
Member

We should rather use RemoveLatexCommandsFormatter as Latex2Unicode can produce weird characters you don't probably want

@github-project-automation github-project-automation bot moved this to Normal priority in Prioritization Nov 13, 2024
@koppor koppor moved this from Normal priority to High priority in Prioritization Nov 13, 2024
@koppor koppor removed this from the 6.0 milestone Nov 13, 2024
@yoyounik
Copy link

Hii @koppor can i be assigned this issue to work on

@koppor
Copy link
Member

koppor commented Nov 14, 2024

/assign @yoyounik

Copy link
Contributor

👋 Hey @yoyounik, thank you for your interest in this issue! 🎉

We're excited to have you on board. Start by exploring our Contributing guidelines, and don't forget to check out our workspace setup guidelines to get started smoothly.

In case you encounter failing tests during development, please check our developer FAQs!

Having any questions or issues? Feel free to ask here on GitHub. Need help setting up your local workspace? Join the conversation on JabRef's Gitter chat. And don't hesitate to open a (draft) pull request early on to show the direction it is heading towards. This way, you will receive valuable feedback.

Happy coding! 🚀

⏳ Please note, you will be automatically unassigned if the issue isn't closed within 30 days (by 14 December 2024). A maintainer can also add the "📌 Pinned"" label to prevent automatic unassignment.

@github-actions github-actions bot added the 📍 Assigned Assigned by assign-issue-action (or manually assigned) label Nov 14, 2024
@yoyounik
Copy link

Hey @koppor i have raise a PR for this: #12194

please check it once, whenever you get the time, Thanks :)

@subhramit subhramit removed the 📍 Assigned Assigned by assign-issue-action (or manually assigned) label Dec 2, 2024
@subhramit subhramit moved this from Assigned to Free to take in Good First Issues Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue An issue intended for project-newcomers. Varies in difficulty.
Projects
Status: Free to take
Status: High priority
Development

No branches or pull requests

5 participants