Closed (fixed)
Project:
Bibliography & Citation
Version:
3.0.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Anonymous (not verified)
Created:
3 Jan 2017 at 11:32 UTC
Updated:
10 Feb 2026 at 18:13 UTC
Jump to comment: Most recent
Comments
Comment #1
Anonymous (not verified) commentedmaxmannen created an issue. See original summary.
Comment #2
kruhak commentedFor the moment we use citeproc-php library for rendering citations. As I know this library doesn't support rendering of URL's.
I can suggest to use Views for rendering "Reference" properties as additional HTML after citation.
Comment #3
kruhak commentedMark this postponed till the moment when we start working on the rendering library.
Comment #4
namwebs commentedCan you please explain a little what you mean?
Also, for references with a file (added as described in the last entry here:https://www.drupal.org/node/2849258) - is it possible to get these to show in a View which is set to show Reference / Citation?
Comment #5
lolcode commentedIt does look like this could be supported in the seboettg/citeproc-php library. For example by adding a hook to allows site managers to register lambda functions.
https://github.com/seboettg/citeproc-php#use-lambda-functions-to-setup-c...
Comment #6
swild-ma commentedFully agree with lolcode (#5). Any plans on this?
Comment #7
mark_fullmerComment #8
mark_fullmerIndividual sites could also potentially rewrite such URLs as actual hyperlinks by implementing
HOOK__preprocess_bibcite_citation(), which provides access to the already-rendered citation. Presumably you could use regular expressions to find/replace specific markup with hyperlinks. This would not be as elegant a solution as using Lambda functions to modify the citation processor itself, as described in https://github.com/seboettg/citeproc-php#use-lambda-functions-to-setup-c... , but might be more straightforward for some developers.Comment #9
swild-ma commentedThanks. Yes, that should be possible but because I also want to put the title into a span, I would have to rerender the whole citation in
HOOK__preprocess_bibcite_citation().This can be avoided by overriding the BibCiteProcessor plugin (citeproc-php) with
HOOK_bibcite_bibcite_processor_info_alter()and passing the lambda functions toCiteProc()inrender()there.Comment #10
mark_fullmerOkay, changing this to a "Support request." Let's try to add some documentation that shows example usage of both
HOOK__preprocess_bibcite_citation()andHOOK_bibcite_bibcite_processor_info_alter()Comment #11
swild-ma commentedThis is the first time I am posting; unsure how to proceed. If appropriate I can supply some code snippets related to the
info_alteroption.Comment #12
mark_fullmerCode snippets in a comment would be a great start. I can then move them into a new page under the documentation at https://www.drupal.org/docs/contributed-modules/bibliography-citation
Comment #13
swild-ma commentedIn MYMODULE.module:
MYMODULE\src\Plugin\BibCiteProcessor\CiteprocPhpFOOBAR.php:
Comment #14
mark_fullmerComment #16
mark_fullmerAfter thinking about this further, I think that this is a common, reasonable request that should not require a developer in order to accomplish. I therefore propose adding a new, global setting to Bibcite for "Convert URLs into hyperlinks".
When enabled, this will pass the already-processed citation through Drupal core's
_filter_url()function, which is robust and designed to handled a wide range of HTML content.This approach does not give sites the ability to have some URLs be hyperlinks and others not be hyperlinks -- that, I feel, still should be the purlieu of developers and custom code.
Comment #17
mark_fullmerComment #18
mark_fullmerAs this is an opt-feature, I feel comfortable merging this in; should there need to be refinements, we can work those out subsequently.
Comment #21
erwangel commentedThe option proposed in MR43 indeed turns urls (doi and other locations) to hyperlinks but we still need an option to turn author and title in citation field to hyperlinks. As for now the only way I see is to play with
HOOK_preprocess_bibcite_citation()and rewrite the content #markup after creating the entity's url inHOOK_bibcite_referenceand push it to$variables['content']['citation']['#data']as entity's id is not available in HOOK_preprocess_bibcite_citation variables['data'].