X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/631c0d9e7c3892abb79bcb31b5769390846a07c3..0c60457be436b2b03de951f38bf048e5a5b8a019:/IkiWiki.pm

diff --git a/IkiWiki.pm b/IkiWiki.pm
index 7035cb034..08e242a1f 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -305,9 +305,9 @@ sub getsetup () {
 		rebuild => 0,
 	},
 	umask => {
-		type => "integer",
-		example => "022",
-		description => "force ikiwiki to use a particular umask",
+		type => "string",
+		example => "public",
+		description => "force ikiwiki to use a particular umask (keywords public, group or private, or a number)",
 		advanced => 1,
 		safe => 0, # paranoia
 		rebuild => 0,
@@ -587,7 +587,23 @@ sub checkconfig () {
 		unless exists $config{wikistatedir} && defined $config{wikistatedir};
 
 	if (defined $config{umask}) {
-		umask(possibly_foolish_untaint($config{umask}));
+		my $u = possibly_foolish_untaint($config{umask});
+
+		if ($u =~ m/^\d+$/) {
+			umask($u);
+		}
+		elsif ($u eq 'private') {
+			umask(077);
+		}
+		elsif ($u eq 'group') {
+			umask(027);
+		}
+		elsif ($u eq 'public') {
+			umask(022);
+		}
+		else {
+			error(sprintf(gettext("unsupported umask setting %s"), $u));
+		}
 	}
 
 	run_hooks(checkconfig => sub { shift->() });
@@ -1237,7 +1253,7 @@ sub htmllink ($$$;@) {
 				$cgilink = "<a href=\"".
 					cgiurl(
 						do => "create",
-						page => lc($link),
+						page => $link,
 						from => $lpage
 					)."\" rel=\"nofollow\">?</a>";
 			}
@@ -1394,7 +1410,8 @@ sub preprocess ($$$;$$) {
 				|
 					'''(.*?)'''     # 4: triple-single-quote
 				|
-					<<(?<start>[a-zA-Z]+)\n(?<heredoc>.*?)\n\k<start> # 5, 6: heredoc'd value.
+					<<([a-zA-Z]+)\n # 5: heredoc start
+					(.*?)\n\5	# 6: heredoc value
 				|
 					(\S+)		# 7: unquoted value
 				)
@@ -1417,8 +1434,8 @@ sub preprocess ($$$;$$) {
 				elsif (defined $7) {
 					$val=$7;
 				}
-				elsif (defined $+{heredoc}) {
-					$val=$+{heredoc};
+				elsif (defined $6) {
+					$val=$6;
 				}
 
 				if (defined $key) {
@@ -1488,9 +1505,10 @@ sub preprocess ($$$;$$) {
 						|
 						"[^"]*?"	# single-quoted value
 						|
-						<<(?<start>[a-zA-Z]+)\n(?<heredoc>.*?)\n\k<start> # heredoc'd value.
+						'''.*?'''	# triple-single-quote
 						|
-						'''.*?''' # triple-single-quoted value
+						<<([a-zA-Z]+)\n # 5: heredoc start
+						(?:.*?)\n\5	# heredoc value
 						|
 						[^"\s\]]+	# unquoted value
 					)
@@ -1515,9 +1533,10 @@ sub preprocess ($$$;$$) {
 						|
 						"[^"]*?"	# single-quoted value
 						|
-						'''.*?'''       # triple-single-quoted value
+						'''.*?'''       # triple-single-quote
 						|
-						<<(?<start>[a-zA-Z]+)\n(?<heredoc>.*?)\n\k<start> # heredoc'd value.
+						<<([a-zA-Z]+)\n # 5: heredoc start
+						(?:.*?)\n\5	# heredoc value
 						|
 						[^"\s\]]+	# unquoted value
 					)
@@ -2789,6 +2808,7 @@ sub cmp_title {
 	IkiWiki::pagetitle(IkiWiki::basename($b))
 }
 
+sub cmp_path { IkiWiki::pagetitle($a) cmp IkiWiki::pagetitle($b) }
 sub cmp_mtime { $IkiWiki::pagemtime{$b} <=> $IkiWiki::pagemtime{$a} }
 sub cmp_age { $IkiWiki::pagectime{$b} <=> $IkiWiki::pagectime{$a} }