Include text from at/after the #MyAnchor in the linkToolTipInfo generated summary.
Motivation
The title/tooltip text (mouse-over popup) should relate to text at/after the
anchor, not the top of page; this is especially useful if the anchor is a short 'footnote' or definition or subheading in a larger document.
Description
The perl code to generate the title="$summary..." can be modified to include
text after the anchor; instead of using text from the top of page. Like this
HTML link
clearly, the view generator must confirm the anchor exists to create the link, so it knows the text at and after the anchor; just include that instead of the current top of page text.
I am not a TWiki/Perl expert or I would attach the patch; can someone at least point to the file to be modified?
--
JeffPeck - 14 Oct 2005
Impact and Available Solutions
Note: Patch is attached as
Render-AnchorToolTipSummary.diff. The patch is against the version
02 Sep 2004 $Rev: 1742 $,
Documentation
If necessary, user documentation of new features introduced by this proposal.
Examples
Example uses of features introduced by proposal.
If you have this
patch installed, then hovering over the
link above would show this text!
If not installed then each link just shows the top of topic summary.
Of course, you must
Implementation
Include $theAnchor as argument to &linkToolTipInfo.
in &linkToolTipInfo(): if $theAnchor is supplied, then do the extra work read and search though theTopic text; find the #Anchor; supply the text
after the #Anchor as the $summary to &TWiki::makeTopicSummary()
Note: the extra processing is only incurred if a #Anchor reference is being expanded, regular topic references are unchanged.
The attached patch is my first TWiki/Perl hacking, so it could undoubtedly be improved.
Discussion:
update: now I have found Render.pm, and I see that linkToolTipInfo($theWeb, $theTopic) must be supplied with $theAnchor as an additional argument; and then the replacement for $summary needs to
somehow read down to the anchor to extract the relevant text.
Can someone contribute the code to find the #Anchor in theTopic data?
a way to read the file and apply some regexp like "$theAnchor.{100}" or some such?
--
JeffPeck - 21 Oct 2005
Ok, Thanks for all your helpful hints. I have
patched Render.pm to achieve the effect requested.
--
JeffPeck - 21 Oct 2005
Renamed topic as requested by
JeffPeck. Usually
CoolURIsDontChange, but this topic is young enough.
Bumping this to
EdinburghRelease sice we have a code freeze for
DakarRelease.
--
PeterThoeny - 03 Nov 2005
Having so much fun with this, I hacked it to tooltip-ify the links in a TOC. Also enable [\[#My_Heading]\] to tooltip-ify (add extra "_" for each funky character in the heading text :))
Great for FAQs.
--
JeffPeck - 04 Nov 2005