Changeset 22778 for util

Show
Ignore:
Timestamp:
10/26/08 22:31:31 (2 months ago)
Author:
azawawi
Message:

[smartlinks] Added simple and full version hyperlinks.
[smartlinks] If the simple version is clicked, an iframe loads the
[smartlinks] highlighted p6 test file within the same page.
[smartlinks] If the full version is clicked, a new browser tab is opened
[smartlinks] containing the highlighted p6 code with the full parse tree viewer.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • util/smartlinks.pl

    r22739 r22778  
    148148  return false; 
    149149} 
     150 
     151function toggle_hilite(id,url) { 
     152    var el = document.getElementById(id); 
     153    if(el) { 
     154        if(el.style.display == "none") { 
     155            el.src = url; 
     156            el.style.display = "block"; 
     157        } else { 
     158            el.style.display = "none"; 
     159        } 
     160    } 
     161    return false; 
     162} 
     163 
    150164_EOC_ 
    151165 
     
    579593 
    580594    my $nlines = $to - $from + 1; 
    581     my $hilited_file = $file; 
    582     $hilited_file =~ s{t/spec/}{}; 
    583     $hilited_file =~ s{/([^/]+)\.t$}{/_$1.html}; 
     595    my $html_file = $file; 
     596    $html_file =~ s{t/spec/}{}; 
     597    my $simple_html = $html_file . ".simple.html"; 
     598    my $full_html = $html_file . ".html"; 
     599    my $simple_snippet_id = "simple_$snippet_id"; 
     600 
    584601    my $html = <<"_EOC_"; 
    585602<p>From $file lines $from&ndash;$to$stat:<span id="smartlink_skip_${snippet_id}"> <a href="#smartlink_skipto_${snippet_id}">(skip)</a></span></p> 
     
    588605</div> 
    589606<span id="smartlink_skipto_${snippet_id}">&nbsp;</span> 
    590 <a href="http://feather.perl6.nl/~azawawi/html/$hilited_file" target="_blank"> 
    591 STD_syntax_highlight-ed $file 
     607<div style="color:DarkBlue">Highlight $file  
     608<br/> 
     609<a href="#"  
     610onclick="return toggle_hilite('$simple_snippet_id','/~azawawi/html/$simple_html')"> 
     611Small version 
    592612</a> 
     613&nbsp;|&nbsp; 
     614<a href="/~azawawi/html/$full_html" target="_blank"> 
     615Full version 
     616</a> 
     617</div> 
     618<iframe id="$simple_snippet_id" style="display:none;" width="100%"></iframe> 
    593619_EOC_ 
    594620    $snippets[$snippet_id] = $html;