diff options
author | Arne Georg Gleditsch <argggh@lxr.linpro.no> | 2008-02-26 23:50:15 +0100 |
---|---|---|
committer | Arne Georg Gleditsch <argggh@lxr.linpro.no> | 2008-02-26 23:50:15 +0100 |
commit | d4ebc3a51dfe4c0ad70c2a175e46226cb291cfe4 (patch) | |
tree | bb4ccefffe2caf840ee03240ab6f442e9fad76ba /lib | |
parent | 5805d89cb0f2ab7867a8d9689b8c99488b5af8c3 (diff) |
Js and HTML changes to please IE.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/LXRng/Markup/File.pm | 5 | ||||
-rw-r--r-- | lib/LXRng/Web.pm | 26 |
2 files changed, 16 insertions, 15 deletions
diff --git a/lib/LXRng/Markup/File.pm b/lib/LXRng/Markup/File.pm index d94952c..c3d576c 100644 --- a/lib/LXRng/Markup/File.pm +++ b/lib/LXRng/Markup/File.pm @@ -49,9 +49,8 @@ sub make_format_newline { $line++; $nl = safe_html($nl); - return qq{$nl}. - qq{<a href="$name#L$line" class="line">$line</a>}. - qq{<a id="L$line" name="L$line"></a>}; + return sprintf('%s<a href="%s#L%d" id="L%d" class="line" name="L%d">%4d</a>', + $nl, $name, $line, $line, $line, $line); } } diff --git a/lib/LXRng/Web.pm b/lib/LXRng/Web.pm index 36e6f55..0a49a16 100644 --- a/lib/LXRng/Web.pm +++ b/lib/LXRng/Web.pm @@ -88,13 +88,14 @@ sub print_markedup_file { $context->release)); my $cfile; $shaid =~ s,^(..)(..),$1/$2/,; + $shaid .= '_2'; # Cache file format generation indicator $cfile = $context->config->{'cache'}.'/'.$shaid if exists $context->config->{'cache'}; if ($cfile and -e "$cfile/.complete") { - print("<pre id=\"file_contents\">"); + print("<div id=\"file_contents\">"); while (-r "$cfile/$line") { - print("<div class=\"".($focus ? "done" : "pending"). + print("<pre class=\"".($focus ? "done" : "pending"). "\" id=\"$shaid/$line\">"); if ($focus) { open(my $cache, '<', "$cfile/$line"); @@ -105,9 +106,9 @@ sub print_markedup_file { close($cache); } else { - print("\n" x FRAGMENT_SIZE); + print("<a class=\"line\"></a>\n" x FRAGMENT_SIZE); } - print("</div>"); + print("</pre>"); $line += FRAGMENT_SIZE; if (defined($fline)) { @@ -115,7 +116,7 @@ sub print_markedup_file { and $line > ($fline - FRAGMENT_SIZE)); } } - print("</pre>\n"); + print("</div>\n"); } else { my $cache; @@ -131,8 +132,8 @@ sub print_markedup_file { my $markup = LXRng::Markup::File->new('context' => $context); my $subst = $lang->markuphandlers($context, $node, $markup); - print("<pre id=\"file_contents\">". - "<div class=\"".($focus ? "done" : "pending"). + print("<div id=\"file_contents\">". + "<pre class=\"".($focus ? "done" : "pending"). "\" id=\"$shaid/0\">"); while (1) { my @frags = map { split(/(?<=\n)/, $_) } @@ -144,13 +145,14 @@ sub print_markedup_file { if ($f =~ /\n$/s) { $line++; if ($line % FRAGMENT_SIZE == 0) { - print("\n" x FRAGMENT_SIZE) unless $focus; + print("<a class=\"line\"></a>\n" x FRAGMENT_SIZE) + unless $focus; if (defined($fline)) { $focus = ($line <= ($fline + 100) and $line > ($fline - FRAGMENT_SIZE)); } - print("</div>". - "<div class=\"". + print("</pre>". + "<pre class=\"". ($focus ? "done" : "pending"). "\" id=\"$shaid/$line\">"); if ($cache) { @@ -161,7 +163,7 @@ sub print_markedup_file { } } } - print("</div></pre>\n"); + print("</pre></div>\n"); if ($cache) { close($cache); open($cache, '>', "$cfile/.complete"); @@ -517,7 +519,7 @@ sub handle_ajax_request { elsif ($context->param('fname') eq 'pjx_load_fragment') { my $shaid = $context->param('frag'); return unless $shaid =~ - m|^[0-9a-z]{2}/[0-9a-z]{2}/[0-9a-z]{36}/[0-9]+$|; + m|^[0-9a-z]{2}/[0-9a-z]{2}/[0-9a-z]{36}_\d+/[0-9]+$|; return unless exists $context->config->{'cache'}; my $cfile = $context->config->{'cache'}.'/'.$shaid; return unless -e $cfile; |