X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=app%2FController%2FWikipage.php;h=1c896fd8048493092f2bcb8bdff61c322e3be6fc;hb=9e35d9e1f6adb610b17e940616cd1dc4ec8aa0d7;hp=f350f9a993585d9a0c9fa31ea7d51622137cc4d9;hpb=ebc0d017c8a24bd16ca1f4347b39b07ba4349135;p=pharext%2Fpharext.org diff --git a/app/Controller/Wikipage.php b/app/Controller/Wikipage.php index f350f9a..1c896fd 100644 --- a/app/Controller/Wikipage.php +++ b/app/Controller/Wikipage.php @@ -19,6 +19,17 @@ class Wikipage implements Controller function __invoke(array $args = null) { $title = $args["page"]; + $this->app->getView()->addData(["title" => "About: $title"]); + if ($title === "Packager hook") { + $baseUrl = $this->app->getBaseUrl(); + $this->app->getView()->addData([ + "styles" => [$baseUrl->mod(":./highlight/styles/dark.css")], + "scripts" => [ + $baseUrl->mod(":./highlight/highlight.pack.js"), + "hljs.initHighlightingOnLoad();" + ] + ]); + } $page = $this->wikiPath($args["page"]); $this->app->display("pages/wiki", compact("title", "page")); } @@ -30,6 +41,7 @@ class Wikipage implements Controller return $s{0} !== "."; }); } + function wikiPath($page) { $file = basename(strtr($page, " ", "-"), ".md") . ".md"; return self::WIKI_PATH . $file;