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

Allow for different types of citation key formats in tidy_bib_file() #81

Open
ilsePit opened this issue Dec 30, 2020 · 3 comments
Open

Comments

@ilsePit
Copy link
Contributor

ilsePit commented Dec 30, 2020

This request is with regards the regular expression used in line 48 in tidy_bib_file.R.

The current regex used does not account for the format of citation keys I use (Author-et-al_2020), and I can imagine this is true for others as well. I notice the commented-out regex in line 47 and 49 would do the trick as I need them to. What was the reason these were disregarded? I have to admit I am not fluent enough in regex to figure it out so far.

I suggest adding a regex parameter to tidy_bib_file(), in which the used can specify the regex they want to use to read their citation keys (with a default given).

I'd happily make a pull request but wanted to make sure to check why the regex in line 48 was chosen first.

Thanks!

@ilsePit
Copy link
Contributor Author

ilsePit commented Dec 30, 2020

suggested regex as default: "@[^(.|;|,|?|!)\\s\\]\)]+" , adjusted from line 47.

@crsh
Copy link
Owner

crsh commented Jan 5, 2021

Hi, thanks for the feedback. I'm all for supporting your citation key format and I think allowing users to specify custom regex is a great idea! I added the regex in question in response to this issue: #49 Regrettably, it seems I did not implement the problematic keys as unit tests. So as a strategy for a PR, I think it would be great to first create a Rmd file containing a range of different test cases and then adjusting the regex to ensure it catches all cases. This would inform us, about whether the regex you suggest preserves the current functionality and adds the desired flexibility.

@ilsePit
Copy link
Contributor Author

ilsePit commented Jan 5, 2021

Not sure I know exactly what you mean, I'm quite new to sharing code, so forgive me for asking rudimentary questions :). i understand making an Rmd and bib with a ton of different keys would be helpful in figuring out the best regex, but would you want me to push these to this repository? Or is there another way to do this (collaboratively) without adding those files to this repo? I can also do the test locally and then push once I find the Ultimate Regex (if that exists).
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants