Display brackets surrounding footnote link
WiredEscape - June 23, 2009 - 00:17
| Project: | Footnotes |
| Version: | 5.x-2.1 |
| Component: | Footnotes.module |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | won't fix |
Jump to:
Description
I needed the footnote link appearing in the text body to be surrounded by brackets similar to Wikipedia reference links so came up with this patch. Although I don't like custom module patches this seemed the easiest method for my needs. Maybe this feature could be included as an option within the module. I offer this as a suggestion as I don't have the skills to create a proper patch.
HTH,
Doug
Module version: 5x-2.1
Purpose: to place brackets around footnote link in text body. Uses span to use present see_footnote css formatting.
Line: 367
Changes:
- return '<a class="see_footnote" id="' . $fn['ref_id'] . '" title="' . $fn['text_clean'] . '" href="#' . $fn['fn_id'] . '">' . $fn['value'] . '</a>';}
+ return '<span class="see_footnote">[</span><a class="see_footnote" id="' . $fn['ref_id'] . '" title="' . $fn['text_clean'] . '" href="#' . $fn['fn_id'] . '">' . $fn['value'] . '</a><span class="see_footnote">]</span>';}
#1
(A little more accurate...)
Lines: 367-369
Changes:
function theme_footnote_link($fn) {
- return '<a class="see_footnote" id="' . $fn['ref_id'] .
- '" title="' . $fn['text_clean'] . '" href="#' . $fn['fn_id'] . '">' .
- $fn['value'] . '</a>';
}
function theme_footnote_link($fn) {
+ return '<span class="see_footnote">[</span><a class="see_footnote" id="' .
+ $fn['ref_id'] . '" title="' . $fn['text_clean'] . '" href="#' . $fn['fn_id'] .
+ '">' . $fn['value'] . '</a><span class="see_footnote">]</span>';
}
#2
Hi Doug
You're doing the right thing here, but better yet: You can do it without patching the module. You can add your own output style of the footnotes into the theme you are using. See the advice at http://drupal.org/node/11811
Basically, add a file template.php and add your functions there, only changing the name:
function phptemplate_footnote_link($fn) {return '<span class="see_footnote">[</span><a class="see_footnote" id="' .
$fn['ref_id'] . '" title="' . $fn['text_clean'] . '" href="#' . $fn['fn_id'] .
'">' . $fn['value'] . '</a><span class="see_footnote">]</span>';
}
(And if you really do as that page tell you, you put the HTML into a separate template file footnote_link.tpl.php, but the above should already work.)