From c86b9ae0ab4c622cce6e41e11c8962fe9af51af8 Mon Sep 17 00:00:00 2001 From: achmizs Date: Mon, 28 Jan 2019 19:50:20 +0000 Subject: [PATCH] Added support for bundled wikipages --- papyrus.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/papyrus.php b/papyrus.php index 5f037e8..dd3a449 100644 --- a/papyrus.php +++ b/papyrus.php @@ -42,6 +42,28 @@ if ($VersionedAssetsReattachFileExtension == true) { global $HTMLHeaderFmt; $HTMLHeaderFmt[] = "\n"; +## Define a custom PageStore for bundled pages. +class PapyrusPageStore extends PageStore { + function pagefile($pagename) { + global $FarmD; + $dfmt = $this->dirfmt; + if ($pagename > '') { + $pagename = str_replace('/', '.', $pagename); + if ($dfmt == dirname(__FILE__).'/wikilib.d/{$FullName}') + return $this->PFE(dirname(__FILE__)."/wikilib.d/$pagename"); + if ($dfmt == '$FarmD/pub/skins/papyrus/wikilib.d/{$FullName}') + return $this->PFE("$FarmD/pub/skins/papyrus/wikilib.d/$pagename"); + } + return $this->PFE(FmtPageName($dfmt, $pagename)); + } +} +global $WikiLibDirs, $RecipeInfo; +$PageStorePath = dirname(__FILE__).'/wikilib.d/{$FullName}'; +$where = count($WikiLibDirs); +if ($where > 1) $where--; +if ($RecipeInfo['Sisterly']['Version'] != '') $where--; // If Sisterly is enabled, then the last PageStore is the SisterStore, not the PmWiki stuff. So we have to insert at an index 1 less. +array_splice($WikiLibDirs, $where, 0, array(new PapyrusPageStore($PageStorePath))); + ## Label the body element with a class indicating the current page action. global $HTMLFooterFmt, $action; $HTMLFooterFmt[] = ""; -- 2.11.4.GIT