]> git.donarmstrong.com Git - lilypond.git/commitdiff
Doc: fix search box. Feel very grateful for Python.
authorJan Nieuwenhuizen <janneke@gnu.org>
Fri, 14 Aug 2009 14:00:54 +0000 (16:00 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Fri, 14 Aug 2009 14:00:54 +0000 (16:00 +0200)
Remember why we banned perl [apart from the fact that is parses (and
thus can crash on) comments].  It took me more than an hour to
translate

    '<li>' + open ('file').read ()

to seven lines of perl before it worked, including two magic
variables, with several solutions failing silently.  Ugh.

Documentation/css/lilypond-web.css
Documentation/search-box.html [new file with mode: 0644]
Documentation/web-texi2html.init

index 0507b1fca9590eb7f6c41edafb490ba2ddfa78cf..25035a8c49042f4c662c9282d2fa9509c057467b 100644 (file)
@@ -134,6 +134,11 @@ div#tocframe {
   -webkit-border-bottom-right-radius: 20px;
 }
 
+#tocframe li form input[type="hidden"] {
+  visibility: hidden;
+  background: #f00;
+}
+
 #tocframe li a {
   float: left;
   width: 18%;
diff --git a/Documentation/search-box.html b/Documentation/search-box.html
new file mode 100644 (file)
index 0000000..961b6af
--- /dev/null
@@ -0,0 +1,13 @@
+<form action="http://google.com/search"
+      method="get"
+      name="search"
+      onSubmit="search.q.value='site:lilypond.org +v2.12 '
+               + search.brute_query.value"
+      onMouseMove="search.q.value='site:lilypond.org +v2.12 '
+                  + search.brute_query.value"
+      onKeyUp="search.q.value='site:lilypond.org +v2.12 '
+              + search.brute_query.value">
+  <input type="hidden" name="btnG" value="Google Search">
+  <input type="text" name="brute_query" onfocus="this.value=''" value="Search">
+  <input type="hidden" name="q" value="">
+</form>
index 822f5beaa4d05729a1d1d2ff32041ac83317c454..b1d924c9ad5ece5ea7ee6c1dcb3172e7514c7c6e 100644 (file)
@@ -1,6 +1,9 @@
 #!/usr/bin/env perl
 # -*- coding: utf-8; -*-
 
+### WTF, perl cannot read a file?
+###use File::Slurp qw( read_file );
+
 ### texi2html customization script for LilyPond
 ### Author: Reinhold Kainhofer <reinhold@kainhofer.com>, 2008.
 ###         Some code parts copied from texi2html and adapted. These functions
@@ -619,8 +622,24 @@ sub lilypond_generate_page_toc_body($)
       push (@toc_entries, generate_ly_toc_entries($_, \%parentelements, $page_toc_depth));
     }
     if (!exists($main::value{'shallow_toc'})) {
-# FIXME: add search entry box
-    push (@toc_entries, "<li><form action=\"#\" method=\"get\"><input onfocus=\"this.value=''\" type=\"text\" name=\"search\" id=\"search\" value=\"Search\"></form></li>\n");
+# WTF, perl needs 6 lines of magic to do: ' ' + open ('file-name').read ()?
+       local $/=undef;
+        my $name = 'search-box.html';
+       open FILE, $name or open FILE, "../$name" or die  die "no such file: $name: $!";
+
+# All these also seems to work, but fail silently.  Great, it runs!
+# It's late already, let's this broken site.
+
+#      push (@toc_entries, '<li>\n' + <FILE> + '</li>\n');
+#      push (@toc_entries, '<li>\n' . <FILE> . '</li>\n');
+#      my $string = '<li>\n' + <FILE> + '</li>\n';
+#       my $string = '<li>\n' + <FILE> + '</li>\n';
+#       my $string = '<li>\n' . <FILE> . '</li>\n';
+       my $string = <FILE>;
+#       $string = '<li>\n' + $string + '</li>\n';
+       $string =  "<li>\n" . $string . "</li>\n";
+       push (@toc_entries, $string);
+       close FILE;
     }
     push (@toc_entries, "</ul>\n");
 #FIXME