[Da-tools-commits] ./debian/userdir-ldap-cgi r116: Ignore the * in [[*host]] links, and ignore [[- ]] in [[-hostname]] entries.

Peter Palfrader peter at palfrader.org
Sun Nov 23 20:42:59 UTC 2008


------------------------------------------------------------
revno: 116
committer: Peter Palfrader <peter at palfrader.org>
branch nick: userdir-ldap-cgi
timestamp: Sun 2008-11-23 21:42:59 +0100
message:
  Ignore the * in [[*host]] links, and ignore [[- ]] in [[-hostname]] entries.
modified:
  debian/changelog
  machines.cgi
-------------- next part --------------
=== modified file 'debian/changelog'
--- a/debian/changelog	2008-11-14 19:35:58 +0000
+++ b/debian/changelog	2008-11-23 20:42:59 +0000
@@ -1,3 +1,11 @@
+userdir-ldap-cgi (0.3.24) unstable; urgency=low
+
+  * Ignore the * in [[*host]] links, and ignore [[- ]] in [[-hostname]]
+    entries.  Both are special to the ssh_known_hosts generation.
+    [Thomas Viehmann]
+
+ -- Peter Palfrader <weasel at debian.org>  Sun, 23 Nov 2008 21:42:09 +0100
+
 userdir-ldap-cgi (0.3.23) unstable; urgency=low
 
   * New hmac scheme for sudo passwords.

=== modified file 'machines.cgi'
--- a/machines.cgi	2008-07-15 19:46:23 +0000
+++ b/machines.cgi	2008-11-23 20:42:59 +0000
@@ -86,20 +86,33 @@
 
 sub wiki_link($) {
 	my ($in) = @_;
-	$in =~ s#\[\[(.*?)\|(.*?)\]\]#<a href="http://$1">$2</a>#g;
-	$in =~ s#\[\[(.*?)\]\]#<a href="http://$1">$1</a>#g;
+	# [[hostname|text]] makes a link
+	# [[hostname]] makes a link too
+	# if you add a * after [[ it's still the same, only not used for ssh_known_hosts in ud-generate
+	# [[-hostname]] are not links, but get added to known_hosts.  we should drop the [[- ]] tho
+	$in =~ s#\[\[\*?(.*?)\|(.*?)\]\]#<a href="http://$1">$2</a>#g;
+	$in =~ s#\[\[\*?(.*?)\]\]#<a href="http://$1">$1</a>#g;
+	$in =~ s#\[\[-(.*?)\]\]#$1#g;
 	return $in;
 }
 
+# in the purpose field [[host|some other text]] (where some other text is optional)
+# makes a hyperlink on the web thing. we now also add these hosts to the ssh known_hosts
+# file.  But so that we don't have to add everything we link we can add an asterisk
+# and say [[*... to ignore it.  In order to be able to add stuff to ssh without
+# http linking it we also support [[-hostname]] entries.
+#
+# sponsors are also wikified like purpose.  maybe others as well
 sub item_uplist($) {
 	my ($items) = @_;
 	my $out = undef;
+	my(@tmp) = grep(!/\[\[-/, @$items);
 
-	if (scalar @$items >= 1) {
+	if (scalar @tmp>= 1) {
 		$out = "<ul>".
 			join("", map { 
 				"<li>".wiki_link($_)."</li>\n";
-			  } sort {my $A=$a; my $B=$b; $A =~ s/[\[\]]//g; $B =~ s/[\[\]]//g; $A cmp $B} @{$items}
+			  } sort {my $A=$a; my $B=$b; $A =~ s/[\[\]\*]//g; $B =~ s/[\[\]\*]//g; $A cmp $B} @tmp
 			).
 			"</ul>";
 	}



More information about the Da-tools-commits mailing list