Permalink
Browse files

[p5w] now cosmetically removes the underscores in page titles

  • Loading branch information...
1 parent 685f1ba commit cad247150fd6d995618eee1fc5b05351633d2fc2 @masak masak committed Oct 17, 2008
Showing with 31 additions and 20 deletions.
  1. +0 −2 docs/JANITORS
  2. +23 −10 p5w/November.pm
  3. +1 −1 p5w/skin/edit.tmpl
  4. +1 −1 p5w/skin/not_found.tmpl
  5. +2 −2 p5w/skin/page_history.tmpl
  6. +3 −3 p5w/skin/toolbar.tmpl
  7. +1 −1 p5w/skin/view_diff.tmpl
View
@@ -15,8 +15,6 @@ free to remove it.
* Add 'return_to' links for the login and logout actions. And maybe redirects,
or at least manual links.
-* Cosmetically remove the underscores in link titles.
-
* Implement 'created new page' flag in recent-changes.
* Implement 'minor edits'.
View
@@ -57,7 +57,6 @@ sub handle_request {
if (ref($handler) eq "CODE") {
$handler->($cgi);
-
}
else {
print unknown_action($cgi);
@@ -95,10 +94,20 @@ sub exists_wiki_page {
return $page && -e $CONTENT_PATH.$page;
}
+# Pretty-printing of page names. A more self-explanatory (but still succinct)
+# name for this subrouting would be a good thing -- suggestions welcome.
+sub pp {
+ my ($name) = @_;
+
+ $name =~ s/_/ /g;
+
+ return $name;
+}
+
sub make_link {
my ($page, $title) = @_;
- $title ||= $page;
+ $title ||= pp($page);
return exists_wiki_page( $page )
? qq|<a href="/?page=$page">$title</a>|
: qq|<a href="/?page=$page&action=edit" class="nonexistent">$title</a>|;
@@ -185,7 +194,7 @@ sub format_html {
$text =~ s{ \&amp;mdash; }{&mdash;}msxg;
- # Add paragraphs
+ # Add paragraph tags
$text =~ s{\n\s*\n}{\n<p>}xg;
return $text;
@@ -435,7 +444,8 @@ sub view_page {
my $template = HTML::Template->new(
filename => $TEMPLATE_PATH.'view.tmpl');
- $template->param(TITLE => $page,);
+ $template->param(PAGE => $page);
+ $template->param(TITLE => pp($page));
$template->param(VIEW_PAGE => 1) unless $revision;
my $contents;
@@ -542,8 +552,8 @@ sub edit_page {
filename => $TEMPLATE_PATH.'edit.tmpl');
$template->param(PAGE => $page);
- my $title = $action . ' ' . $page;
- $template->param(TITLE => $title);
+ $template->param(ACTION => $action);
+ $template->param(TITLE => pp($page));
$template->param(PAGETAGS => read_page_tags($page));
$template->param(CONTENT => $old_content);
$template->param(LOGGED_IN => logged_in($cgi));
@@ -590,8 +600,9 @@ sub view_history {
my $template = HTML::Template->new(
filename => $TEMPLATE_PATH.'page_history.tmpl');
- $template->param(PAGE => $page);
- $template->param(CHANGES => \@changes);
+ $template->param(PAGE => $page);
+ $template->param(TITLE => pp($page));
+ $template->param(CHANGES => \@changes);
$template->param(LOGGED_IN => logged_in($cgi));
print status_ok(),
@@ -625,8 +636,9 @@ sub view_diff {
my $template = HTML::Template->new(
filename => $TEMPLATE_PATH.'view_diff.tmpl');
- $template->param(PAGE => $page);
- $template->param(HUNKS => \@changes);
+ $template->param(PAGE => $page);
+ $template->param(TITLE => pp($page));
+ $template->param(HUNKS => \@changes);
$template->param(LOGGED_IN => logged_in($cgi));
print status_ok(),
@@ -815,4 +827,5 @@ sub tag_count_normalize {
use POSIX;
ceil( ( log($step + 1 ) * 10 ) / log 2 );
}
+
1;
View
@@ -7,7 +7,7 @@
<body>
<TMPL_INCLUDE NAME="toolbar.tmpl">
<div id="content">
- <h1><TMPL_VAR NAME=TITLE></h1>
+ <h1><TMPL_VAR NAME=ACTION> <TMPL_VAR NAME=TITLE></h1>
<form method="POST">
<input type="hidden" name="page" value="<TMPL_VAR NAME=PAGE>" />
<input type="hidden" name="action" value="edit" />
@@ -8,7 +8,7 @@
<TMPL_INCLUDE NAME="toolbar.tmpl">
<div id="content">
<h1>Page not found</h1>
- The page <TMPL_VAR NAME=PAGE> was not found.
+ The page '<TMPL_VAR NAME=TITLE>' was not found.
</div>
</body>
</html>
@@ -1,13 +1,13 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <title>History of '<TMPL_VAR NAME=PAGE>'</title>
+ <title>History of '<TMPL_VAR NAME=TITLE>'</title>
<link rel="stylesheet" type="text/css" href="spartan.css" />
</head>
<body>
<TMPL_INCLUDE NAME="toolbar.tmpl">
<div id="content">
- <h1>History of '<TMPL_VAR NAME=PAGE>'</h1>
+ <h1>History of '<TMPL_VAR NAME=TITLE>'</h1>
<ul>
<TMPL_LOOP NAME=CHANGES>
@@ -1,12 +1,12 @@
<ul id="toolbar">
<TMPL_IF NAME=LOGGED_IN>
<TMPL_IF NAME=VIEW_PAGE>
- <li><a href="?page=<TMPL_VAR NAME=TITLE>&action=edit">Edit</a></li>
- <li><a href="?page=<TMPL_VAR NAME=TITLE>&action=view_history">History</a></li>
+ <li><a href="?page=<TMPL_VAR NAME=PAGE>&action=edit">Edit</a></li>
+ <li><a href="?page=<TMPL_VAR NAME=PAGE>&action=view_history">History</a></li>
<TMPL_ELSE>
<TMPL_IF NAME=PAGE>
- <li><a href="?page=<TMPL_VAR NAME=PAGE>">Back to <TMPL_VAR NAME=PAGE></a></li>
+ <li><a href="?page=<TMPL_VAR NAME=PAGE>">Back to <TMPL_VAR NAME=TITLE></a></li>
<TMPL_ELSE>
<li><a href="/">Back to Main Page</a></li>
</TMPL_IF>
@@ -7,7 +7,7 @@
<body>
<TMPL_INCLUDE NAME="toolbar.tmpl">
<div id="content">
- <h1>Diff of <TMPL_VAR NAME=PAGE></h1>
+ <h1>Diff of <TMPL_VAR NAME=TITLE></h1>
<table class="diff">
<TMPL_LOOP NAME=HUNKS>

0 comments on commit cad2471

Please sign in to comment.