@@ -141,8 +141,8 @@ |
||
141 | 141 | case PageType::TERM: |
142 | 142 | $layouts = [ |
143 | 143 | // "taxonomy/$term.$format.$ext", // ie: taxonomy/velo.html.twig |
144 | - "_default/term.$format.$ext", // ie: _default/term.html.twig |
|
145 | - "_default/list.$format.$ext", // ie: _default/list.html.twig |
|
144 | + "_default/term.$format.$ext", // ie: _default/term.html.twig |
|
145 | + "_default/list.$format.$ext", // ie: _default/list.html.twig |
|
146 | 146 | ]; |
147 | 147 | if ($page->hasVariable('term')) { |
148 | 148 | $layouts = array_merge( |
@@ -42,7 +42,7 @@ |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | set_error_handler( |
45 | - function ($severity, $message, $file, $line) { |
|
45 | + function($severity, $message, $file, $line) { |
|
46 | 46 | throw new \ErrorException($message, 0, $severity, $file, $line, null); |
47 | 47 | } |
48 | 48 | ); |
@@ -132,7 +132,7 @@ |
||
132 | 132 | $this->options = array_merge([ |
133 | 133 | 'drafts' => false, // build drafts or not |
134 | 134 | 'dry-run' => false, // if dry-run is true, generated files are not saved |
135 | - 'page' => '', // specific page to build |
|
135 | + 'page' => '', // specific page to build |
|
136 | 136 | ], $options); |
137 | 137 | |
138 | 138 | // process each step |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $generatorManager = new GeneratorManager($this->builder); |
47 | 47 | |
48 | 48 | // loads local generators |
49 | - spl_autoload_register(function ($className) { |
|
49 | + spl_autoload_register(function($className) { |
|
50 | 50 | $generatorFile = Util::joinFile($this->config->getSourceDir(), 'generators', "$className.php"); |
51 | 51 | if (file_exists($generatorFile)) { |
52 | 52 | require $generatorFile; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | }); |
55 | 55 | |
56 | 56 | $generators = (array) $this->builder->getConfig()->get('generators'); |
57 | - array_walk($generators, function ($generator, $priority) use ($generatorManager) { |
|
57 | + array_walk($generators, function($generator, $priority) use ($generatorManager) { |
|
58 | 58 | if (!class_exists($generator)) { |
59 | 59 | $message = \sprintf('Unable to load generator "%s".', $generator); |
60 | 60 | $this->builder->getLogger()->error($message); |
@@ -119,8 +119,7 @@ |
||
119 | 119 | $this->url = (string) new self($this->builder, $page, $options); |
120 | 120 | break; |
121 | 121 | // asset as string |
122 | - case false !== strpos($value, '.') ? true : false: |
|
123 | - $this->url = $base.'/'.ltrim($value, '/'); |
|
122 | + case false !== strpos($value, '.') ? true : false : $this->url = $base.'/'.ltrim($value, '/'); |
|
124 | 123 | break; |
125 | 124 | // others cases? |
126 | 125 | default: |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $this->builder = $builder; |
72 | 72 | $this->config = $builder->getConfig(); |
73 | 73 | $paths = is_array($paths) ? $paths : [$paths]; |
74 | - array_walk($paths, function ($path) { |
|
74 | + array_walk($paths, function($path) { |
|
75 | 75 | if (empty($path)) { |
76 | 76 | throw new RuntimeException('The path parameter of "asset() can\'t be empty."'); |
77 | 77 | } |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | 'ext' => '', // file extension |
85 | 85 | 'type' => '', // file type (e.g.: image, audio, video, etc.) |
86 | 86 | 'subtype' => '', // file media type (e.g.: image/png, audio/mp3, etc.) |
87 | - 'size' => 0, // file size (in bytes) |
|
87 | + 'size' => 0, // file size (in bytes) |
|
88 | 88 | 'content_source' => '', // file content, before transformations |
89 | 89 | 'content' => '', // file content, after transformations |
90 | - 'width' => 0, // width (in pixels) in case of an image |
|
91 | - 'height' => 0, // height (in pixels) in case of an image |
|
90 | + 'width' => 0, // width (in pixels) in case of an image |
|
91 | + 'height' => 0, // height (in pixels) in case of an image |
|
92 | 92 | ]; |
93 | 93 | |
94 | 94 | // handles options |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | |
423 | 423 | try { |
424 | 424 | $img = ImageManager::make($assetResized->data['content_source']); |
425 | - $img->resize($width, null, function (\Intervention\Image\Constraint $constraint) { |
|
425 | + $img->resize($width, null, function(\Intervention\Image\Constraint $constraint) { |
|
426 | 426 | $constraint->aspectRatio(); |
427 | 427 | $constraint->upsize(); |
428 | 428 | }); |
@@ -132,7 +132,7 @@ |
||
132 | 132 | $buildProcess->setPty(Process::isPtySupported()); |
133 | 133 | $buildProcess->setTimeout(3600 * 2); // timeout = 2 minutes |
134 | 134 | |
135 | - $processOutputCallback = function ($type, $data) use ($output) { |
|
135 | + $processOutputCallback = function($type, $data) use ($output) { |
|
136 | 136 | $output->write($data, false, OutputInterface::OUTPUT_RAW); |
137 | 137 | }; |
138 | 138 |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | 'title' => 'Site title', |
17 | 17 | //'baseline' => 'Site baseline', |
18 | 18 | 'baseurl' => 'http://localhost:8000/', |
19 | - 'canonicalurl' => false, // if true 'url()' function preprends URL wirh 'baseurl' |
|
19 | + 'canonicalurl' => false, // if true 'url()' function preprends URL wirh 'baseurl' |
|
20 | 20 | 'description' => 'Site description', |
21 | - 'taxonomies' => [ // default taxonomies |
|
21 | + 'taxonomies' => [// default taxonomies |
|
22 | 22 | 'tags' => 'tag', // can be disabled with 'disabled' value |
23 | 23 | 'categories' => 'category', |
24 | 24 | ], |
25 | 25 | 'pagination' => [ |
26 | - 'max' => 5, // number of pages on each paginated pages |
|
26 | + 'max' => 5, // number of pages on each paginated pages |
|
27 | 27 | 'path' => 'page', // path to paginated pages. ie: '/blog/page/2/' |
28 | 28 | ], |
29 | 29 | 'date' => [ |
@@ -159,14 +159,14 @@ discard block |
||
159 | 159 | 'format' => 'yaml', |
160 | 160 | ], |
161 | 161 | 'body' => [ |
162 | - 'format' => 'md', // page body format (only Markdown is supported) |
|
162 | + 'format' => 'md', // page body format (only Markdown is supported) |
|
163 | 163 | 'toc' => ['h2', 'h3'], // headers used to build the table of contents |
164 | 164 | 'highlight' => [ |
165 | - 'enabled' => false, // enables code syntax highlighting (`false` by default) |
|
165 | + 'enabled' => false, // enables code syntax highlighting (`false` by default) |
|
166 | 166 | ], |
167 | 167 | 'images' => [ |
168 | 168 | 'lazy' => [ |
169 | - 'enabled' => true, // adds `loading="lazy"` attribute (`true` by default) |
|
169 | + 'enabled' => true, // adds `loading="lazy"` attribute (`true` by default) |
|
170 | 170 | ], |
171 | 171 | 'resize' => [ |
172 | 172 | 'enabled' => false, // enables image resizing by using the `width` extra attribute (`false` by default) |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | 'enabled' => false, // puts the image in a <figure> element and adds a <figcaption> containing the title (`false` by default) |
182 | 182 | ], |
183 | 183 | 'remote' => [ |
184 | - 'enabled' => true, // turns remote images to Asset to handling them (`true` by default) |
|
184 | + 'enabled' => true, // turns remote images to Asset to handling them (`true` by default) |
|
185 | 185 | ], |
186 | 186 | ], |
187 | 187 | ], |
@@ -210,17 +210,17 @@ discard block |
||
210 | 210 | ], |
211 | 211 | 'assets' => [ |
212 | 212 | 'dir' => 'assets', |
213 | - 'compile' => [ // Compile Saas |
|
213 | + 'compile' => [// Compile Saas |
|
214 | 214 | 'enabled' => true, |
215 | 215 | 'style' => 'expanded', // 'expanded' or 'compressed', |
216 | 216 | 'import' => ['sass', 'scss', 'node_modules'], |
217 | 217 | 'sourcemap' => false, // works in debug mode only |
218 | 218 | //'variables' => ['var' => 'value'] |
219 | 219 | ], |
220 | - 'minify' => [ // Minify CSS and JS |
|
220 | + 'minify' => [// Minify CSS and JS |
|
221 | 221 | 'enabled' => true, |
222 | 222 | ], |
223 | - 'fingerprint' => [ // Add fingerprint |
|
223 | + 'fingerprint' => [// Add fingerprint |
|
224 | 224 | 'enabled' => true, |
225 | 225 | ], |
226 | 226 | 'target' => 'assets', // target directory of remote and resized assets |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | 'optimize' => [ |
229 | 229 | 'enabled' => false, // enables images optimization with JpegOptim, Optipng, Pngquant 2, SVGO 1, Gifsicle, cwebp (`false` by default) |
230 | 230 | ], |
231 | - 'quality' => 75, // Image quality after optimization or resize (`75` by default) |
|
231 | + 'quality' => 75, // Image quality after optimization or resize (`75` by default) |
|
232 | 232 | 'responsive' => [ |
233 | 233 | 'enabled' => false, // creates responsive images with `html` filter (`false` by default) |
234 | 234 | 'widths' => [480, 640, 768, 1024, 1366, 1600, 1920], |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | // collects published pages |
66 | 66 | /** @var Page $page */ |
67 | - $filteredPages = $this->builder->getPages()->filter(function (Page $page) { |
|
67 | + $filteredPages = $this->builder->getPages()->filter(function(Page $page) { |
|
68 | 68 | return !empty($page->getVariable('published')); |
69 | 69 | }); |
70 | 70 | $max = count($filteredPages); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | // renders with Twig |
134 | 134 | try { |
135 | 135 | $deprecations = []; |
136 | - set_error_handler(function ($type, $msg) use (&$deprecations) { |
|
136 | + set_error_handler(function($type, $msg) use (&$deprecations) { |
|
137 | 137 | if (E_USER_DEPRECATED === $type) { |
138 | 138 | $deprecations[] = $msg; |
139 | 139 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | protected function getTranslations(Page $refPage): \Cecil\Collection\Page\Collection |
279 | 279 | { |
280 | 280 | /** @var Page $page */ |
281 | - $filteredPages = $this->builder->getPages()->filter(function (Page $page) use ($refPage) { |
|
281 | + $filteredPages = $this->builder->getPages()->filter(function(Page $page) use ($refPage) { |
|
282 | 282 | return $page->getId() !== $refPage->getId() |
283 | 283 | && $page->getVariable('langref') == $refPage->getVariable('langref') |
284 | 284 | && $page->getType() == $refPage->getType() |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | // add generator meta tag |
300 | 300 | if (!preg_match('/<meta name="generator".*/i', $rendered)) { |
301 | 301 | $meta = \sprintf('<meta name="generator" content="Cecil %s" />', Builder::getVersion()); |
302 | - $rendered = preg_replace_callback('/([[:blank:]]+)(<\/head>)/i', function ($matches) use ($meta) { |
|
302 | + $rendered = preg_replace_callback('/([[:blank:]]+)(<\/head>)/i', function($matches) use ($meta) { |
|
303 | 303 | return str_repeat($matches[1], 2).$meta."\n".$matches[1].$matches[2]; |
304 | 304 | }, $rendered); |
305 | 305 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | //'/href="([A-Za-z0-9_\.\-\/]+)\.md(\#[A-Za-z0-9\-]+)?"/is', |
317 | 317 | // https://regex101.com/r/ycWMe4/1 |
318 | 318 | '/href="(\/|)([A-Za-z0-9_\.\-\/]+)\.md(\#[A-Za-z0-9\-]+)?"/is', |
319 | - function ($matches) use ($page) { |
|
319 | + function($matches) use ($page) { |
|
320 | 320 | // section spage |
321 | 321 | $hrefPattern = 'href="../%s/%s"'; |
322 | 322 | // root page |