Hello Biblio developers.
I am the maintainer of the Footnotes module. (http://drupal.org/project/footnotes) Footnotes is a simple filter to automatically create numbered footnotes in an article.
One user recently commented, that combining Footnotes and Biblio leads to a problem: You will have two sets of footnotes, formatted differently and both numbered from 1-n.
Footnotes module is very simple. Creating any kind of interoperability function would be overkill. So we are left with two options:
1) You implement "normal footnotes" function as part of Biblio, and Footnotes module could be deprecated in favor of Biblio.
2) Keep Footnotes and make Biblio use and depend that for all of its footnotes creation.
Number 2) is more modular, so should be preferred by default. (Modularity is always a good idea, in particular, think about users who only need footnotes, not a bibliography.) But Biblio is the more complex module and you also have more active developers, so please share your ideas. Please also note that Footnotes development is laying quite low right now, there are 2 active developers who both are busy elsewhere. So any ideas you come up with please remember not to depend on any serious efforts from our side.
henrik, Footnotes creator
Comments
Comment #1
rjerome commentedHi Henrik,
I am the Biblio creator, and aside from a few welcomed patches, the sole developer. I have been thinking about how to approach this one. It was one of the biblio users who submitted the filter patch, which is more or less a direct copy of your filter routines which work quite well.
An ideal solution would be to have some sort of "footnote" api, much like nodeapi which would allow other modules to add there own footnote types to the footnote module. If you like I could work toward this end and submit patches to the footnote module to make this work.
Off the top of my head, I could see the footnote module building a list of filters from within and by calling the api to gather footnote filters from other modules.
Let me know what you think of this idea.
Ron.
Comment #2
hingo commentedHi Ron. As you can see, some weeks even participating in a simple forum discussion is too much for me at the moment, thank good for weekends though!
So, you seem to be interested in pursuing something where Biblio (and other modules) would depend on Footnotes module to provide footnotes functionality. In my opinion too this is the right thing to do (modular approach is what they thaught us in school after all...)
Let me start again with my idea about that then: The Footnotes module is very simple. Trying to implement an api (as in other modules calling some methods) would probably be overkill, at least this is my first impression. The simple way to approach this is that Biblio would simply output
<fn>footnote content...</fn>tags in the places where you want footnotes. Then users would build filters such that Footnotes would be last. I'm not sure if the filter api provides for a way that Biblio could check that Footnotes in fact is present later in the filter chain?So, could this be any fancier (just in case you or someone else has time and energy to code something)? It could of course be nice to add the following simple function to Footnotes:
If you think this would be a good thing to have, then we have the start of an api I think :-) And of course obvious new methods now spring to mind, for instance
footnotes_api_get_supported_markup_types()which wouldreturn array("html", "textile");**
Of course, if you want more output styles (TeX?) than currently supported by Footnotes, those must be added but that is quite straightforward.
**
Hmm... What else? Biblio also supports import and export functions. Do you have any requirements there?
Is there anything else Footnotes should do that it would be usable for you? As it is now, Footnotes is quite simple and there are of course features that could be added. (Like what style of numbering to use, etc...).
**
I think that was all I had on my mind this time. Let me know what you think. I think a few rounds of just throwing around ideas is in order before doing anything. (And as usual, I'll probably reply next weekend...)
henrik
Comment #3
rjerome commentedHi Henrik,
I've been thinking about this a bit, but I haven't written any code yet. There is one main difference between how footnote works and how it's being used in the biblio module and that is that the text (citekey) enclosed in the <bib>citekey</bib> tags is not actually used in the footnote, but it is used to query the database and gather the information required to build the reference. So for this reason it would seem to me we would also need to register a callback function to be associated with the particular tag or type. You would pass the callback function the text from between the tags and it would return a chunk of html.
Here is the function that biblio is using to generate the reference from the citekey...
Also I was thinking that rather than have completely different preg_replace_callback functions for each type (html, textile), could you not just have one and use the match array to determine which was matched. I haven't tried this yet, but I think something like
would put the fn tags in match[1] and the bib tags in match[2] and thus based on the order you built the preg_expression string you could also determine what type it is and call the appropriate callback to output that type. The advantage of having a single preg_replace_callback function is that the numbering ($n) will be consistent when you mix different types of tags within the same document.
Ron.
Comment #4
rjerome commentedOk, so I had a few spare hours, and I went ahead and coded up a test module. It is all more or less working now, just a little spit and polish required. I added a db table which holds the externally registered tags and callbacks. I also added a function which builds the pattern to match against from the registered tags. It all works from a single preg_replace_callback, so any number of different tags can be used in the same node and the footnote list is numbered sequentially as the tags are found.
I'll post a patch soon so you can try it out.
Ron.
Comment #5
hingo commentedHold on, you seem to have taken a different direction than I was anticipating.
My idea is the following:
User has a content type with
Biblio
Footnotes
Line break filter
HTML filter
And possibly any other filters at any locations.
Consider the following example text:
As you can see, this text contains first one Bibliography entry, then a regular footnote.
Now the filters are applied in the given order. The responsibility of the Biblio module should be to fetch the data from database (as you have described) and replace the
<bib>tag with<fn>tag plus the fetched content:(Note that I have absolutely no idea what format you actually use to output bibliography entries, but I hope you understand what I mean.)
Next in line is the Footnotes filter, which does the following:
(The list of footnotes below is simplified, currently Footnotes creates an ol list in html.)
And then finally the normal Drupal filters kick in and we are done.
**
This is what I have had in mind. What are your thoughts on this?
Comment #6
rjerome commentedAhhh, I see what you were getting at now, initially I thought you meant the user would have to enter the reference..., I didn't realize you meant that the biblio module would just convert the tags to fleshed out tags. There is no question this is a MUCH simpler approach, and in my books simpler is usually better (although my callback registration was pretty cool if I do say so myself).
I'll give this a try and let you know how it works.
Ron.
Comment #7
rjerome commentedOk, I added the bib tag converter and it seems to work quite well. If, as you said, you put the bib tag filter before the fn tag filter they are all handled by the footnotes module.
A much easier solution indeed.
Ron.
Comment #8
hingo commentedSounds great. So it works just like that and no changes needed in Footnotes?
I think one more thing to do would be to ask on the forum whether it is possible for one filter to know what filters will be run after it. I will do that next...
Comment #9
hingo commentedhttp://drupal.org/node/125670
Comment #10
rjerome commentedThat is correct, there are not changes required on the footnotes side.
Although on thing you might want to consider is the user who submitted the original footnote patch for the biblio module had added something quite nifty, that being integration with the "hover tips" module, so that when you hover over the reference number in the text, it pops up a little box with the reference information (check it out here... http://p4.sme-ccppd.org/beta.soundandmusiccomputing.org/node/598) just find a reference number in square brackets [4] and hover over it.
It's quite a simple patch, so if you are interested perhaps you could add it to the main footnotes code.
Comment #11
rjerome commentedI did put a safeguard in so that if the footnotes module is not enabled, my module reverts to it's original functionality (i.e. it just handles the bib tags by itself), but if it (footnotes) is enabled it does not check the ordering of the filters.
Comment #12
hingo commentedThanks, I remember thinking of something like that when creating Footnotes.
If you ever do create a patch, please post it here: http://drupal.org/node/126477
Comment #13
beginner commentedSubscribing.
Comment #14
pathscollide commentedIs there an easy way to patch the latest 4.7 version so I can get this little input filter?
Comment #15
rjerome commentedIt's in the latest 4.7 -dev version.
Ron.
Comment #16
hingo commentedHi again
Just some more info on checking dependencies between Biblio and Footnotes:
1) As of Drupal 5 a module can declare a dependency on another module. Put this in your biblio.info file:
dependencies = footnotes2) I will now commit a new function to the Footnotes module, available in Footnotes 5.x-1.2. Description reads as follows:
***
Helper for other filters, check if Footnotes is present in your filter chain.
Other filters may leverage the Footnotes functionality in a simple way: by outputting markup with
<fn>...</fn>tags within.This creates a dependency, the Footnotes filter must be present later in "Input format". By calling this helper function the other filters that depend on Footnotes may check whether Footnotes is present later in the chain of filters in the current Input format.
If this function returns true, the caller may depend on Footnotes. Function returns false if caller may not depend on Footnotes.
Example usage:
@param $format
The input format caller is being run as part of ($format of hook_filter(...))
@param $caller
Name of calling module
@param $caller_delta
Delta of the filter within calling module ($delta of hook_filter(...))
@param $footnotes_delta
Delta of the filter within footnotes module
@return True if Footnotes is present after $caller in Input format $format
Comment #17
pathscollide commentedI'm having a great time working with the integrated footnotes and biblio modules (using the 4.7 version of footnotes, and the 4.7 dev branch of biblio -- though not the very latest versions). However, I am encountering (what is for my purposes) a major issue. I would like to create footnotes that contain bibliographic references (drawn from biblio), as well as other text. So, for example, I'd like to be able to do this:
or even just this:
However, I can't seem to do this. The closing bib tags seem to cause the footnote to "break" -- so any text after the closing bib tag appears in the main text of the node rather than in the footnote. Where there are two bib references in a footnote, as in the first example, the first bit of text will appear in the footnote, as will the first biblio reference, then "and" will appear in the main text, then the second biblio reference will appear in a footnote, and any text following the second closing bib tag will display in the main text again.
What do you think -- is it possible to (and are you willing to ;-) implement this kind of functionality? It would really help me a lot (and make Drupal a stronger platform for scholarly publishing).
Thanks in advance!
(P.S. in case the question comes up, I have made biblio "lighter" in my input format, so it comes before footnotes.)
Comment #18
hingo commentedComment from the Footnotes developer: This is a Biblio issue, so I'll pass.
Moreover, even if I havent used Biblio myself my understanding of it is that it is not supposed to be used the way you intend to use this. The content within the
<bib>tag is itself to become a footnote. Now you are trying to put a footnote inside a footnote, it doesn't make sense.How to make Biblio to support the idea of including text around the citekey, you'll have to talk with Ron about that.
Comment #19
rjerome commentedHingo is quite correct, what you are attempting to do will create a footnote within a footnote. Off the top of my head, my feeling is that perhaps a new tag type might solve the problem. Maybe to indicate that this is a reference within a footnote?
Ron.
Comment #20
hingo commentedI think what cagilaba is asking for, is the possibility to separately use citekey to retrieve bibliography info, and separately determine what should or should not be a footnote.
One easy solution might really be a new tag type, which retrieves the citekey from database but does not create a footnote. Using that, the above idea would work as cagilaba is trying to use it.
Just my insights though, not my problem :-)
Comment #21
pathscollide commentedIndeed, a new tag type might be the most straightforward way of dealing with this. But I find myself wondering, given that we have the footnotes module, whether it's even necessary for biblio to generate footnotes at all. The reason I say this is that I wonder how common (or advisable) it is to cite an entire work (the way the biblio module allows) without any commentary. From my perspective, most of the time if you cite an entire work (without indicating specific page numbers), it's better practice to provide some kind of explanatory text in the footnote. If you're simply providing a reference for a quote, it's normal not to provide commentary, but you at least need to include a page number for the quote (which biblio does not currently allow).
So at this stage I'm thinking it may be more logical for the bib tags to simply generate a full reference from a citekey (in any context, not just in a footnote), and to leave footnote handling to the footnotes module. I guess some people might find it annoying to have to nest the tags every time -- but I personally wouldn't have a problem with it.
By the way, I should point out that though biblio isn't designed to be used the way I'm using it, it DOES actually work that way -- but only partially. Since (as far as I can tell) the bib tag functionality and the usage of citekeys isn't really clearly documented, I just tried including the bib tags within a fn-generated footnote and it worked fine (to my delight). Fine, that is, until I tried to add text in the footnote after the closing bib tag.
Comment #22
hingo commentedRon, I think this feature request is fixed and you could close it?
Comment #23
(not verified) commented