From bb3a3408fdda3cc39fe6229c0ff29b0187f51abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20Goetz?= Date: Sat, 18 Jul 2015 23:51:23 +0200 Subject: [PATCH] Bugfix in the path rebase from the HTML Generator --- daux.phar | Bin 712843 -> 712921 bytes libs/Format/HTML/Generator.php | 24 +++++++++++++++++++----- libs/Tree/Builder.php | 1 - 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/daux.phar b/daux.phar index 28ceb5727293d8eee9d498b999ea57fbf744d850..d798523996d2d9bfe1c2b92c90653cf7c5835f0c 100644 GIT binary patch delta 4230 zcmaJ^33Qaz75@KhGnttrlT0$%Co|b53&~6ZWMRm@lZ5PhNG2qcWU`w?fq-ZZ6=;zy zPx+zR7@$>4gGH@|bBsVls)AS$>QV$zE2s3JpgkgMO%+O<(&Uq?z_wT-uLdk zFSBhf_WiloBYzMb_Ps$4i*ZbRATDA;;gG^au0s+N8yvEjIPQ=^#e`!fQ?ebSndo;k zGO@=I(We{{{V&H-xH#oA@hc|_6R$ZfX5w2Xq+H^R4F;T3+2ZfH_K9;9(^6b2nRwWx znu(8HN|-Rq(wP{N0m}2Tbk)8$4%NuK1!0S0+ZK}U>_^Jv&LlwYrv6ec2+YXj;49WC zk}Qw&zp${#Fl7Q0wMtO; zkTRBO&nc1fsuCoJs?ykEn<|%yr&NVZe8Gjq4TP+B%Vvwm-D;Webzi|myE}+H>b{a` zau4v?>;Y}s1D7+;wPJMvh&<&W2yd^w)J$%v&Eze$mc?CDmot&#iMXwvbxixn6RDHD znwj>9S3MJ-d%-hPgR9!10nYa{#mpAr4S;s@ws=~LqHy!gL+l-TmY7KW z=Rd}7^+oJ&d=Yfr7iF2?2U6Gg<*^jU{21XA{y@IMA1D5`Km4!x7cq~70EDgMVlDs$ zF(1I;T3iJo?7i%b#NZxAjt9!fSfCbIT4|ZhXP=!RxBQtQh-JDQi2Fzg;t7Mm&&xqz zOA!nN)xkKC6kLKVPto)nYU}&R?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zryNsix*SNuDiEW;0-U^A0WP(bVj0|}FWc2aTXx~!foH1K5V>5F>YG38>Se(C=^`~9tU-00uPMek z^t3vzWN*w_xbvkfT1PDso~}huX&q8@)&cuDQ3Tb4jlO!Yc&T12wGSy^Es9 zbB(^l(V$`hw=~ou8Ao5=C**6Tq_tSwS2u=Yql#X1SHhLA>6}oK@s+glsPjXOc!zd3 zqBL$bqVThtfaYM6IAGRO$MT8kH^}-r3(0K8TienMP*cs|OWlIEZ=^+p7(?sfC*KP* zv>q4)FY4q?)U6r@)7*+oyISi2s*h6h-iX_85L@4d*!DJXvbPQM_`0Yiu0{KeuEp%Q zycPuO)a8JTkUFm#t3 zpj_V}7T`Fon$$#BJ)KF3WV{1SdaMJ3==%=j%Ebag>{xeEj7 zUKa|o(8+#3k=;%pzwU&ep&Jj1vm2HtyU{4$cjK{1>4C{3J=nY0Bi3^jeQn2Lp0=_f zP0YQR>K(laEcAh1WO%=K1=Cb6^jVE7ooP?H@PpI29)=`Ya~|yMYf9 zT(x`{Iro-=oS4&{3gc_sgunSov}D_1sql3KUq$?nD#^a-qJN zHw!OD@NzOSA0s>*N$u{>R|>``eq!=&6rb!S%$s>nq1(W}WFB@7_d4_$85w$mv#;H; z$zarPkwv+jeNNW~SIa=#prdcNrQJE$GUObgc7oN&>s3a*U7w_1uD7PkoE`eub^ROq zhJ|-xdCiicSff#I%h3P72#7x1S`VEeuVM7y6 z8ujxsPTbPt*i0RWiC6N1J)W0TvNJuf>2UTsS~d(i7kq!o5~XHvGv%n$(eS|he`|)O zU!2KEvgU(?N81}~&z*iA^pnuflYVSZNgenerateRecursive($daux->tree, $destination, $params, $output, $width); } + private function rebaseConfig(Config $config, $base_url) + { + // Avoid changing the url if it is already correct + if ($config['base_url'] == $base_url && !empty($config['theme']) && !is_string($config['theme'])) { + return; + } + + // Change base url for all links on the pages + $config['base_url'] = $config['base_page'] = $base_url; + $config['theme'] = DauxHelper::getTheme($config, $base_url); + $config['image'] = str_replace('', $base_url, $config['image']); + } + /** * Recursively generate the documentation * @@ -45,20 +59,20 @@ class Generator */ private function generateRecursive(Directory $tree, $output_dir, $params, $output, $width, $base_url = '') { - $params['base_url'] = $params['base_page'] = $base_url; + $this->rebaseConfig($params, $base_url); - // Rebase Theme - $params['theme'] = DauxHelper::getTheme($params, $base_url); - - $params['image'] = str_replace('', $base_url, $params['image']); if ($base_url !== '' && empty($params['entry_page'])) { $params['entry_page'] = $tree->getFirstPage(); } + foreach ($tree->getEntries() as $key => $node) { if ($node instanceof Directory) { $new_output_dir = $output_dir . DS . $key; mkdir($new_output_dir); $this->generateRecursive($node, $new_output_dir, $params, $output, $width, '../' . $base_url); + + // Rebase configuration again as $params is a shared object + $this->rebaseConfig($params, $base_url); } elseif ($node instanceof Content) { $this->runAction( "- " . $node->getUrl(), diff --git a/libs/Tree/Builder.php b/libs/Tree/Builder.php index 0df78f5..e45252a 100644 --- a/libs/Tree/Builder.php +++ b/libs/Tree/Builder.php @@ -1,6 +1,5 @@