Merge remote-tracking branch 'levitte/master'
authorJoey Hess <joey@kitenet.net>
Wed, 30 Mar 2011 18:12:14 +0000 (14:12 -0400)
committerJoey Hess <joey@kitenet.net>
Wed, 30 Mar 2011 18:12:14 +0000 (14:12 -0400)
13 files changed:
Bundle/IkiWiki/Extras.pm
IkiWiki/Plugin/comments.pm [changed mode: 0644->0755]
debian/changelog
debian/control
doc/bugs/po:_double_commits_of_po_files.mdwn
doc/bugs/po:_markdown_link_parse_bug.mdwn
doc/bugs/po:_po_files_instead_of_html_files.mdwn
doc/git.mdwn
doc/rcs.mdwn
doc/style.css
doc/todo/avatar.mdwn
doc/todo/mirrorlist_with_per-mirror_usedirs_settings.mdwn
templates/comment.tmpl

index 8b97d893da8a99ede7e679470b306a0e41207950..30bc8eee4014e2b7bf571a3760ffe7fe565c6f60 100644 (file)
@@ -34,6 +34,7 @@ Text::WikiCreole
 Term::ReadLine::Gnu
 HTML::Tree
 Sort::Naturally
+Gravatar::URL
 
 =head1 AUTHOR
 
old mode 100644 (file)
new mode 100755 (executable)
index 8d46ed5..9fb81d1
@@ -200,6 +200,7 @@ sub preprocess {
        $commentstate{$page}{commentip} = $commentip;
        $commentstate{$page}{commentauthor} = $commentauthor;
        $commentstate{$page}{commentauthorurl} = $commentauthorurl;
+       $commentstate{$page}{commentauthoravatar} = $params{avatar};
        if (! defined $pagestate{$page}{meta}{author}) {
                $pagestate{$page}{meta}{author} = $commentauthor;
        }
@@ -216,7 +217,7 @@ sub preprocess {
                        my $url=$params{url};
 
                        eval q{use URI::Heuristic}; 
-                       if (! $@) {
+                       if (! $@) {
                                $url=URI::Heuristic::uf_uristr($url);
                        }
 
@@ -438,6 +439,12 @@ sub editcomment ($$) {
                }
        }
 
+       my $avatar=getavatar($session->param('name'));
+       if (defined $avatar && length $avatar) {
+               $avatar =~ s/"/&quot;/g;
+               $content .= " avatar=\"$avatar\"\n";
+       }
+
        my $subject = $form->field('subject');
        if (defined $subject && length $subject) {
                $subject =~ s/"/&quot;/g;
@@ -561,6 +568,31 @@ sub editcomment ($$) {
        exit;
 }
 
+sub getavatar ($) {
+       my $user=shift;
+       
+       my $avatar;
+       eval q{use Libravatar::URL};
+       if (! $@) {
+               my $oiduser = eval { IkiWiki::openiduser($user) };
+               my $https=defined $config{url} && $config{url}=~/^https:/;
+
+               if (defined $oiduser) {
+                       eval {
+                               $avatar = libravatar_url(openid => $user, https => $https);
+                       }
+               }
+               if (! defined $avatar &&
+                   (my $email = IkiWiki::userinfo_get($user, 'email'))) {
+                       eval {
+                               $avatar = libravatar_url(email => $email, https => $https);
+                       }
+               }
+       }
+       return $avatar;
+}
+
+
 sub commentmoderation ($$) {
        my $cgi=shift;
        my $session=shift;
@@ -874,6 +906,11 @@ sub pagetemplate (@) {
                        $commentstate{$page}{commentauthorurl});
        }
 
+       if ($template->query(name => 'commentauthoravatar')) {
+               $template->param(commentauthoravatar =>
+                       $commentstate{$page}{commentauthoravatar});
+       }
+
        if ($template->query(name => 'removeurl') &&
            IkiWiki::Plugin::remove->can("check_canremove") &&
            length $config{cgiurl}) {
index db6f95f43e6adab1882e8389e09d95d8030007ed..dffad9aec54bf0f53b2a5bf624c1220a27aec1b5 100644 (file)
@@ -2,6 +2,12 @@ ikiwiki (3.20110329) UNRELEASED; urgency=low
 
   * meta: Allow adding javascript to pages. Only when htmlscrubber is
     disabled, naturally. (Thanks, Giuseppe Bilotta)
+  * comments: Add avatar picture of comment author, using Libravatar::URL
+    when available. The avatar is looked up based on the user's openid,
+    or email address. (Thanks, Francois Marier)
+  * Recommend libgravatar-url-perl, which contains Libravatar::URL.
+  * monotone: Implement rcs_getmtime, and work around a problem with monotone
+    0.48 that affects rcs_getctime. (Thanks, Richard Levitte)
 
  -- Joey Hess <joeyh@debian.org>  Mon, 28 Mar 2011 13:08:23 -0400
 
index b98f0e0c717349c8f905039c929020e771ed4587..4fd554d7d4f5e8f312c8c0a230fd0578b59fe158 100644 (file)
@@ -27,7 +27,8 @@ Recommends: gcc | c-compiler,
   libxml-simple-perl, libnet-openid-consumer-perl,
   liblwpx-paranoidagent-perl, libtimedate-perl,
   libcgi-formbuilder-perl (>= 3.05), libcgi-session-perl (>= 4.14-1),
-  libmail-sendmail-perl, libauthen-passphrase-perl, libterm-readline-gnu-perl
+  libmail-sendmail-perl, libauthen-passphrase-perl, libterm-readline-gnu-perl,
+  libgravatar-url-perl
 Suggests: viewvc | gitweb | viewcvs, libsearch-xapian-perl,
   xapian-omega (>= 1.0.5), librpc-xml-perl, libtext-wikiformat-perl,
   python, python-docutils, polygen, tidy, libhtml-tree-perl,
index a871785be3af43e7fb5051b3eca6c1170f72d513..2f3015e2b053d1bd86040ab18edca9a171e6fb33 100644 (file)
@@ -17,3 +17,6 @@ update. --[[Joey]]
 >> their mailing-list:
 >> [post archive](http://lists.alioth.debian.org/pipermail/po4a-devel/2010-July/001897.html).
 >> --[[intrigeri]]
+
+>>> Seems to me Debian Squeeze's po4a does not expose this bug anymore
+>>> => [[done]]. --[[intrigeri]]
index 10715001c19fbe6365948e6daebffc16bba9a734..98da7fd24cf4f39966656ba57400f2430132761e 100644 (file)
@@ -12,3 +12,8 @@ file:
        "\"Ikiwiki hosting\") when I signed up."
 
 --[[Joey]] 
+
+> I cannot reproduce this on my Squeeze system with ikiwiki Git code;
+> both the page in the master language and translation pages perfectly
+> display the link (and tooltip) in my testing environment. Were you
+> using an oldest po4a, such as Lenny's one? --[[intrigeri]]
index 8238f50dfdf9f722f43fc9209aad94d35c0999e1..33b8982bad1c8d570d90e8501a41dccf5ca339e8 100644 (file)
@@ -20,3 +20,9 @@ When i click on "templates.fr", i get the po.file instead of html.
        },  
        # slave languages (PO files)  
        po_slave_languages => [qw{fr|Français}],  
+
+>>> I've never found any `.po` file in the destination directory on
+>>> any of my PO-enabled ikiwiki instances. Without more information,
+>>> there's nothing I can do: the config snippet pasted above is more
+>>> or less the example one and does not allow me to reproduce the
+>>> bug. --[[intrigeri]]
index 2a2d10526e6481a4ebd833c37cc1cba55407d7d0..85323e64550b7670ada4213d63d6bde470950caa 100644 (file)
@@ -68,6 +68,8 @@ think about merging them. This is recommended. :-)
 * [[bzed|BerndZeimetz]] `git://git.recluse.de/users/bzed/ikiwiki.git`
 * [[wtk]] `git://github.com/wking/ikiwiki.git`
 * [[sunny256]] `git://github.com/sunny256/ikiwiki.git`
+* [[fmarier]] `git://gitorious.org/~fmarier/ikiwiki/fmarier-sandbox.git`
+* [[levitte]] `git://github.com/levitte/ikiwiki.git`
 
 ## branches
 
index 06af9807c1ee5dcaa6cb69b906a0583c5356deb0..4d75d6325e1d231c2f3859a57b794b43f89e0de9 100644 (file)
@@ -22,7 +22,7 @@ auto.setup          |yes    |yes    |incomplete|yes         |incomplete   |yes
 `rcs_remove`        |yes    |yes    |yes       |yes         |no           |yes      |no        |yes
 `rcs_diff`          |yes    |yes    |yes       |yes         |no           |yes      |yes       |yes
 `rcs_getctime`      |fast   |slow   |slow      |slow        |slow         |slow     |slow      |slow
-`rcs_getmtime`      |fast   |slow   |slow      |no          |no           |no       |no        |no
+`rcs_getmtime`      |fast   |slow   |slow      |slow        |no           |no       |no        |no
 `rcs_preprevert`    |yes    |no     |no        |no          |no           |no       |no        |no
 `rcs_revert`        |yes    |no     |no        |no          |no           |no       |no        |no
 anonymous push      |yes    |no     |no        |no          |no           |no       |no        |no
index fa413cf24a20432cb5a5221d47fe0032b93216bc..fcf39be6a74aa6a0569a0d1b66068d4ca5936547 100644 (file)
@@ -247,6 +247,9 @@ span.color {
 .comment-subject {
        font-weight: bold;
 }
+.comment-avatar {
+       float: right;
+}
 .comment {
        border: 1px solid #aaa;
        padding: 3px;
index 91f924fa126fd25f296de803d8830d4627d4ddb4..7fa3762da99744eab54d6dfa6e377d9df91a7736 100644 (file)
@@ -3,6 +3,9 @@
 It would be nice if ikiwiki, particularly [[plugins/comments]]
 (but also, ideally, recentchanges) supported user avatar icons.
 
+> Update: Done for comments, but not for anything else, and the directive
+> below would be a nice addition. --[[Joey]] 
+
 Idea is to add a directive that displays a small avatar image for a user.
 Pass it a user's the email address, openid, username, or the md5 hash
 of their email address:
@@ -26,40 +29,3 @@ not have a gravatar, uses a cute auto-generated "wavatar" avatar.
 The `gravitar_options` setting in the setup file can be used to
 specify additional options to pass. So for example if you want
 to use wavatars everywhere, set it to "default=wavatar".
-
-The avatars are provided by various sites. For email addresses, it uses a
-[gravatar](http://gravatar.com/). For a wiki username, the
-user's email address is looked up and the gravatar for that user is
-displayed. (Of course, the user has to have filled in their email address
-on their Preferences page for that to work. Also, when the user changes
-their email address in Preferences, the gravatar won't change until the
-wiki is rebuilt.)
-
-For openid, openavatar sucked and is now dead. So we need to use an email
-address instead, I guess. Problem is that the email address of a given
-openid is only known when that user is logged in and making a change.
-And we don't want to leak an openid user's email into a page either.
-Hmm. Suppose the gravatar hash could be calculated from the email address
-and embedded instead of the openid? That would work for comments,
-but not if the directive were used elsewhere.
-
-Or, for openid, could use <http://paulisageek.com/openidavatar>. Which
-works fine, but users are not likely to figure out what they need to do to
-get an avatar associated with their openid.
-
----
-
-Alternative, not overdesigned approach:
-
-Modify comments plugin to have an option to display avatars.
-
-When posting a comment, fill in the avatarhash field in the template.
-The hash is calculated from the user's email address. If the user's email
-is not known, skip it. 
-
-End. :P
-
----
-
-[libravatar](https://launchpad.net/libravatar) is a federated avatar
-system. Young but might be the right way to get avatars eventually.
index c164cf54aa9bbea7f8181bc0f26a2239e8bdc9c4..baad063ef53d78c48bd6f184cae6ffa49e8a62bc 100644 (file)
@@ -77,9 +77,20 @@ and decided this time it was really needed to implement this feature.
 >>>>> rewrite warning) mirrorlist branch. Please review, please pull.
 >>>>> --[[intrigeri]]
 
+>>>>>> Ping? I've merged 3.20110321 in my `mirrorlist` branch and
+>>>>>> checked it still works properly. --[[intrigeri]]
+
 >>>>> concerning goto/cgiurl, what about having that as the default in
 >>>>> mirrorlist, but keeping ``nousedirs|file:///home/intrigeri/wiki`` and
 >>>>> ``usedirs|http://example.com/wiki`` valid for cgi-less cases?
 >>>>> that would keep typical installation with a clutter-less configuration,
 >>>>> and support more individual setups too.
 >>>>> --[[chrysn]]
+
+>>>>>> I would not mind. On the other hand Joey was concerned about
+>>>>>> cluttering the code to support edge cases, which I fully
+>>>>>> understand. The case you (chrysn) are describing being even
+>>>>>> more specific than the one I was initially talking of, I think
+>>>>>> this should not block the merge of the branch I have been
+>>>>>> proposing. Support for the usecase you are suggesting can
+>>>>>> always be added later if needed. --[[intrigeri]]
index c2ee5a37133107cc2461fa8d36e58f1e778afe30..c16ca7c810c78f6cabac99bfed6b5bfb19c8b72c 100644 (file)
@@ -1,6 +1,10 @@
 <TMPL_IF HTML5><article class="comment" id="<TMPL_VAR COMMENTID>">
 <TMPL_ELSE><div class="comment" id="<TMPL_VAR COMMENTID>"></TMPL_IF>
 
+<TMPL_IF COMMENTAUTHORAVATAR><div class="comment-avatar">
+<img src="<TMPL_VAR COMMENTAUTHORAVATAR>" alt="" />
+</div></TMPL_IF>
+
 <TMPL_IF HTML5><header class="comment-subject"><TMPL_ELSE><div class="comment-subject"></TMPL_IF>
 <TMPL_IF PERMALINK>
 <a href="<TMPL_VAR PERMALINK>"><TMPL_VAR TITLE></a>
@@ -58,4 +62,5 @@ Comment by
 <TMPL_IF HTML5></nav><TMPL_ELSE></div></TMPL_IF>
 </TMPL_IF>
 
+<div style="clear: both"></div>
 <TMPL_IF HTML5></article><TMPL_ELSE></div></TMPL_IF>