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

Multiple citations of the same key lead to several entries in the references list #226

Open
samthiriot opened this issue Jun 8, 2023 · 5 comments
Labels
enhancement New feature or request solved

Comments

@samthiriot
Copy link
Contributor

Hi,
Thanks for the great plugin!

I cited several times the same article (same key) in several places using tpcite. I expected the latex/bibtex behaviour with the same number being referenced several times (one unique entry 1 referenced several times). I obtain instead as many entries in the list of references created by tpref as tpcite calls.

I can try to contribute the code to have unique references if you agree this would be the expected behaviour

Thanks again

@winkm89 winkm89 added the enhancement New feature or request label Jun 11, 2023
@winkm89
Copy link
Owner

winkm89 commented Jun 11, 2023

Hi Samuel,

My intention was to enable a kind of footnote citation like in Word or Wikipedia, in which is it more common to repeat the source. But I can fully understand that this is not for all a wished behaviour. So, I think it wood be the best idea to create an option (as an shortcode parameter) for the user to switch between both variants.

@samthiriot
Copy link
Contributor Author

Makes sense, thanks! I'll set up a development environment when possible and propose you a merge request later. Thanks again for the plugin, which provides a high value for me!

@samthiriot
Copy link
Contributor Author

samthiriot commented Jun 17, 2023

Hi Michael,

I'm analyzing the code, and am back with a question regarding the expected behaviour.

analyzis
The id of the reference is generated when processing tpcite shortcode (in order to generate the number 1, 2...). So the solution does not only lie in the tpref code, but we should know the preference of the user before the first call to tpcite. If I add an option to the tpref shortcode, earlier tpcite cannot be aware of it.

options

I see few solutions:

  1. the LaTeX/BibTeX way is to define the option earlier in the document. In bibtex, it is done with a "\bibliographystyle" command. This would mean adding a shortcode dedicated to tuning an option changing the behaviour of the further tpcite and tpref shortcodes (stored in the shared TP_Cite_Object). I'm not sure this is in line with habits in wordpress
  2. we might imagine the user wants a consistent behaviour accross all pages, so this might be an option of the entire plugin. But this would not be consistent with the behavior of the plugin for other parameters. For instance why would "show links" be defined as a shortcode option, while "how to deal with repeated cite" would be a plugin level setting?
  3. other plugins define attributes at the scale of the page (for instance language), but this requires adding parameters to the block editor, and this would be one more time the first and only option to do it

I'd tend to opt for option 1 which is easy to do with less code. It would affect only people who want to factorize the refs, the default behaviour would remain unchanged.

What do you think?

Thanks for you time

@samthiriot
Copy link
Contributor Author

samthiriot commented Jun 19, 2023

After prototyping: adding a new shortcode (option 1) does not seem very relevant:

  • one more shortcode is way more php code in the plugin (therefore more maintenance)
  • it requires more doc in the wiki, and therefore more things to go through for a user,
  • it creates a weird shortcode with no direct effect (not a standard practice in wordpress)

I submitted a merge request with option 2 (additional setting). Other options might be considered later, such as adding backrefs for instance.

I've the feeling it's really not intrusive to the user; indeed no one will notice the possibility if they don't change the setting in the settings page.

Feel free to tell me if this is not ok for you.

Thanks!

@winkm89
Copy link
Owner

winkm89 commented Jun 20, 2023

Thank you for the pull request! I think each variant has its advantages and disadvantages. I also haven't the perfect idea. So, the one you have added is fully fine for me. Let's give it a try in the wild :)

@winkm89 winkm89 added the solved label Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request solved
Projects
None yet
Development

No branches or pull requests

2 participants