On Mon, 2 May 2011 13:42:46 -0400, Tomek Kott wrote:
> Hi folks,
>
> It seems that there is a capability to put in line numbers in file
> view (using "&ln" as part of the query string), and have them be
> highlighted if specified in the url params ("&ln=10") or even a range
> (&ln=10-11). (see src/info.c [1])
>
> Additionally, there [2] are [3] various [4] libraries [5] that can
> highlight code, and there is even a helpful tutorial [6]on the
> fossil
> wiki to get those working. Great!
>
> I want to put those two together so that if you click on the line
> number, you automatically highlight that line, either using the
> imported library or fossil. Has anyone attempted or succeeded at
> this?
>
> Tomek
>
>
> Links:
> ------
> [1]
>
> http://fossil-scm.org/index.html/artifact?name=acda9c4b5b73eecddd8b14607f9d0a58d3793c68
> [2] http://code.google.com/p/google-code-prettify/
> [3] http://softwaremaniacs.org/soft/highlight/en/
> [4] http://balupton.com/sandbox/jquery-syntaxhighlighter/demo/
> [5] http://alexgorbatchev.com/SyntaxHighlighter/
> [6]
>
> http://www.fossil-scm.org/fossil/info/bde8ce985d52d3d76efafa37d8670a32fe16f79c#source-hilight
most simple is to adjust src/info.c to generate
<pre tittle='win/version.c' alt='c' class='fossilcat'>
<span class='line' onclick='highlightline(this)'>1 /*</span>
<span class='line' onclick='highlightline(this)'>2 ** This C
program exists to do the job that AWK would do for the unix</span>
</pre>
Ttitle would help you to identify the file (but could be inferred by
get the contents of <a
href="/index.html/finfo?name=win/version.c">win/version.c</a>)
Alt would hint a the type of file (but could be inferred by get the
contents of <a
href="/index.html/finfo?name=win/version.c">win/version.c</a>)
class fossilcat to do CSS styling
off course this would require fossil to have a javascript function
highlightline which is unacceptable
but if this was changed to
<span class='line'>1 /*</span>
you could do some dom magic and add the function to every span.line
element when the page loads.
if on page artiface then
for every span in blockquote.pre.span do
span.onclick=highlight(this)
However you could go the hard way :-)
if page is artifact
var el = document.getElementsByTagName('pre')
s = el.innerHTML
n = ''
for every line in s do
n += '<span onclick="highlight(this)" >'+line+'</span>'
el.innerHTML = n
--
Rene
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users