From: Paul R. <pa...@ro...> - 2009-11-15 23:44:09
|
Hi BenBE, Pardon my daft questions as I'm new to this stuff. Currently all that's being done with geshi, includign your 2 suggestions, is: $geshi =& new Geshi($page['data'], $lang); $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, $conf['geshi_line_numbers']); $geshi->enable_ids(1); // I just added this. $geshi->set_overall_id("line-num"); // I just added this. $page['html_data'] = $geshi->parse_code(); This results in the following output: <li style="font-weight: normal; vertical-align:top;" id="line-num-1"> <div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;"><?php</span> </div> </li> <li style="font-weight: normal; vertical-align:top;" id="line-num-2"> <div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;">/*********************************************</span> </div> </li> <li style="font-weight: normal; vertical-align:top;" id="line-num-3"> <div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;"> DF Maps Module for Dragonfly CMS</span> </div> </li> <li style="font-weight: normal; vertical-align:top;" id="line-num-4"> <div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;"> ********************************************</span> </div> </li> Which looks like: 1. <?php 2. /********************************************* 3. DF Maps Module for Dragonfly CMS 4. ******************************************** How do I get the <a name="..." href="..."> etc. info around the line numbers in there? Cheers, Paul > Am 15.11.2009 21:17, schrieb Paul Rimmer: > > Hi all, > > > > I've just installed viewgit on my site which makes great use of > > Geshi. What I'd like to do is try to modify it such that each line > > number is a link to that line. When collaborating on code its great > > to send a link to a line number to someone for discussion. Here's an > > example of another project that's done it: > > http://dragonflycms.org/cvs/html/banners.php?v=9.7 > > > > Basically each line number gets coded as: > > > > <a name="19" href="#19">19</a> > > So a link to line 19 would be: > > http://dragonflycms.org/cvs/html/banners.php?v=9.7#19 Is there a way > > to do this with the existing GeSHi API? > > > > Cheers, > > Paul > > > GeSHi already produces element IDs. You just have to ask GeSHi to use a > unique prefix for each one with $G->enable_ids(). Then you can link to > it using > <a href="#prefix-lineno">lineno</a> Have a look at the documentation for > it. Also $G->set_overall_id could be of interest. > > Regards, > BenBE. > > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > geshi-users mailing list > ges...@li... > https://lists.sourceforge.net/lists/listinfo/geshi-users > > |