Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'html-search'
  • Loading branch information
Geoffrey Broadwell committed Jul 20, 2012
2 parents cd5c790 + 9bacf67 commit 3e6a6a7
Show file tree
Hide file tree
Showing 17 changed files with 424 additions and 0 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
339 changes: 339 additions & 0 deletions html/css/custom-theme/jquery-ui-1.8.21.custom.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions html/js/jquery-1.7.2.min.js

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions html/js/jquery-ui-1.8.21.custom.min.js

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions htmlify.pl
Expand Up @@ -90,6 +90,7 @@ ($out_dir = 'html', Bool :$debug)
%types<routine>{$name} = "/routine/" ~ uri_escape( $name );
}
}
write-search-file(:$out_dir);
write-index-file(:$out_dir);
say "Writing per-routine files...";
for %routines.kv -> $name, @chunks {
Expand Down Expand Up @@ -162,6 +163,25 @@ ($out_dir = 'html', Bool :$debug)
);
}

sub write-search-file(:$out_dir!) {
say "Writing $out_dir/search.html";
my $template = slurp("search_template.html");
my @items;
my sub fix-url ($raw) { $raw.substr(1) ~ '.html' };
@items.push: %types<language>.pairs.sort.map({
"\{ label: \"Language: {.key}\", value: \"{.key}\", url: \"{ fix-url(.value) }\" \}"
});
@items.push: %types<type>.sort.map({
"\{ label: \"Type: {.key}\", value: \"{.key}\", url: \"{ fix-url(.value) }\" \}"
});
@items.push: %types<routine>.sort.map({
"\{ label: \"Routine: {.key}\", value: \"{.key}\", url: \"{ fix-url(.value) }\" \}"
});

my $items = @items.join(",\n");
spurt("$out_dir/search.html", $template.subst("ITEMS", $items));
}

sub write-index-file(:$out_dir!) {
say "Writing $out_dir/index.html";
my $pod = pod-with-title('Perl 6 Documentation',
Expand Down
44 changes: 44 additions & 0 deletions search_template.html
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Perl 6 Doc Search</title>
<link type="text/css" href="css/custom-theme/jquery-ui-1.8.21.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript">
function display () {
var iframe_doc = $("#buffer").get()[0].contentDocument;
$("#display").html(iframe_doc.body.innerHTML);
}
$(function(){
$("#query").autocomplete({
source: [
ITEMS
],
select: function (event, ui) {
$("#buffer").attr("src", ui.item.url);
}
}).focus();
});
</script>
<style type="text/css">
#buffer { height: 0; width: 0; border: none; }
noscript p { padding: .5em; }
</style>
</head>

<body>
<noscript>
<p class="ui-state-error ui-corner-all">This search page requires JavaScript. Please enable it in your browser,
or use the <a href="index.html">index page</a> instead.</p>
</noscript>

<div id="search" class="ui-widget">
<label for="query">Search for: </label>
<input id="query" style="z-index: 100; position: relative" title="Enter Perl 6 document to search for" />
</div>
<div id="display"></div>
<iframe id="buffer" onload="display()"></iframe>
</body>
</html>

0 comments on commit 3e6a6a7

Please sign in to comment.