]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/capitalize_title.mdwn
Progress, links, an idea, improve table formatting.
[ikiwiki.git] / doc / todo / capitalize_title.mdwn
1 Here I propose an option (with a [[patch]]) to capitalize the first letter (ucfirst) of default titles : filenames and urls can be lowercase but title are displayed with a capital first character (filename = "foo.mdwn", pagetitle = "Foo"). Note that \[[!meta title]] are unaffected (no automatic capitalization). Comments please :) --[[JeanPrivat]]
2 <pre><code>
3 diff --git a/IkiWiki.pm b/IkiWiki.pm
4 index 6da2819..fd36ec4 100644
5 --- a/IkiWiki.pm
6 +++ b/IkiWiki.pm
7 @@ -281,6 +281,13 @@ sub getsetup () {
8                 safe => 0,
9                 rebuild => 1,
10         },
11 +       capitalize => {
12 +               type => "boolean",
13 +               default => undef,
14 +               description => "capitalize the first letter of page titles",
15 +               safe => 1,
16 +               rebuild => 1,
17 +       },
18         userdir => {
19                 type => "string",
20                 default => "",
21 @@ -989,6 +996,10 @@ sub pagetitle ($;$) {
22                 $page=~s/(__(\d+)__|_)/$1 eq '_' ? ' ' : "&#$2;"/eg;
23         }
24  
25 +       if ($config{capitalize}) {
26 +               $page = ucfirst $page;
27 +       }
28 +
29         return $page;
30  }
31 </code></pre>