]> sipb.mit.edu Git - ikiwiki.git/commitdiff
* Hide excess backlinks and expand using CSS trick; control quantiy via
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 31 Mar 2007 08:48:10 +0000 (08:48 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 31 Mar 2007 08:48:10 +0000 (08:48 +0000)
  the numbacklinks setting.

IkiWiki.pm
IkiWiki/Render.pm
debian/changelog
doc/style.css
doc/usage.mdwn
ikiwiki.in
po/ikiwiki.pot
templates/page.tmpl

index a290b479a5756ff6a3c28449c2e174f327b8ac62..558b457f1f0823514404d9648a68b076b2c8bca1 100644 (file)
@@ -72,6 +72,7 @@ sub defaultconfig () { #{{{
        sslcookie => 0,
        httpauth => 0,
        userdir => "",
        sslcookie => 0,
        httpauth => 0,
        userdir => "",
+       numbacklinks => 10,
 } #}}}
    
 sub checkconfig () { #{{{
 } #}}}
    
 sub checkconfig () { #{{{
index c5d885810f1ff1041308d428e8761e3589849ed6..7fd7daf117cc8b597a4fdc9d01f356f2071a5a75 100644 (file)
@@ -30,7 +30,6 @@ sub backlinks ($) { #{{{
        calculate_backlinks();
 
        my @links;
        calculate_backlinks();
 
        my @links;
-       return unless $backlinks{$page};
        foreach my $p (keys %{$backlinks{$page}}) {
                my $href=abs2rel(htmlpage($p), dirname($page));
                        
        foreach my $p (keys %{$backlinks{$page}}) {
                my $href=abs2rel(htmlpage($p), dirname($page));
                        
@@ -45,8 +44,11 @@ sub backlinks ($) { #{{{
                               
                push @links, { url => $href, page => pagetitle($p_trimmed) };
        }
                               
                push @links, { url => $href, page => pagetitle($p_trimmed) };
        }
+       @links = sort { $a->{page} cmp $b->{page} } @links;
 
 
-       return sort { $a->{page} cmp $b->{page} } @links;
+       return \@links, [] if @links <= $config{numbacklinks};
+       return [@links[0..$config{numbacklinks}-1]],
+              [@links[$config{numbacklinks}..$#links]];
 } #}}}
 
 sub parentlinks ($) { #{{{
 } #}}}
 
 sub parentlinks ($) { #{{{
@@ -107,6 +109,8 @@ sub genpage ($$$) { #{{{
                $template->param(have_actions => 1);
        }
 
                $template->param(have_actions => 1);
        }
 
+       my ($backlinks, $more_backlinks)=backlinks($page);
+
        $template->param(
                title => $page eq 'index' 
                        ? $config{wikiname} 
        $template->param(
                title => $page eq 'index' 
                        ? $config{wikiname} 
@@ -114,7 +118,8 @@ sub genpage ($$$) { #{{{
                wikiname => $config{wikiname},
                parentlinks => [parentlinks($page)],
                content => $content,
                wikiname => $config{wikiname},
                parentlinks => [parentlinks($page)],
                content => $content,
-               backlinks => [backlinks($page)],
+               backlinks => $backlinks,
+               more_backlinks => $more_backlinks,
                mtime => displaytime($mtime),
                baseurl => baseurl($page),
        );
                mtime => displaytime($mtime),
                baseurl => baseurl($page),
        );
index fb310dd5e6fafaff943f2fce7fe0fbe10b656a8f..ddec8475d9e53eb5f1fbf5b26c8bc8380360f335 100644 (file)
@@ -11,8 +11,10 @@ ikiwiki (1.49) UNRELEASED; urgency=low
   * Add a popup template in the basewiki. CSS based on some by Martin Krafft.
   * Make the note, popup, and plugin templates detect missing variables and be
     self-documenting, listing the available variables.
   * Add a popup template in the basewiki. CSS based on some by Martin Krafft.
   * Make the note, popup, and plugin templates detect missing variables and be
     self-documenting, listing the available variables.
+  * Hide excess backlinks and expand using CSS trick; control quantiy via
+    the numbacklinks setting.
 
 
- -- Joey Hess <joeyh@debian.org>  Sat, 31 Mar 2007 02:23:46 -0400
+ -- Joey Hess <joeyh@debian.org>  Sat, 31 Mar 2007 04:27:08 -0400
 
 ikiwiki (1.48) unstable; urgency=low
 
 
 ikiwiki (1.48) unstable; urgency=low
 
index af460dd0d063777c540843acdeec54a69e999c89..0a37e55aa5f60f3aa3259979dc0bff4b7c688072 100644 (file)
@@ -239,13 +239,14 @@ input#openid_url {
        width: 25%
 }
 
        width: 25%
 }
 
-/* Used by the popup template. */
+/* Used by the popup template and for backlinks hiding. */
 .popup {
        border-bottom: 1px dotted #366;
        color: #366;
 }
 .popup .balloon,
 .popup {
        border-bottom: 1px dotted #366;
        color: #366;
 }
 .popup .balloon,
-.popup .paren {
+.popup .paren,
+.popup .expand {
        display: none;
 }
 .popup:hover .balloon,
        display: none;
 }
 .popup:hover .balloon,
@@ -261,3 +262,7 @@ input#openid_url {
        -moz-opacity: 0.95;
        filter: alpha(opacity=95);
 }
        -moz-opacity: 0.95;
        filter: alpha(opacity=95);
 }
+.popup:hover .expand,
+.popup:focus .expand {
+       display: inline;
+}
index bb6f06aea1303ca41d884026d417e0678b7ddd6e..4ccd6bf443dc30e527f448886097cf9e3f9448e2 100644 (file)
@@ -233,6 +233,11 @@ configuration options of their own.
   Enables or disables "Discussion" links from being added to the header of
   every page. The links are enabled by default.
 
   Enables or disables "Discussion" links from being added to the header of
   every page. The links are enabled by default.
 
+* --numbacklinks n
+
+  Controls how many backlinks should be displayed maximum. Excess backlinks
+  will be hidden in a popup. Default is 10.
+
 * --userdir subdir
 
   Optionally, allows links to users of the wiki to link to pages inside a
 * --userdir subdir
 
   Optionally, allows links to users of the wiki to link to pages inside a
index 8c46d5e9f333d09866f993da657df53b819390db..b8589bc622f85776cfee88bbd99a808fb8bd8608 100755 (executable)
@@ -30,6 +30,7 @@ sub getconfig () { #{{{
                        "wrappers!" => \$config{wrappers},
                        "getctime" => \$config{getctime},
                        "wrappermode=i" => \$config{wrappermode},
                        "wrappers!" => \$config{wrappers},
                        "getctime" => \$config{getctime},
                        "wrappermode=i" => \$config{wrappermode},
+                       "numbacklinks=i" => \$config{numbacklinks},
                        "rcs=s" => \$config{rcs},
                        "no-rcs" => sub { $config{rcs}="" },
                        "cgi!" => \$config{cgi},
                        "rcs=s" => \$config{rcs},
                        "no-rcs" => sub { $config{rcs}="" },
                        "cgi!" => \$config{cgi},
index 43f86944156e43cf4f9a14aceb11cb7894b8c2fd..9ce8b04a90c8eccabe152371160a4eb24ac69e03 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-03-31 02:06-0400\n"
+"POT-Creation-Date: 2007-03-31 04:39-0400\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -31,8 +31,8 @@ msgstr ""
 
 #: ../IkiWiki/CGI.pm:418 ../IkiWiki/Plugin/brokenlinks.pm:24
 #: ../IkiWiki/Plugin/inline.pm:181 ../IkiWiki/Plugin/opendiscussion.pm:17
 
 #: ../IkiWiki/CGI.pm:418 ../IkiWiki/Plugin/brokenlinks.pm:24
 #: ../IkiWiki/Plugin/inline.pm:181 ../IkiWiki/Plugin/opendiscussion.pm:17
-#: ../IkiWiki/Plugin/orphans.pm:28 ../IkiWiki/Render.pm:97
-#: ../IkiWiki/Render.pm:165
+#: ../IkiWiki/Plugin/orphans.pm:28 ../IkiWiki/Render.pm:99
+#: ../IkiWiki/Render.pm:170
 msgid "discussion"
 msgstr ""
 
 msgid "discussion"
 msgstr ""
 
@@ -157,7 +157,7 @@ msgstr ""
 msgid "nonexistant template %s"
 msgstr ""
 
 msgid "nonexistant template %s"
 msgstr ""
 
-#: ../IkiWiki/Plugin/inline.pm:189 ../IkiWiki/Render.pm:101
+#: ../IkiWiki/Plugin/inline.pm:189 ../IkiWiki/Render.pm:103
 msgid "Discussion"
 msgstr ""
 
 msgid "Discussion"
 msgstr ""
 
@@ -420,47 +420,47 @@ msgid ""
 "notifications"
 msgstr ""
 
 "notifications"
 msgstr ""
 
-#: ../IkiWiki/Render.pm:249 ../IkiWiki/Render.pm:269
+#: ../IkiWiki/Render.pm:254 ../IkiWiki/Render.pm:274
 #, perl-format
 msgid "skipping bad filename %s"
 msgstr ""
 
 #, perl-format
 msgid "skipping bad filename %s"
 msgstr ""
 
-#: ../IkiWiki/Render.pm:309
+#: ../IkiWiki/Render.pm:314
 #, perl-format
 msgid "removing old page %s"
 msgstr ""
 
 #, perl-format
 msgid "removing old page %s"
 msgstr ""
 
-#: ../IkiWiki/Render.pm:329
+#: ../IkiWiki/Render.pm:334
 #, perl-format
 msgid "scanning %s"
 msgstr ""
 
 #, perl-format
 msgid "scanning %s"
 msgstr ""
 
-#: ../IkiWiki/Render.pm:339
+#: ../IkiWiki/Render.pm:344
 #, perl-format
 msgid "rendering %s"
 msgstr ""
 
 #, perl-format
 msgid "rendering %s"
 msgstr ""
 
-#: ../IkiWiki/Render.pm:351
+#: ../IkiWiki/Render.pm:356
 #, perl-format
 msgid "rendering %s, which links to %s"
 msgstr ""
 
 #, perl-format
 msgid "rendering %s, which links to %s"
 msgstr ""
 
-#: ../IkiWiki/Render.pm:368
+#: ../IkiWiki/Render.pm:373
 #, perl-format
 msgid "rendering %s, which depends on %s"
 msgstr ""
 
 #, perl-format
 msgid "rendering %s, which depends on %s"
 msgstr ""
 
-#: ../IkiWiki/Render.pm:406
+#: ../IkiWiki/Render.pm:411
 #, perl-format
 msgid "rendering %s, to update its backlinks"
 msgstr ""
 
 #, perl-format
 msgid "rendering %s, to update its backlinks"
 msgstr ""
 
-#: ../IkiWiki/Render.pm:418
+#: ../IkiWiki/Render.pm:423
 #, perl-format
 msgid "removing %s, no longer rendered by %s"
 msgstr ""
 
 #, perl-format
 msgid "removing %s, no longer rendered by %s"
 msgstr ""
 
-#: ../IkiWiki/Render.pm:444
+#: ../IkiWiki/Render.pm:449
 #, perl-format
 msgid "ikiwiki: cannot render %s"
 msgstr ""
 #, perl-format
 msgid "ikiwiki: cannot render %s"
 msgstr ""
@@ -533,11 +533,11 @@ msgstr ""
 msgid "usage: ikiwiki [options] source dest"
 msgstr ""
 
 msgid "usage: ikiwiki [options] source dest"
 msgstr ""
 
-#: ../IkiWiki.pm:103
+#: ../IkiWiki.pm:104
 msgid "Must specify url to wiki with --url when using --cgi"
 msgstr ""
 
 msgid "Must specify url to wiki with --url when using --cgi"
 msgstr ""
 
-#: ../IkiWiki.pm:150 ../IkiWiki.pm:151
+#: ../IkiWiki.pm:151 ../IkiWiki.pm:152
 msgid "Error"
 msgstr ""
 
 msgid "Error"
 msgstr ""
 
@@ -545,7 +545,7 @@ msgstr ""
 #. translators: preprocessor directive name,
 #. translators: the second a page name, the
 #. translators: third a number.
 #. translators: preprocessor directive name,
 #. translators: the second a page name, the
 #. translators: third a number.
-#: ../IkiWiki.pm:573
+#: ../IkiWiki.pm:574
 #, perl-format
 msgid "%s preprocessing loop detected on %s at depth %i"
 msgstr ""
 #, perl-format
 msgid "%s preprocessing loop detected on %s at depth %i"
 msgstr ""
index 471ed1a7d4236922f1f6e8815157571d2fe5df14..61d22723f0c2010bb31f7b67e96d68c595bda2c9 100644 (file)
@@ -73,6 +73,15 @@ Links:
 <TMPL_LOOP NAME="BACKLINKS">
 <a href="<TMPL_VAR NAME=URL>"><TMPL_VAR NAME=PAGE></a>
 </TMPL_LOOP>
 <TMPL_LOOP NAME="BACKLINKS">
 <a href="<TMPL_VAR NAME=URL>"><TMPL_VAR NAME=PAGE></a>
 </TMPL_LOOP>
+<TMPL_IF NAME="MORE_BACKLINKS">
+<span class="popup">...
+<span class="expand">
+<TMPL_LOOP NAME="MORE_BACKLINKS">
+<a href="<TMPL_VAR NAME=URL>"><TMPL_VAR NAME=PAGE></a>
+</TMPL_LOOP>
+</span>
+</span>
+</TMPL_IF>
 </TMPL_IF>
 </div>
 
 </TMPL_IF>
 </div>