/usr/share/perl5/Pod/ProjectDocs/IndexPage.pm is in libpod-projectdocs-perl 0.50-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | package Pod::ProjectDocs::IndexPage;
use strict;
use warnings;
our $VERSION = '0.50'; # VERSION
use Moose;
with 'Pod::ProjectDocs::File', 'Pod::ProjectDocs::Template';
has 'default_name' => (
is => 'ro',
isa => 'Str',
default => 'index.html',
);
has 'json' => (
is => 'rw',
isa => 'Str',
);
has 'components' => (
is => 'rw',
isa => 'HashRef',
);
has 'data' => (
is => 'ro',
default => <<'DATA',
<!DOCTYPE html>
<html lang="[% lang %]" xml:lang="[% lang %]">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=[% charset %]" />
<title>[% title | html %]</title>
<link rel="stylesheet" href="[% css_relative_url %]" type="text/css" />
<script type="text/javascript">
//<![CDATA[
var managers = [% json %];
function render(pattern) {
var html = '';
for ( var i = 0; i < managers.length; i++ ) {
var manager = managers[i];
var rows_html = get_rows_html(manager, pattern);
var listbox = "<div class='box'><h2 class='t2'>"
+ manager.desc
+ "</h2><table width='100%'>"
+ rows_html
+ "</table></div>";
html += listbox;
}
var list = document.getElementById('list');
list.innerHTML = html;
}
function get_rows_html (manager, pattern) {
var html = '';
var regexp = new RegExp( "(" + pattern + ")", "gi");
var seq = 0;
for (var i = 0; i < manager.records.length; i++) {
var record = manager.records[i];
if ( record.name.match(regexp) ) {
var module_name = manager.records[i].name;
if(pattern != '' ) {
var replace_text = "<span class='search_highlight'>$1</span>";
module_name = module_name.replace(regexp, replace_text);
}
html += get_record_html(record, module_name, seq);
seq++;
}
}
return html;
}
function get_record_html (record, name, i) {
var row_class = ( i % 2 == 0 ) ? 'r' : 's';
var row_html = "<tr class='"
+ row_class
+ "'><td nowrap='nowrap'><a href='"
+ record.path
+ "'>"
+ name + "</a></td><td width='99%'><small>"
+ (record.title || '')
+ "</small></td></tr>";
return row_html;
}
//]]>
</script>
</head>
<body onload="render('')">
<div class="box">
<h1 class="t1">[% title | html %]</h1>
<table>
<tr>
<td class="label">Description</td>
<td class="cell">[% desc | html_line_break %]</td>
</tr>
</table>
</div>
<div class="box">
<h2 class="t2">Search</h2>
<table>
<tr>
<td class="cell"><input type="text" size="60" onkeyup="render(this.value)" /></td>
</tr>
</table>
</div>
<div id="list"></div>
<div class="footer">generated by <a href="http://metacpan.org/module/Pod::ProjectDocs">Pod::ProjectDocs</a></div>
</body>
</html>
DATA
);
sub _get_data {
my $self = shift;
my $params = {
title => $self->config->title,
desc => $self->config->desc,
lang => $self->config->lang,
json => $self->json,
charset => 'UTF-8',
css_relative_url => $self->components->{css}->relative_url($self),
};
my $text = $self->process( $self, $self->data, $params );
return $text;
}
1;
|