Skip to content

Commit cd019f2

Browse files
committed
added configurable date shortcut
1 parent 7106c11 commit cd019f2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

action.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ public function autostartpage_handle(Doku_Event &$event, $param) {
7474
// @!NS@ namespace of the page (with spaces) but with the first character uppercased
7575
// @!!NS@ namespace of the page (with spaces) but with the first character of all words uppercased
7676
// @!!NS!@ namespace of the page (with spaces) but with all characters uppercased
77-
/**TODO: ADD THESE, TOO**/
78-
// %a %d-%m-%y etc. e.g. Thu 06-12-12. Strftime placeholders are replaced by page creation time
79-
// %% a literal % character appears in your template
77+
// @DATE=STRFTIME@ Where `STRFTIME` is a strftime configure string of page creation time,
78+
// e.g. %a %d-%m-%y => Thu 06-12-12
8079

8180
$wikitext=preg_replace("/@NS@/", $ns, $wikitext);
8281
$wikitext=preg_replace("/@!NS@/", ucfirst($goodns), $wikitext);
@@ -94,6 +93,9 @@ public function autostartpage_handle(Doku_Event &$event, $param) {
9493
$wikitext=preg_replace("/@NAME@/",$INFO['userinfo']['name'], $wikitext);
9594
$wikitext=preg_replace("/@MAIL@/",$INFO['userinfo']['mail'], $wikitext);
9695
$wikitext=preg_replace("/@DATE@/",strftime("%D"), $wikitext);
96+
if(preg_match("/@DATE=(.*)@/", $wikitext, $matches)){
97+
$wikitext=str_replace($matches[0], strftime($matches[1]), $wikitext);
98+
}
9799

98100
if(!@file_exists($file)){
99101
/**

0 commit comments

Comments
 (0)